Page 1 of 1

No keydown event for tab on a canvas

Posted: Sun Sep 24, 2023 3:32 pm
by ❤x1
Hello,

On Windows 11 with PB 6.03b9, there is no KeyDown event for tab key on a canvas gadget, but there is one for KeyUp.

Code: Select all

Procedure CanvasCallback_KeyUp()
	Debug "KeyUp: " +  GetGadgetAttribute(0, #PB_Canvas_Key)
EndProcedure

Procedure CanvasCallback_KeyDown()
	Debug "KeyDown: " + GetGadgetAttribute(0, #PB_Canvas_Key)
EndProcedure

OpenWindow(0, 0, 0, 200, 200, "Canvas key event", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

CanvasGadget(0, 10, 10, 180, 180, #PB_Canvas_Keyboard)
BindGadgetEvent(0, @CanvasCallback_KeyDown(), #PB_EventType_KeyDown)
BindGadgetEvent(0, @CanvasCallback_KeyUp(), #PB_EventType_KeyUp)
SetActiveGadget(0)

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Re: No keydown event for tab on a canvas

Posted: Sun Sep 24, 2023 3:42 pm
by STARGÅTE
To my understanding, there can't be a KeyDown event for the TAB key, because in the moment you press the TAB down, you switch the gadget and the CanvasGadget loses the focus. On the other hand you receive a KeyUp event, because you have only one gadget and the CanvasGadget is focused again.

Re: No keydown event for tab on a canvas

Posted: Sun Sep 24, 2023 3:53 pm
by ❤x1
Oh. Ok then, it's probably not a bug.

Re: No keydown event for tab on a canvas

Posted: Mon Sep 25, 2023 12:41 pm
by Mr.L
To me it is a bug...
It has worked in the previous purebasic version, if you removed the Keyboardshortcut for the tab key after the window has been opened (which makes sense to me).
What has changed in the latest update?

If it's not a bug, there should definitely be an option to detect this key