Page 1 of 1

canvas lost focus

Posted: Thu Oct 02, 2025 8:48 am
by mestnyi
in mac os is this bug?

Code: Select all

Procedure lostfocus( )
  Debug "lostfocus"
  SetActiveGadget( - 1 )
EndProcedure

OpenWindow(1, 0, 0, 320, 400, "bug", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(1, 10, 10, 300, 300, #PB_Canvas_DrawFocus )
BindGadgetEvent(1, @lostfocus( ), #PB_EventType_LostFocus)

SetActiveGadget(1)
SetActiveGadget( - 1 )

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow

Re: canvas lost focus

Posted: Thu Oct 02, 2025 11:46 am
by infratec
Don't you need

Code: Select all

#PB_Canvas_Keyboard
for keyboard stuff?

Re: canvas lost focus

Posted: Thu Oct 02, 2025 12:07 pm
by BarryG
What if he's changing the focus to another gadget by clicking with the mouse?

Re: canvas lost focus

Posted: Tue Oct 14, 2025 5:42 am
by mestnyi
infratec wrote: Thu Oct 02, 2025 11:46 am Don't you need

Code: Select all

#PB_Canvas_Keyboard
for keyboard stuff?
Maybe it should, but that's not the point.
The point is that in Mac OS, an infinite loop starts, whereas in Windows, there is no such thing.

Re: canvas lost focus

Posted: Tue Oct 14, 2025 5:44 am
by mestnyi
BarryG wrote: Thu Oct 02, 2025 12:07 pm What if he's changing the focus to another gadget by clicking with the mouse?
My problem is visible immediately after compiling the code.

Re: canvas lost focus

Posted: Tue Oct 14, 2025 1:17 pm
by Piero
seems like SetActiveGadget( -1 ) ALWAYS triggers lost focus

Code: Select all

Procedure lostfocus( )
  Debug "lostfocus"
  ;SetActiveGadget( -1 )
EndProcedure