Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Problem with Expand Button (Read 5142 times)
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Problem with Expand Button
Nov 19th, 2009 at 9:12am
Print Post  
Hi Stoyo,

We have created ShapeNode in our application.
Code for which is as follows.

Code
Select All
ShapeNode mainNode = new ShapeNode(diagram);
	     diagram.Nodes.Add(mainNode);
 mainNode.Bounds = new Rect(100,100,120,30);
		    mainNode.Shape = Rectangle;
		    mainNode.Expanded = false;
		    mainNode.Expandable = true;
		    mainNode.ZIndex = 3;

&

diagram.ExpandButtonPosition = ExpandButtonPosition.Custom;
		   diagram.CustomExpandButtonPosition = (node) =>
		    {
			  Rect expandButtonBounds = node.Bounds;
		    expandButtonBounds.X = expandButtonBounds.Width - 12;
		    expandButtonBounds.Y = expandButtonBounds.Height - 12;
		    expandButtonBounds.Width = expandButtonBounds.Height = 8;
		    return expandButtonBounds;
		    };
		    diagram.ExpandButtonAction = ExpandButtonAction.RaiseEvents; 




When I click on expand button and move mouse outside the node, all associated nodes and outgoing links gets invisible. We are unable to debug this behavior.

Please suggest us for this critical issue.

Note- We got this problem when we implemented ExpandCustomPosition in our code. Is there any problem with this?

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Expand Button
Reply #1 - Nov 19th, 2009 at 11:15am
Print Post  
I suppose your ExpandButtonClicked event handler makes them invisible.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Problem with Expand Button
Reply #2 - Nov 19th, 2009 at 11:40am
Print Post  
Hi Stoyan,

Here is the code for ExpandButtonClicked.

Code
Select All
private void diagram_ExpandButtonClicked(object sender, NodeEventArgs e)
	  {
		try
		{
		    ShapeNode sourceNode = e.Node as ShapeNode;
		    if (!balloonMode && sourceNode != null)
		    {
			  OpenPopUp(sourceNode);
		    }
		}
		catch (Exception ex)
		{
		    Debug.WriteLine("Exception in diagram_ExpandButtonClicked: " + ex.Message);
		}
	  } 



We have sent a sample application at your support ID.
Please have a look into that and suggest us as soon as possible.

Note: Previously everything was working fine when we were using OuterLowerRight position, we are getting this issue while we are using Custom position.


Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Expand Button
Reply #3 - Nov 19th, 2009 at 12:17pm
Print Post  
Ok, it's your MouseEnter/Leave handlers hiding the nodes when you set the Expanded property of a parent node to false. If you want to change the icon to +/- without collapsing / expanding the whole branch under a node, call the sourceNode.SetExpandedFlag() method instead of setting the property.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Problem with Expand Button
Reply #4 - Nov 19th, 2009 at 1:23pm
Print Post  
Hi Stoyan,

I have tried with SetExpandedFlag(bool) method instead of set/reset Expanded property but not got any success. Behavior is still same, Outgoing links and Associated nodes are still getting delete.

Please suggest any other suggestion.


Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Expand Button
Reply #5 - Nov 19th, 2009 at 1:36pm
Print Post  
Make sure you have removed all assignments to Expanded.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Problem with Expand Button
Reply #6 - Nov 19th, 2009 at 4:15pm
Print Post  
Hi Stoyan,

Issue is now solved. You were right, I was missing 1 assignments.

Thanks a lot Smiley

Regards,
Anshul
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Problem with Expand Button
Reply #7 - Nov 20th, 2009 at 6:48am
Print Post  
Hi Stoyan,

That expander button visibility issue is now solved.
We are getting two different issues now.

1). While node is selected and selection border is there, node_mouseLeave is getting call but if condition returning false everytime. Due to this my code to hide the button is not getting execute.

code for node_mouseLeave is as follows.

Code
Select All
if (sourceNode != null && !sourceNode.ContainsPoint(e.GetPosition(diagram.DocumentPlane)))
  {
 ExpandButtonVisible(sourceNode, false);
  } 



Please suggest, if selection rectangle FALSE the ContainsPoint condition. If this is so what could we do to perform mouseLeave when node is selected.

2). We have anchor point in the node to draw link from this anchor point to another node. When mouse enters and we try to make the link by dragging mouse from this node to another node, ExpanderButton remains visible because in case of dragging, MouseLeave event does'nt get call.

Please suggest for this issue too.


Regards,
Anshul
« Last Edit: Nov 20th, 2009 at 9:16am by Anshul »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Expand Button
Reply #8 - Nov 20th, 2009 at 11:02am
Print Post  
Hi Anshul,

1) In this case MouseEnter and MouseLeave are not called for the node, but for adorner that draws the selection frame around it. You might add enter/leave handlers to it too:

node17.MouseEnter += node_MouseEnter;
node17.Adorner.MouseEnter += node_MouseEnter;
node17.MouseLeave += node_MouseLeave;
node17.Adorner.MouseLeave += node_MouseLeave;

2) Since the enter/leave events don’t work that well in your case, better handle MouseMove and call GetNodeAt to keep track of the current node under the mouse. When it changes from one node to another, run your enter/leave code.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Problem with Expand Button
Reply #9 - Dec 1st, 2009 at 2:24pm
Print Post  
Hi Stoyan,

We have some ShapeNodes in the diagram. Initially their Expandable property is set to false because we want to show the expand button only when mouse is over the node. we are setting Expandable = true on Node_MouseEnter handler.

It’s working very fine and has no issues.

Now I want to perform zooming on the diagram, I have written code for the same in diagram_MouseWheel handler. When I try to zoom and if mouse is over any node than node fluctuates some up and bottom position. But if I comment Expandable = true(in Node_MouseEnter), everything works fine but not able to see the expand button.

Please suggest if there is any way to avoid fluctuation in this condition.

The problem here is we are using following:

[code]
               diagram.ExpandButtonPosition = ExpandButtonPosition.Custom;
               diagram.CustomExpandButtonPosition = (node) =>
               {
                   Rect expandButtonBounds = node.Bounds;
                   expandButtonBounds.X = expandButtonBounds.Width - 12;
                   expandButtonBounds.Y = expandButtonBounds.Height - 12;
                   expandButtonBounds.Width = expandButtonBounds.Height = 8;
                   return expandButtonBounds;
               };

[/code]

On mouse wheel we zoom the diagram and position of node changes and so in regard to that the expand button position code runs and which cause problem, as it is trying to get the node at previous position.

We have also sent a sample for the same, please have a look into that.

Regards,
Anshul
« Last Edit: Dec 2nd, 2009 at 6:30am by Anshul »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Expand Button
Reply #10 - Dec 2nd, 2009 at 10:15am
Print Post  
Right, there's a bug in Diagram.GetContentBounds when using ExpandButtonPosition.Custom. For the time being, instead of using the diagram's method call the one copied below, both from your MouseWheel handler and SetZoom method. Another option is to temporarily switch ExpandButtonPosition to one of the standard values before calling the diagram's GetContentBounds.

Code
Select All
private Rect GetContentBounds()
{
	if (diagram.Nodes.Count == 0)
		return new Rect();

	Rect u = diagram.Nodes[0].Bounds;
	foreach (DiagramNode node in diagram.Nodes)
		u = Rect.Union(node.Bounds, u);
	return u;
}
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Problem with Expand Button
Reply #11 - Dec 2nd, 2009 at 12:42pm
Print Post  
Hi Stoyan,

We tried
1)."Direct call to GetContentBounds()" and
2)."temporarily switch ExpandButtonPosition to one of the standard values before calling the diagram's GetContentBounds()".

But still the Behavioure is same.
We are sending you the samples with the above implementations, please suggest any other changes required in that.

And please let us know when the next build  will be released with the above fix?

Regards,
Anshul
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Expand Button
Reply #12 - Dec 2nd, 2009 at 1:25pm
Print Post  
You should also replace diagram.ZoomToFit() with diagram.ZoomToRect(GetContentBounds()), or temporarily disable the Custom setting before ZoomToFit.
  
Back to top
 
IP Logged
 
Anshul
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 316
Joined: Apr 3rd, 2009
Re: Problem with Expand Button
Reply #13 - Dec 2nd, 2009 at 2:05pm
Print Post  
Thanks Stoyan, its working as expected.

And please let us know when the next build  will be released with the fix?

Regards,
Anshul
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint