Automatically snap all GoGeneralNodes in GoView in UI



I’ve a GoView component in my UI that is populated with a bunch of GoGeneralNode objects (added to it programatically (user doesn’t drag-drop these nodes)). These Nodes are added successfully to the GoView but all of them are overlapped on one-another at the top-left (origin x,y co-ordinates). I was wondering if there’s any way to automatically (or with less effort) snap them to a grid (think each node is added from right-to-left and takes up the next “row” after the first “row” looks “filled up”).

Thus far, I’ve tried setting the GoView.GridStyle property and tried snapping them manually on the UI after they’re added but it doesn’t seem to work. There’s probably more easy way to do this but am unable to find it. Kindly help.

Any pointers are greatly appreciated. Thanks!


Sounds like you want automatic Layout… check GoLayeredDigraphLayout in the GoLayout User Guide.