Frame gadget + Panel gadget = error

Just starting out? Need help? Post your questions and find answers here.
rotacak
User
User
Posts: 77
Joined: Tue Feb 14, 2006 2:00 pm

Frame gadget + Panel gadget = error

Post 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
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 670
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Re: Frame gadget + Panel gadget = error

Post 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?
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
BarryG
Addict
Addict
Posts: 4128
Joined: Thu Apr 18, 2019 8:17 am

Re: Frame gadget + Panel gadget = error

Post 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
rotacak
User
User
Posts: 77
Joined: Tue Feb 14, 2006 2:00 pm

Re: Frame gadget + Panel gadget = error

Post 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.
BarryG
Addict
Addict
Posts: 4128
Joined: Thu Apr 18, 2019 8:17 am

Re: Frame gadget + Panel gadget = error

Post by BarryG »

Oops, you're right - that is indeed the purpose of a FrameGadget. My bad!
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Frame gadget + Panel gadget = error

Post by netmaestro »

Works fine here on 6.03 final.
BERESHEIT
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Frame gadget + Panel gadget = error

Post 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
Post Reply