PureBasic Forum
https://www.purebasic.fr/english/

[Done] BindGadgetEvent bug
https://www.purebasic.fr/english/viewtopic.php?f=24&t=71239
Page 1 of 1

Author:  wilbert [ Fri Aug 17, 2018 9:43 am ]
Post subject:  [Done] BindGadgetEvent bug

Code:
Procedure LostFocus()
  Debug "Active gadget [Lost focus, Bind] : "+Str(GetActiveGadget())
EndProcedure

If OpenWindow(0, 0, 0, 322, 205, "Lost focus", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
  StringGadget(0, 8,  10, 306, 20, "0")
  StringGadget(1, 8,  35, 306, 20, "1")
  StringGadget(2, 8,  60, 306, 20, "2")
 
  BindGadgetEvent(0, @LostFocus(), #PB_EventType_LostFocus)
  BindGadgetEvent(1, @LostFocus(), #PB_EventType_LostFocus)
  BindGadgetEvent(2, @LostFocus(), #PB_EventType_LostFocus)
 
  Repeat
    Event = WaitWindowEvent()
    If Event = #PB_Event_Gadget
      Select EventType()
        Case #PB_EventType_LostFocus
          Debug "Active gadget [Lost focus, Event] : "+Str(GetActiveGadget())
      EndSelect
    EndIf
  Until Event = #PB_Event_CloseWindow
EndIf

The value reported for GetActiveGadget() for the lost focus event isn't the same when using BindGadgetEvent compared to the normal event loop.
When using BindGadgetEvent it often reports the old gadget which has lost focus still as the active gadget.

Author:  Fred [ Fri Apr 12, 2019 4:35 pm ]
Post subject:  Re: BindGadgetEvent bug

Fixed.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/