Page 1 of 1

5.40LTS - LostFocus event not always triggered

Posted: Wed Dec 02, 2015 11:14 am
by Niffo
In the following snippet and on MacOS Only, the lostfocus event is never triggered when clicking on the button (who does not seems to get focus), unless you manually set the focus to it (see commented line) :

Code: Select all

OpenWindow(0, 100, 100, 300, 200, "StringGadget LostFocus test")
StringGadget(0, 10, 10, 50, 20, "String")
ButtonGadget(1, 10, 50, 50, 20, "Button")
SetActiveGadget(0)

Repeat
   Select WaitWindowEvent()
      Case #PB_Event_Gadget
         Select EventGadget()
            Case 0 ; StringGadget
               Select EventType()
                  Case #PB_EventType_LostFocus
                     Debug "#PB_EventType_LostFocus"
               EndSelect
            Case 1 ;ButtonGadget
               ;SetActiveGadget(1)
         EndSelect
      Case #PB_Event_CloseWindow
         Break
   EndSelect
ForEver

Re: 5.40LTS - LostFocus event not always triggered

Posted: Thu Dec 03, 2015 9:57 am
by hoerbie

Re: 5.40LTS - LostFocus event not always triggered

Posted: Mon Dec 07, 2015 8:31 am
by Fred
I think it's on OS X thing: the focus doesn't get transferred to buttons when pressing on them. I tested other OS X apps, and it always behave like this, so you will probably have to adapt your program to handle this special case (BTW, the focus is still on the stringgadget(), so it's not really a bug)