Palette Questions

  1. How do you specify the order for objects displayed in a palette? For some reason the objects I add to the palette (such as GoText) end up being displayed before objects previously added to the palette.
  2. Is it possible to place the palette in a different window so that users can make it disappear if they no longer need to use it?
    Thanks for the help!


You can specify the value of GoPalette.Sorting; the default is SortOrder.Ascending.
Or you could provide an IComparer as the value of GoPalette.Comparer, if you don’t want to use the default comparison that compares the IGoLabeledNode.Text properties (if the items in the palette implement IGoLabeledNode).
Finally, you could override GoPalette.LayoutItems, and do whatever positioning you like in whatever order you please.


Would I need to override GoPalette.LayourItems to change the number of columns in the palette (I’m not sure how else to describe it) - because I would I would like to have my list of nodes look like this:
Node3, etc.
instead of how it currently does it:
Node1 Node2
Node3 Node4


There must not be enough horizontal room for two nodes to fit.
I forgot to answer #2: a GoPalette is a GoView is a Windows.Forms.Control, so you can treat it just like any other Control.


No that’s the problem - there is plenty of horizontal room but I want to force the nodes into this format regardless:
Node3, etc.


Just make the GridCellSize wider. The default is 60x60. Maybe 9999x60?


good idea - I will try that :) thanks!


hmmm . . . well I tried making the width of the GridCell wider but what it ended up doing was pushing the nodes completely out of view without scrolling over . . .


I just tried modifying the width constant used to set the palette’s GridCellSize in the ProtoApp sample, and it worked fine for me.
Is your GridOrigin a reasonable value? Are your nodes reasonably sized?


The GridOrigin is (15,15) and my nodes are all different sizes, I also included some GoText to try to divide up the space and categorize the nodes. The largest node is (40,28).