Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to detect embeded control type that is selecte (Read 1749 times)
Binary_Poet
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Jan 17th, 2008
How to detect embeded control type that is selecte
Jan 17th, 2008 at 10:39am
Print Post  
I am trying to figure out how to tell the type hosted control in a node when a user selects the node (Diagram1_NodeSelected event...

Basically what we have is a designer where the user can draw a form with textboxes, labels, etc. I need to be able to detect the type of control they selected so I can show certain properties to them to change (ie: text, color, font size, etc)... we do not want to display every property as many of our users will get confused with every property available...

Thanks for any information!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to detect embeded control type that is sel
Reply #1 - Jan 17th, 2008 at 11:11am
Print Post  
Cast the Node event argument to ControlNode and use its Control property, e.g.

Code
Select All
if (e.Node is ControlNode)
{
	ControlNode node = (ControlNode)e.Node;
	if (node.Control is Button)
	{
		Button button = (Button)node.Control;
		// now show the button properties ...
	}
}
 



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


I love YaBB 1G - SP1!

Posts: 3
Joined: Jan 17th, 2008
Re: How to detect embeded control type that is sel
Reply #2 - Jan 17th, 2008 at 2:09pm
Print Post  
I am sorry for having a "blond moment" but having trouble figuring this one out. It is saying that ControlNode is a type and cannot be used as an expression.......

Imports MindFusion
Imports MindFusion.Diagramming
Imports MindFusion.Diagramming.WinForms

Private Sub Diagram1_NodeSelected(ByVal sender As Object, ByVal e As MindFusion.Diagramming.NodeEventArgs) Handles Diagram1.NodeSelected

       If (e.Node Is MindFusion.Diagramming.WinForms.ControlNode) Then


       End If


    End Sub
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to detect embeded control type that is sel
Reply #3 - Jan 17th, 2008 at 2:17pm
Print Post  
Should look like this in VB:

Code
Select All
If TypeOf e.Node Is ControlNode Then
	Dim node As ControlNode = DirectCast(e.Node, ControlNode)
	If TypeOf node.Control Is Button Then
		Dim button As Button = DirectCast(node.Control, Button)
		' now show the button properties ...
	End If
End If
 



You might take a look at the FormEditor sample project, since it is very close to what you are doing.

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


I love YaBB 1G - SP1!

Posts: 3
Joined: Jan 17th, 2008
Re: How to detect embeded control type that is sel
Reply #4 - Jan 17th, 2008 at 2:22pm
Print Post  
All I can say is wow! We just started to look at this toolkit and the support has been GREAT!!!!

Thanks,

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