Page 1 of 1
#PB_Event_FirstCustomValue and AddKeyboardShortcut
Posted: Wed Mar 09, 2022 11:01 am
by Maitre_Kanter
Hello everybody,
i have some custom values for events and there is a problem when I use AddKeyboardShortcut().
Code: Select all
Enumeration #PB_Event_FirstCustomValue
#evt_focusOnTab_0
#evt_focusOnTab_1
EndEnumeration
AddKeyboardShortcut(MyWindow, #VK_F1, #evt_focusOnTab_0)
The issue raised at runtime (in french): [ERREUR] AddKeyboardShortcut(): La valeur 'Event' de AddKeyboardShortcut() doit ĂȘtre comprise entre 0 et 64000.
My implementation is not correct ? or may be an issue ?
Re: [PB6bx] #PB_Event_FirstCustomValue and AddKeyboardShortcut
Posted: Wed Mar 09, 2022 11:21 am
by User_Russian
This is not a bug.
From the help
https://www.purebasic.com/documentation ... rtcut.html
Event The number which will be returned by the EventMenu() function. This value has a limited range, from 0 to 64000. By default, a window already has the #PB_Shortcut_Tab and #PB_Shortcut_Tab|#PB_Shortcut_Shift shortcuts to handle tab and shift-tab correctly through the gadgets. A shortcut can be removed with RemoveKeyboardShortcut().
Re: [PB6bx] #PB_Event_FirstCustomValue and AddKeyboardShortcut
Posted: Wed Mar 09, 2022 12:29 pm
by ChrisR
A shortcut generates a menu event (between 0 and 64000), not a custom event.
In your declaration, you have to dissociate the menu (shorcut) events enumeration from the custom events.
Code: Select all
Enumeration FormMenu
#Evt_focusOnTab_0
#Evt_focusOnTab_1
EndEnumeration
Enumeration EventCustom #PB_Event_FirstCustomValue
#Evt_My_Custom1
EndEnumeration
AddKeyboardShortcut(MyWindow, #VK_F1, #Evt_focusOnTab_0)
To avoid problems in the enumerations with modules, an organization like the one proposed by ts-soft looks good:
Enumeration #PB_Event_FirstCustomValue
[FIXED]: [PB6bx] #PB_Event_FirstCustomValue and AddKeyboardShortcut
Posted: Wed Mar 09, 2022 4:32 pm
by Maitre_Kanter
Thank you for your replies !