Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic KeepInsideParent logic (Read 2454 times)
feugen24
YaBB Newbies
*
Offline



Posts: 27
Joined: Sep 22nd, 2006
KeepInsideParent logic
Oct 18th, 2006 at 6:22am
Print Post  
Hi,
Supose I have 2 boxes(box1,box2). box2 is contained in box1. I set the  "box2.Constraints.KeepInsideParent = true;"
("Specifies whether a node should always stay in the boundaries of its group master node.")
and "box2.EnabledHandles = Handles.Move;" and then start the program...at this point box2 can be moved outside box1 with no restrictions(no group master node). If I attach box2 to box1, for ex: "b2.AttachTo(b1, GroupAnchorStyles.Top);" box2 can be moved but only inside box1(this is what I want)...but when I move box1, box2 comes to the initial position(dicatated by the type of attachment) because it's attached. 
   
   In short: How can I move a box inside another without attaching to a specific side/proportion of that master box?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeepInsideParent logic
Reply #1 - Oct 18th, 2006 at 7:11am
Print Post  
Hi,

I guess the logic here is that if you need to let users move a box only inside another one, you would also want that box to move when its container is moved. So, FlowChart.NET uses grouping together with KeepInsideParent. Why not call box2.Move(box1X, box1Y) before attaching? Then box2 would always stay inside box1.

Stoyan
  
Back to top
 
IP Logged
 
feugen24
YaBB Newbies
*
Offline



Posts: 27
Joined: Sep 22nd, 2006
Re: KeepInsideParent logic
Reply #2 - Oct 18th, 2006 at 7:57am
Print Post  
Hi,
Tks for the answer...but either I did't formulate the question clearly or the anwer is very unclear.
The first part I understand, but wat does "Why not call box2.Move(box1X, box1Y) before attaching?" mean?
If I call "box2.Move(box1X, box1Y)" then the second box will move at the x,y coordinates of the first one....it makes no sense because if I have box2 in the midle of box1 what would be the point of moving it at the x,y of box1 before attaching?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeepInsideParent logic
Reply #3 - Oct 18th, 2006 at 10:25am
Print Post  
I thought it goes outside because it is initially outside. Try using the AttachToCorner style, it should keep intact the position of the attached box relative to where the user placed it in the parent box.

Stoyan
  
Back to top
 
IP Logged
 
feugen24
YaBB Newbies
*
Offline



Posts: 27
Joined: Sep 22nd, 2006
Re: KeepInsideParent logic
Reply #4 - Oct 18th, 2006 at 11:32am
Print Post  
Tks,

It works. The reason I did't find it is because I search in documentation at the "index" field...and only "AttachTo Method,AttachToArrow Enumeration, AttachToNode Enumeration" are shown for the "Attach" keyword.

If others want to use "AttachToCorner " keep in mind that "Every group should have a single master object, to which all group members are attached. The master object can be accessed via the MainObj property.". If u do not specify that object it will generate a "Null ref exception" in AttachToCorner method call.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: KeepInsideParent logic
Reply #5 - Oct 18th, 2006 at 11:43am
Print Post  
You could just call

box2.AttachTo(box1, AttachToNode.TopLeft)

which will automatically create the group and call its AttachToCorner method.

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