Dialog onevent binding doesn't work for ContainerGadget

Post bugreports for the Windows version here
Andesdaf
User
User
Posts: 86
Joined: Sun Mar 22, 2009 2:53 pm
Location: GER, Saxony

Dialog onevent binding doesn't work for ContainerGadget

Post by Andesdaf »

Code: Select all

  #Dialog = 0
  #Xml = 0
  
  Runtime Procedure containerEvent()
    Debug "abcd"
  EndProcedure
  
  Runtime Procedure remoteEvent()
    PostEvent(#PB_Event_Gadget, 0, DialogGadget(#Dialog, "cont1"))
  EndProcedure
  
  XML$ = "<window id='0' name='test' text='test' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
         "      <vbox expand='item:1'>" +
         "          <container name='cont1' onevent='containerEvent()'/>" +
         "          <button text='remote' onevent='remoteEvent()'/>" +
         "      </vbox>" +
         "</window>"
           
  If ParseXML(#Xml, XML$) And XMLStatus(#Xml) = #PB_XML_Success
    If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
;      BindGadgetEvent(DialogGadget(#Dialog, "cont1"), @containerEvent())
      Repeat
        Event = WaitWindowEvent()
      Until Event = #PB_Event_CloseWindow
    EndIf
  EndIf
Tested with PB 6.21 and 6.30B2: the event callback provided through the dialog lib doesn't get connected to the container gadget, so nothing happens if you click the button and PostEvent is called. If you uncomment the line that does the binding manually, everything works as expected.