We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm using G4P ver4.0 library in processing 3.0.
I want to have labels/imagetogglebuttons displayed over top of other imagetogglebuttons.
I have tried creating the buttons in various order, but I cannot seem to control which one appears "on top".
I found the method setZ in the GAbstractControl, but it is a protected function.
How can I set the Z-order/depth of various GUI elements in G4P ?
Thanks,
Dan
Answers
My first question would by why?
The
setZ
method is protected becausez
is a calculated field based on the controls position on the display and whether the control is on a floating panel (GPanel). For instance a drop down list (GDropList) is no good if, when activated, is displayed under a button immediately below it.Allowing the user to modify the display order directly is likely to cause chaos and this forum full of questions about mouse clicks activating the wrong control etc. So this is not something I am going to enable.
There are ways round it for instance assume you have 2 image-toggle-buttons (t1 and t2) the same size and in the same position. You can
Invisible controls do not respond to mouse clicks so are effectively disabled.
Hi Quark,
Thanks for the response. This is what I'm trying to do:
I'm wanting to use either Labels and/or ImageToggleButtons as "Overlay Graphics" over my Tabs(ImageToggleButtons). If I incorporate the indicators as part of the image for the tabs, it will add an unreasonable amount of states.
I got this one to display 'over' the Tab by placing the co-ords slightly outside the Tab's co-ords.
I also tried using plain 2d drawing (eg line(x,y,xx,yy);) in processing to draw the indicators in code, but these also appear 'under' the gui elements.
Perhaps you can suggest a better practice to what I want to do?
Thanks again,
Dan
I solved my problem by making the larger Tab buttons have transparent 'holes' in them for the Overlay buttons:
Thanks, Dan