Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic drag drop with attached box (Read 3344 times)
joekf
YaBB Newbies
*
Offline



Posts: 3
Joined: Jul 6th, 2009
drag drop with attached box
Jul 6th, 2009 at 6:17pm
Print Post  
I need to drag&drop a boxitem that contains another boxitem (using GetContainedItems) from an flowChart instance to another.

But when I do this an error (Access violation reading location 0x00000000) is fired by AfxState.cpp:AfxDeactivateActCtx function.

To fix it, I made a selection of the contained items when the box receives the click event. It works, but simply by add this contained items to selection list, they are removed from the contained list after unselect the container box.

I'm using the method CreateObjsFromDragData to create the drag&drop data.

Is there a better way to do this?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: drag drop with attached box
Reply #1 - Jul 7th, 2009 at 7:20am
Print Post  
Is it a box whose Style is set to bsContainer, or you used the CreateGroup/Attach methods to attach the child box?
  
Back to top
 
IP Logged
 
joekf
YaBB Newbies
*
Offline



Posts: 3
Joined: Jul 6th, 2009
Re: drag drop with attached box
Reply #2 - Jul 7th, 2009 at 1:27pm
Print Post  
I've tried these two ways:

First, when using CreateGroup/Attach, the MainObject and the attached one must be both selected before I start the drag and then call CreateObjsFromDragData. The creation is done but the attachment between the 2 boxes is lost.

Second, using GetContainedItems/Attach NOT setting  Style to bsContainer I still have to select both boxes before drag or then I got an access violation error. This way, the creation is done perfectly and the attachment is maintained. The issue is when I manually add to selection these boxes before drag them. I don't known why it makes the attachment to be undone.

The attached box occupies the entire area of its MasterGroup/MainObject and must be locked. Setting Style to bsContainer I couldn't drag the container. Likewise, I need the resize functionality that an container don't offers.

#1st
box2.SetLocked(TRUE);
box3.SetLocked(TRUE);
box1.GetContainedItems().AttachProportional(box2, 0, 0, 100, 50);
box1.GetContainedItems().AttachProportional(box3, 0, 50, 100, 100);

#2nd
GroupItem g = m_flow1.CreateGroup(box1);
box2.SetLocked(TRUE);
box3.SetLocked(TRUE);
g.AttachProportional(box2, 0, 0, 100, 50);
g.AttachProportional(box3, 0, 50, 100, 100);
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: drag drop with attached box
Reply #3 - Jul 7th, 2009 at 2:55pm
Print Post  
Try the CreateGroup/Attach approach with the FlowChart.ClipboardFlags[fCopySubordinateGroups] property set to true. GetContainedItems should be used only with bsContainer boxes.

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



Posts: 3
Joined: Jul 6th, 2009
Re: drag drop with attached box
Reply #4 - Jul 7th, 2009 at 3:43pm
Print Post  
Bingo!!!!! Now it works!

That's a great product but could be better with a more detailed documentation.

Thanks a lot for your support!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint