Page 1 of 1
Frame gadget + Panel gadget = error
Posted: Fri Sep 01, 2023 8:00 pm
by rotacak
Hi,
in "PureBasic 6.02 LTS (Windows - x64)" is weird error with the gadgets. Code below will successfully create frame gadget and inside panel gadget. Ok. But if you will uncomment second frame gadget then panel gadget will not be rendered at all.
Code: Select all
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
;FrameGadget(#PB_Any, 0, 0, 200, 100, "1111111111")
FrameGadget(#PB_Any, 0, 120, 200, 100, "222222222222")
PanelGadget(5, 10, 130, 180, 80)
AddGadgetItem(5, -1, "aaaaaaaaaaa")
CloseGadgetList()
EndProcedure
OpenWindow_0()
Repeat
WaitWindowEvent()
Until 1=2
Re: Frame gadget + Panel gadget = error
Posted: Fri Sep 01, 2023 8:25 pm
by Kurzer
The panel gadget is drawn, but it is completely covered by the frame gadget. This also occurs under PB 6.02.
The frame gadget draws a complete rectangle including the background.
Try to place the second frame gadget at X position 100 instead of X position 0, then you will see it.
If you first create the panel gadget and then the second frame gadget (after the CloseGadgetList), then it works.
Maybe PB is trying to "optimize" the drawing order and then this problem arises?
Re: Frame gadget + Panel gadget = error
Posted: Sat Sep 02, 2023 2:37 am
by BarryG
PureBasic doesn't officially support overlapping gadgets, so this is not a bug.
Having said that, here's a workaround for Windows:
Code: Select all
Procedure OpenWindow_0(x = 200, y = 200, width = 600, height = 400)
OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
FrameGadget(#PB_Any, 0, 0, 200, 100, "1111111111")
FrameGadget(#PB_Any, 0, 120, 200, 100, "222222222222")
PanelGadget(5, 10, 130, 180, 80)
AddGadgetItem(5, -1, "aaaaaaaaaaa")
CloseGadgetList()
BringWindowToTop_(GadgetID(5))
EndProcedure
OpenWindow_0()
Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow
Re: Frame gadget + Panel gadget = error
Posted: Sat Sep 02, 2023 9:23 am
by rotacak
Kurzer wrote: Fri Sep 01, 2023 8:25 pm
The panel gadget is drawn, but it is completely covered by the frame gadget. This also occurs under PB 6.02.
The frame gadget draws a complete rectangle including the background.
Yes, I mean "is not rendered" = "is not visible".
Kurzer wrote: Fri Sep 01, 2023 8:25 pm
If you first create the panel gadget and then the second frame gadget (after the CloseGadgetList), then it works.
It works

Thanks.
BarryG wrote: Sat Sep 02, 2023 2:37 am
PureBasic doesn't officially support overlapping gadgets, so this is not a bug.
I think it is a bug because overlapping the frame gadget is his purpose. Also it works until second frame is used and everything was ok in PB 5. Anyway thanks for your solution too.
Re: Frame gadget + Panel gadget = error
Posted: Sat Sep 02, 2023 10:30 am
by BarryG
Oops, you're right - that is indeed the purpose of a FrameGadget. My bad!
Re: Frame gadget + Panel gadget = error
Posted: Tue Oct 24, 2023 2:33 am
by netmaestro
Works fine here on 6.03 final.
Re: Frame gadget + Panel gadget = error
Posted: Fri Dec 20, 2024 5:49 pm
by Fred
The new #PB_Frame_Container flag needs to be specificied to avoid such issues.
Code: Select all
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
FrameGadget(#PB_Any, 0, 0, 200, 100, "1111111111")
FrameGadget(#PB_Any, 0, 120, 200, 100, "222222222222", #PB_Frame_Container)
PanelGadget(5, 10, 10, 180, 80)
AddGadgetItem(5, -1, "aaaaaaaaaaa")
CloseGadgetList()
CloseGadgetList()
EndProcedure
OpenWindow_0()
Repeat
WaitWindowEvent()
Until 1=2