Page 1 of 1
Unexpected z-order behaviour
Posted: Sun Mar 18, 2007 11:07 pm
by WishMaster
Code: Select all
OpenWindow(1, 0, 0, 500, 500, "")
CreateGadgetList(WindowID(1))
CreateImage(1, 500, 500)
CreateImage(2, 100, 100)
StartDrawing(ImageOutput(2))
Box(0, 0, 100, 100, RGB(255, 0, 255))
StopDrawing()
ImageGadget(1, 0, 0, 500, 500, ImageID(1))
ButtonImageGadget(2, 0, 0, 100, 100, ImageID(2))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Where is the ButtonImageGadget?
Posted: Mon Mar 19, 2007 12:25 am
by freak
PB is not designed to handle overlapping gadgets.
Posted: Mon Mar 19, 2007 9:10 am
by bembulak
So all the Skinned Win32 Apps written in PureBasic are not working and just look good?

Posted: Mon Mar 19, 2007 11:29 am
by walker
... I guess, the Imagegadget has a built in "always on top" feature.. :roll:
it's the only gadget I'd found so far with this behavior and I'm not sure if this is a PB issue or a GTK one...
If changing the ImageGadget to a ButtonImageGadget... it works as expected... even when using two ImageGadgets its (visually) working as expected....
anyway... in my opinion as a "normal" Gadget the ImageGadget should behave like the other's... if possible.... and take care of the Z-order
Posted: Mon Mar 19, 2007 12:56 pm
by Trond
GTk doesn't have a concept of z-order for widgets (if I'm correctly informated).
Posted: Mon Mar 19, 2007 1:06 pm
by freak
Trond is right.
In fact, the usual way to organize widgets in gtk is not even by x/y positions and fixed sizes,
but by nesting them into layout containers and letting gtk decide the best size.
In this concept, overlapped widgets simply cannot appear, so there is no need for a z-order.
PB uses a GtkFixed to allow the fixed positioning, but the z-order issue remains.
Even PB on windows has some z-order issues, which is why we decided not
to support it in PB.
Simply avoid overlapping the Gadgets... it makes more sense in many ways anyway.
Posted: Mon Mar 19, 2007 1:56 pm
by bembulak
Ok, I can live with that answer. It's more explainable.
I do have the problem, because I _want_ the Gadgets to overlap (Button on an Image).
But I know the Window --> Frame --> Gadgets in Frame - stuff of GTK, or better: I heard of it.
Now it makes sense. It's not a bug, but a feature here, isn't it?
So I have to redesign a program....
Thanks for the answer.
Posted: Fri Apr 20, 2007 11:29 am
by CSAUER
Re: Unexpected z-order behaviour
Posted: Fri Apr 20, 2007 1:25 pm
by PB
> Where is the ButtonImageGadget?
Here:
Code: Select all
OpenWindow(1, 0, 0, 500, 500, "")
CreateGadgetList(WindowID(1))
CreateImage(1, 500, 500)
CreateImage(2, 100, 100)
StartDrawing(ImageOutput(2))
Box(0, 0, 100, 100, RGB(255, 0, 255))
StopDrawing()
ImageGadget(1, 0, 0, 500, 500, ImageID(1))
ButtonImageGadget(2, 10, 10, 90, 90, ImageID(2))
SetWindowLong_(GadgetID(1), #GWL_STYLE, GetWindowLong_(GadgetID(1), #GWL_STYLE) | #WS_CLIPSIBLINGS)
SetWindowPos_(GadgetID(1), GadgetID(2), 0, 0, 0, 0, #SWP_NOSIZE | #SWP_NOMOVE)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
You can thank Sparkie for the API calls that made this work.

Posted: Thu Aug 02, 2007 4:33 pm
by bender-rulez
I can commit that the ImageGadget under Linux with GTK2 is always on top!
Before PB 4.xx it was not!
I got the problem with a selfmade grid (generated gridimage) for drag and drop buttongadgets on it!
Fact is:
PB 4.xx -> ImageGadget is always on top
PB 3.9x -> ImageGadget z-order is like the order in code....
Posted: Fri Feb 29, 2008 6:58 am
by Mistrel
You can use this function to force a gadget to be drawn on top.
http://www.purebasic.fr/english/viewtop ... ght=zdepth