Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Some questions about form editor sample (Read 2627 times)
PDM.
Senior Member
****
Offline


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Some questions about form editor sample
Dec 23rd, 2010 at 9:31pm
Print Post  


Hi Stoyo, i continue checking the FORM EDITOR sample, and have a new siple question for create node, you have to drag over the form.
I not like a lot that way due some times you drag, node or is to llite or to big.
Is possibls change that  for make node is created just clicking over the form?

I think for me is better click and node is created at defalt size and seting in xaml SelectAfterCreate="True" select after is created.

The question is how, make node is crated with just single and siple clcik and not dragging?


Best regards.

« Last Edit: Dec 25th, 2010 at 8:34am by PDM. »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Some questions about form editor sample
Reply #1 - Dec 27th, 2010 at 9:55am
Print Post  
Hi Pablo,

You can do that by handling diagram.Clicked:

Code
Select All
private void form_Clicked(object sender, DiagramEventArgs e)
{
	var constructor = form.DefaultControlType.GetConstructor(System.Type.EmptyTypes);
	var instance = constructor.Invoke(null) as UIElement;
	var node = new DiagramNodeAdapter(instance);
	var bounds = new Rect(e.MousePosition, new Size(128, 128));
	bounds.Offset(-bounds.Width / 2, -bounds.Height / 2);
	node.Bounds = bounds;
	form.Items.Add(node);
	node.Selected = true;
} 



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


I love YaBB 1G - SP1!

Posts: 256
Joined: Dec 2nd, 2010
Re: Some questions about form editor sample
Reply #2 - Mar 21st, 2011 at 7:00am
Print Post  
Hello
This work perfect, but how can disable NODE creation when drag and only allo creation of node when node is clicked?



« Last Edit: Mar 21st, 2011 at 8:11am by PDM. »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Some questions about form editor sample
Reply #3 - Mar 21st, 2011 at 8:43am
Print Post  
Hi Pablo,

Set Behavior = Modify to only allow moving and resizing nodes with the mouse. Then the only way for the user to create a new node will be through the Clicked handler.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint