4.31 ContainerGadget trouble adding OptionGadgets

Linux specific forum
Marlin
Enthusiast
Enthusiast
Posts: 406
Joined: Sun Sep 17, 2006 1:24 pm
Location: Germany

4.31 ContainerGadget trouble adding OptionGadgets

Post by Marlin »

Code: Select all

If OpenWindow(0, 0, 0, 320, 350, "ContainerGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ContainerGadget(0, 5, 5, 310, 150, #PB_Container_BorderLess)
    OptionGadget(0, 10, 20, 100, 20, "Option 1")
    OptionGadget(1, 10, 45, 100, 20, "Option 2")
    OptionGadget(2, 10, 70, 100, 20, "Option 3")
  CloseGadgetList()
  ContainerGadget(1, 5, 160, 310, 150, #PB_Container_BorderLess)
    OptionGadget(3, 10, 20, 100, 20, "Option A")
    OptionGadget(4, 10, 45, 100, 20, "Option B")
    OptionGadget(5, 10, 70, 100, 20, "Option C")
  CloseGadgetList()
  
  Repeat
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
With the above code I get quite a lot of gtk related compiler warnings
and the first 3 "OptionGadget" lines get yellow excamation marks.

When the window appears only the 3 OptionGadgets, that did not get the warnings (A,B,C) are visible.

I would post the compiler output here, but I don't know how to copy it yet.

This problem only seems to affect the first ContainerGadget;
when I tried to add a third ContainerGadget, it seemed all right
just like the second one.
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Your first OptionGadget has the same ID (0) as the ContainerGadget where you try to create it in. So the ContainerGadget gets destroyed while the OptionGadget is created. This is where the problems come from.
quidquid Latine dictum sit altum videtur
Marlin
Enthusiast
Enthusiast
Posts: 406
Joined: Sun Sep 17, 2006 1:24 pm
Location: Germany

Post by Marlin »

:oops:

Your right.

Thank you.
Post Reply