Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Using containers + ATL issue (Read 7171 times)
sbailey
Junior Member
**
Offline



Posts: 61
Location: MD
Joined: Apr 24th, 2009
Using containers + ATL issue
Apr 24th, 2009 at 12:59pm
Print Post  
I'm fairly new to FlowChartX (in fact, I'm still using the evaluation version), so the answer to this might be obvious, but I can't figure it out.

What is the proper order in which to create a series of tables, arrange them using a tree layout, and add them to a container box?

When I do the above in exactly that order, the tree layout gets squished such that the boxes are positioned in a vertical column. If I add them to a box before arranging them, though, most of them are positioned outside the box.

In both of these cases, the box ends up just being a rectangle slightly larger than the width of one of the tables. The only difference is whether or not the tables' final positions are inside or outside of the box.

Ideally, I'd like the tables to be arranged in a tree layout and the box to completely enclose them, AND for the box to resize itself to fit tables as they're moved around. Is this supported?

...

Second issue: I'm having trouble handling the SelectionMoved event in Win32 ATL (yeah, I know). Other events are working fine, but when I try to add SelectionMoved to my event sink, I get an "invalid callee" error, which usually is the result of mismatched parameters. This particular function, though, has no parameters!
  

Editor Programmer&&Bethesda Softworks
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using containers + ATL issue
Reply #1 - Apr 24th, 2009 at 3:04pm
Print Post  
Hi,

Items are automatically arranged either in a row or column when you add them to a container box. We'll implement a new ELayoutStyle value that will let you apply a custom layout and will upload it with a new V4.2.1 beta build on Monday. Our developer will check how to handle SelectionMoved from ATL and will let you know.

Stoyan
  
Back to top
 
IP Logged
 
sbailey
Junior Member
**
Offline



Posts: 61
Location: MD
Joined: Apr 24th, 2009
Re: Using containers + ATL issue
Reply #2 - Apr 24th, 2009 at 3:32pm
Print Post  
Great... Thank you!
  

Editor Programmer&&Bethesda Softworks
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using containers + ATL issue
Reply #3 - Apr 27th, 2009 at 11:02am
Print Post  
Hi,

This version adds lsCustom member to the ELayoutStyle enumeration, which you can assign to the LayoutStyle property of container boxes:
https://mindfusion.eu/_beta/flowchartx32_containers.zip

Now nodes stay where you place them in a container box, and the container's rectangle is set to the union of child nodes. There's also a new ResizeToFitChildren method that lets you update the container bounds after moving its children programmatically. This lets you apply TreeLayout to the container's children like this:

If ctrbox.Style = bsContainer Then
     Dim tl As New TreeLayout
     tl.Root = fcx.FindTable(...)
     tl.KeepRootPos = True
     fcx.ArrangeDiagram tl
      
     ctrbox.ResizeToFitChildren
End If

Or alternatively first arrange the child nodes and then call their PutInContainer mehtod.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using containers + ATL issue
Reply #4 - Apr 27th, 2009 at 11:23am
Print Post  
Regarding SelectionMoved, it worked in our test. What we did is to create an ActiveX control using the VS ATL wizard, added an ATL dialog and a method of the control to show the dialog, and inserted FlowchartX into the dialog. We've added a MessageBox call to the SelectionMoved handler that shows correctly when selected items are moved. What's interesting is that SelectionMoved was the last event defined in the control's type library, and if ATL has some boundary bug in the buffer that contains event type information, it might not work with the last official release. This beta version adds a new event (LayoutProgress), which might not work correctly now, instead of SelectionMoved...

Stoyan
  
Back to top
 
IP Logged
 
sbailey
Junior Member
**
Offline



Posts: 61
Location: MD
Joined: Apr 24th, 2009
Re: Using containers + ATL issue
Reply #5 - Apr 27th, 2009 at 3:00pm
Print Post  
That does indeed work. I suppose there's no way to have the end user be able to move the tables around with their owner box dynamically resizing itself, is there?

(I suppose I could have a mode where they get removed from their owner box then added back once situated.)
  

Editor Programmer&&Bethesda Softworks
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using containers + ATL issue
Reply #6 - Apr 27th, 2009 at 3:09pm
Print Post  
You could handle TableModifying and call the container's ResizeToFitChildren method from there. However the user won't be able to take the table out of the container, unless you provide some other means to do that.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
sbailey
Junior Member
**
Offline



Posts: 61
Location: MD
Joined: Apr 24th, 2009
Re: Using containers + ATL issue
Reply #7 - Apr 27th, 2009 at 3:25pm
Print Post  
Right, I noticed that I'm no longer able to move tables around. I'm trying to call RemoveFromContainer after ResizeToFit in order to do so, hoping to add them back and call ResizeToFit again once they're moved, but that seems to have no effect...? (might be my bug; if so, sorry)
  

Editor Programmer&&Bethesda Softworks
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using containers + ATL issue
Reply #8 - Apr 27th, 2009 at 3:36pm
Print Post  
Are you doing that from the TableModifying event handler? It should work without removing the table and adding it again; simply call ResizeToFit. I've tested this with boxes, and the handler looks like this:

Code
Select All
Private Sub fcx_BoxModifying(ByVal box As FLOWCHARTLibCtl.IBoxItem, ByVal docX As Long, ByVal docY As Long, ByVal selHandle As Long, Confirm As Boolean)
	If Not box.MasterGroup Is Nothing Then
		Dim c As box
		Set c = box.MasterGroup.MainObject
		c.ResizeToFitChildren
	End If
End Sub
 

  
Back to top
 
IP Logged
 
sbailey
Junior Member
**
Offline



Posts: 61
Location: MD
Joined: Apr 24th, 2009
Re: Using containers + ATL issue
Reply #9 - Apr 27th, 2009 at 5:10pm
Print Post  
Hm, looks as though I can't actually pick up the tables and move them around anymore when they're sitting on top of the box...
  

Editor Programmer&&Bethesda Softworks
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using containers + ATL issue
Reply #10 - Apr 27th, 2009 at 5:34pm
Print Post  
Is it when you handle TableModifying, or even without handling it? Have you set the ModificationStart property value?
  
Back to top
 
IP Logged
 
sbailey
Junior Member
**
Offline



Posts: 61
Location: MD
Joined: Apr 24th, 2009
Re: Using containers + ATL issue
Reply #11 - Apr 28th, 2009 at 2:55pm
Print Post  
With or without the event handler, and regardless of which value Modification Start is set to. I can draw arrows, but not move tables...
  

Editor Programmer&&Bethesda Softworks
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using containers + ATL issue
Reply #12 - Apr 29th, 2009 at 8:40am
Print Post  
Does it happens only with tables that are in a container? What Flowchart.Behavior value are you using? If you call SaveToXml and send the file to support@mindfusion.eu, we'll check what settings might be causing that.
  
Back to top
 
IP Logged
 
sbailey
Junior Member
**
Offline



Posts: 61
Location: MD
Joined: Apr 24th, 2009
Re: Using containers + ATL issue
Reply #13 - Apr 29th, 2009 at 3:02pm
Print Post  
Sent! Thank you. I'll try it with boxes today if I get a chance (but the behavior is set to flowchart default).
  

Editor Programmer&&Bethesda Softworks
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint