AutoLayout Timing


#1

I have an application that has multiple views on multiple tab controls. I have set the application up, so that if a user clicks and drags a node or selection on to a “empty tab”, I remove the node with all of its children from its orginial doc and create a new view on the new tab page and add those nodes. I am running into one little problem. I use a golayeredlayoutcontrol to layout each of my views. So after I catch my nodes added to view event, which basically encapsulates all the removing and adding of nodes, I call a DoLayout function which sets the layout controls document to whichever document the user is looking at. Then it calls the layouts perfromlayout function. It simply doesnt lay the nodes out. But if I dont put the perfrom layout in the code, but simply call it from my menu option, which in turn calls the same exact function, the layout works great. I have checked to ensure that the layout object is set to the right document well before I call the perfromlayout function. Can I be calling the perfrom layout before the document is done laying itself out? Is there a good way to attach to a views event handler of some sort that tells me that its done laying out its go objects, so I can therefore call my layout function? Sorry for the novel,
Ryan


#2

I’m not sure I understand your situation, but my guess is that when the Document doesn’t change, you need to make sure you set the GoLayout.Network property to null.
Of course, the easiest way to do this is to always set GoLayout.Network to null (or to some customized network) just before calling GoLayout.PerformLayout().


#3

Im sorry for the confusing post, it was written in the wee hours of the morning. Basically Im dragging nodes and links from one view on one tab control on to another view on another tab control. If I call the performlayout on the new view I have dragged to, it does a really crappy layout with the nodes and links overlapping each other, ect. But, if I call it from one of my menu options after the code has executed, it does perfrom the layout correctly. Im sure im doing something incorrectly for this one instance if it works well every other time I use the layout. I do set the network to null in my function call. I realize this is a coding error on my part, I was just looking for some suggestions, maybe refreshing the document before laying it out or something.
Correction on this last post, I just realized that is autolaying out all the nodes except the very top parent node correctly, which makes it look weird. So it positions the head node below all the other nodes. Hmmmm

Ryan