Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Problem bring to front contents of shapenode (Read 7463 times)
silverbpm
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 1
Joined: Nov 2nd, 2011
Problem bring to front contents of shapenode
Nov 2nd, 2011 at 7:42am
Print Post  
Hi,

I am using Diagrmlite 1.1 and trying to add functionality to display some stats beneath each of the nodes in the diagram.

I have added a user control with the stats to the shapenode so that the new user control contents are displayed beneath the shapenode out of the border of the shapenode. When there are many shapenodes there is overlap of usercontrol contents with other shapenode, I want to bring the contents of the shapenode to front when mouse enters the shapenode. Please let me know if there is a way to do this.

I tried setting the ZIndex for the selected diagram node but it is not working.

Regards
Srinivas
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem bring to front contents of shapenode
Reply #1 - Nov 2nd, 2011 at 8:25am
Print Post  
Hi,

Are you really using version 1.1, or is it 2.1 (the latest one is 2.2)?

You can handle MouseMove like this to find the node under the mouse pointer:

Code
Select All
var mousePos = e.GetPosition(diagram.DocumentPlane);
var node = diagram.GetNodeAt(mousePos); 



Then if the found node is the user control, set its ZIndex to diagram.Nodes.Count - 1, or if it's a ShapeNode, set the ZIndex of its associated user control.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
srinivas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Problem bring to front contents of shapenode
Reply #2 - Nov 2nd, 2011 at 9:39am
Print Post  
Yes I am using Diagramlite 1.1, not 2.1.

Tried setting the ZIndex in the Node MouseEnter event but it is not working consistently. First time when the mouse enters the shapenode the contents are brought forward and moving mouse to some other node resetting the previously selected node but the same is not happening after first time.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem bring to front contents of shapenode
Reply #3 - Nov 2nd, 2011 at 12:23pm
Print Post  
I can't reproduce any problems setting ZIndex with the current release. I can see you guys have much newer versions of the control than v1.1 on your account at http://clientsarea.eu/, perhaps you should try this with the latest one first.
  
Back to top
 
IP Logged
 
srinivas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Problem bring to front contents of shapenode
Reply #4 - Nov 3rd, 2011 at 9:45am
Print Post  
Tried with Trail version of 2.2 and finding more issues as other existing functionality is not working.

Could you let me know the nearest version after 1.1 that would have the fix for ZIndex related issues?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem bring to front contents of shapenode
Reply #5 - Nov 3rd, 2011 at 10:13am
Print Post  
What exactly is not working? The biggest API change since v1.1 is that the Pen property has been removed, it has been replaced by Stroke, StrokeThickness, etc. That was done with the v1.2 release which also added templating support, and there shouldn't be any big changes since then apart from a couple of renamed members.
  
Back to top
 
IP Logged
 
srinivas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Problem bring to front contents of shapenode
Reply #6 - Nov 3rd, 2011 at 10:30am
Print Post  
I have a map with some stats displayed beneath each node.  ‘Schedule’ node is hiding the part of stats of ‘Print’ node, simple fix required is that when I place the mouse on 'Print' node the stats beneath that should be ‘brought to front’.

What I tried is to set the ZIndex of Print node to (Diagram.Nodes.Count-1) on node mouse_enter event but I am not getting the stats coming to front.

I am sending an email to snikolov@mind-fusion.com
with more info (piece of diagram and the code that I used to add the stats).
Srinivas.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem bring to front contents of shapenode
Reply #7 - Nov 3rd, 2011 at 6:14pm
Print Post  
Try setting the Canvas.ZIndex attached property for the pointed item and user control to some large value: Canvas.SetZIndex(item, value);

Stoyan
  
Back to top
 
IP Logged
 
srinivas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Problem bring to front contents of shapenode
Reply #8 - Nov 4th, 2011 at 9:49am
Print Post  
It is still not working with the code you mentioned (Canvas.SetZIndex(item, value); ).

I have the below code not consistently working,
for one node it is working when mouse leaves and for another node it is working when mouse enters, for both the nodes it is not reset when mouse leaves.

//Node_MouseEnter
void m_ShapeNode_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
{
NODE_ZINDEX = m_ShapeNode.ZIndex;
int indCnt = 0;
for (int i = 0; i < m_ProcessDiagram.Diagram.Nodes.Count; i++)
{
DiagramNode node = m_ProcessDiagram.Diagram.Nodes[i];
if (node != m_ShapeNode)
{
node.ZIndex = indCnt;
indCnt++;
}
}
m_ShapeNode.ZIndex = m_ProcessDiagram.Diagram.Nodes.Count - 1;
}

//Node_MouseLeave
void m_ShapeNode_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
{
m_ShapeNode.ZIndex = NODE_ZINDEX;
int indCnt = 0;
for (int i = 0; i < m_ProcessDiagram.Diagram.Nodes.Count; i++)
{
DiagramNode node = m_ProcessDiagram.Diagram.Nodes[i];
if (node != m_ShapeNode && indCnt != NODE_ZINDEX)
{
node.ZIndex = indCnt;
}
indCnt++;
}
}

Please let me know if I am doing something wrong here.

Also did you get a chance to look at the sample application that I sent by email?

Srinivas
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem bring to front contents of shapenode
Reply #9 - Nov 4th, 2011 at 11:44am
Print Post  
There wasn't any sample application attached, I can see only a screenshot in the email.
  
Back to top
 
IP Logged
 
srinivas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Problem bring to front contents of shapenode
Reply #10 - Nov 4th, 2011 at 1:45pm
Print Post  
I have sent it again from my GMail account, not sure if there is some firewall that doesn't allow any attachments from my office id.

Please check the test application and reply to the same id if possible.

Thanks
Srinivas.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem bring to front contents of shapenode
Reply #11 - Nov 4th, 2011 at 2:56pm
Print Post  
This worked for me in the sample app:

Code
Select All
void Node_MouseEnter(object sender, MouseEventArgs e)
{
	ShapeNode selectedNode = (ShapeNode)sender;
	//textArea.Text = selectedNode.Name+": ZIndex: "+selectedNode.ZIndex;
	Canvas.SetZIndex(selectedNode, short.MaxValue);
}

void Node_MouseLeave(object sender, MouseEventArgs e)
{
	ShapeNode selectedNode = (ShapeNode)sender;
	Canvas.SetZIndex(selectedNode, 0);
} 



I also had to remove the "textArea" element from the xaml code because it stopped the mouse enter/leave events.
  
Back to top
 
IP Logged
 
srinivas
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 41
Joined: Jul 27th, 2010
Re: Problem bring to front contents of shapenode
Reply #12 - Nov 4th, 2011 at 3:18pm
Print Post  
Stoyo,

Test app is working fine, will check that in the project code.

Thanks
Srinivas.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint