[solved] Gui drawing order

I have a tooltip for a context menu for an item button. My problem is that I don’t know how to define the z-order of these gui elements consistently.

I’m using setBin(‘gui-popup’, 50) to draw the context menu on top of the item button (which works), but now the tooltip sometimes show up under the context menu. I’ve tried varying the number argument and using other layers (default and fixed), but that didn’t seem to change anything.

So how can I define the z-order of a three-layered gui?

  1. parent the menu to the button, and parent the tooltip to the menu, OR
  2. use increasing value of sortOrder keyword in each constructor of them

Ah, I didn’t know sortOrder should be specified at construction. That fixed my problem. Thanks ynjh_jo!