GetActiveGadget and canvas container

Mac OSX specific forum
wombats
Enthusiast
Enthusiast
Posts: 663
Joined: Thu Dec 29, 2011 5:03 pm

GetActiveGadget and canvas container

Post by wombats »

I'm experiencing a weird issue with GetActiveGadget and canvas containers. When editing #String2, the StringGadget in the canvas container, it won't always be detected as the active gadget. I'm hesitant to report this as a bug because I'm not sure exactly where the bug might lie.

Code: Select all

Enumeration
  #ReturnEvent
  #String1
  #String2
  #Container1
  #Container2
EndEnumeration

If OpenWindow(0, 0, 0, 322, 205, "StringGadget Flags", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  AddKeyboardShortcut(0, #PB_Shortcut_Return, #ReturnEvent)
  ContainerGadget(#Container1, 0, 10, 306, 20)
  StringGadget(#String1, 0, 0, 306, 20, "Normal StringGadget...")
  CloseGadgetList()
  CanvasGadget(#Container2, 8, 35, 306, 20, #PB_Canvas_Container)
  StringGadget(#String2, 0, 0, 306, 20, "1234567")
  CloseGadgetList()
  SetGadgetColor(#String2, #PB_Gadget_FrontColor, RGB(0, 0, 255))
  Repeat
    
    event = WaitWindowEvent()
    
    Select event
        
      Case #PB_Event_Menu
        
        If EventMenu() = #ReturnEvent
          
          Select GetActiveGadget()
            Case #String1 : Debug "String1"
            Case #String2 : Debug "String2"
          EndSelect
          
        EndIf
        
    EndSelect
    
  Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf