Page 1 of 1
Form Designer(Form tab) Question about shortcut
Posted: Thu Oct 06, 2022 1:56 am
by Distorted Pixel
Hi,
Under the "Form" tab in the Form Designer where it says shortcut on the right side, how do I uses it or what do I put there to make it work? Or is it not working? I have what I'm talking about in a image and the area I'm talking about is circled in red color
I'm wanting to add shortcut key combo to the current menu item showing and I thought that is where to put it and what to put if it works.
https://mega.nz/file/40NhlaIY#kasqNSAfj ... WfdL1wORPg
Re: Form Designer(Form tab) Question about shortcut
Posted: Thu Oct 06, 2022 9:48 am
by Caronte3D
Re: Form Designer(Form tab) Question about shortcut
Posted: Thu Oct 06, 2022 10:37 am
by Distorted Pixel
That's what I thought, but what ever I type there shows in the menu in the design area. I haven't tried to run the code with it like that yet to see what shows up. I'll do that after work today. I just thought that since what ever I type there is showing up in the editor area that it wasn't what I'm supposed to put there. I thought I read some where that the shortcut thing in the form designer wasn't working, but I could be wrong.
Anyway, I'll try it after work today and post back
Re: Form Designer(Form tab) Question about shortcut
Posted: Thu Oct 06, 2022 11:21 am
by Caronte3D
I think you must omit the: "#PB_Shortcut_" and write only the key.
Anyway, I ever write my shorcuts by hand, I don't like the way form creator does
Re: Form Designer(Form tab) Question about shortcut
Posted: Thu Oct 06, 2022 1:28 pm
by Distorted Pixel
I'll try that.
I can always manually code it so it puts the shortcut stuff next to the option in the drop down menu. Then I know the shortcut will work and it will show up in the menu to tell user what shortcut to use
Re: Form Designer(Form tab) Question about shortcut
Posted: Thu Oct 06, 2022 5:08 pm
by mk-soft
Update ...
Write for "Ctrl+L" for "#PB_Shortcut_Control | #PB_Shortcut_L"
Write for "Ctrl+S" for "#PB_Shortcut_Control | #PB_Shortcut_S"
Code: Select all
;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;
Enumeration FormWindow
#Window_0
EndEnumeration
Enumeration FormMenu
#MenuItem_Load
#MenuItem_Save
EndEnumeration
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
OpenWindow(#Window_0, x, y, width, height, "", #PB_Window_SystemMenu)
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Control | #PB_Shortcut_L, #MenuItem_Load)
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Control | #PB_Shortcut_S, #MenuItem_Save)
CreateMenu(0, WindowID(#Window_0))
MenuTitle("File")
MenuItem(#MenuItem_Load, "Load" + Chr(9) + "Ctrl+L")
MenuItem(#MenuItem_Save, "Save" + Chr(9) + "Ctrl+S")
EndProcedure
Re: Form Designer(Form tab) Question about shortcut
Posted: Fri Oct 07, 2022 3:18 am
by Distorted Pixel
mk-soft wrote: Thu Oct 06, 2022 5:08 pm
Update ...
Write for "Ctrl+L" for "#PB_Shortcut_Control | #PB_Shortcut_L"
Write for "Ctrl+S" for "#PB_Shortcut_Control | #PB_Shortcut_S"
Code: Select all
;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;
Enumeration FormWindow
#Window_0
EndEnumeration
Enumeration FormMenu
#MenuItem_Load
#MenuItem_Save
EndEnumeration
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
OpenWindow(#Window_0, x, y, width, height, "", #PB_Window_SystemMenu)
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Control | #PB_Shortcut_L, #MenuItem_Load)
AddKeyboardShortcut(#Window_0, #PB_Shortcut_Control | #PB_Shortcut_S, #MenuItem_Save)
CreateMenu(0, WindowID(#Window_0))
MenuTitle("File")
MenuItem(#MenuItem_Load, "Load" + Chr(9) + "Ctrl+L")
MenuItem(#MenuItem_Save, "Save" + Chr(9) + "Ctrl+S")
EndProcedure
I know the shortcuts, but if I type them in the form designer to the right by shortcut, it just shows what I type. It looks like I'll have to manually code it in
Re: Form Designer(Form tab) Question about shortcut
Posted: Fri Oct 07, 2022 9:28 am
by Caronte3D
The form designer shortcut field works like mk-soft said.
Thi's an example (.pb) of the form output. I added the event loop and some messagerequesters to show the function:
Code: Select all
;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;
Global Window_0
Enumeration FormMenu
#MenuItem_2
#MenuItem_3
EndEnumeration
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
AddKeyboardShortcut(Window_0, #PB_Shortcut_Control | #PB_Shortcut_K, #MenuItem_2)
AddKeyboardShortcut(Window_0, #PB_Shortcut_Control | #PB_Shortcut_J, #MenuItem_3)
CreateMenu(0, WindowID(Window_0))
MenuTitle("MenuTitle")
MenuItem(#MenuItem_2, "MenuItem2" + Chr(9) + "Ctrl+k")
MenuItem(#MenuItem_3, "MenuItem3" + Chr(9) + "Ctrl+J")
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
Case #MenuItem_2
MessageRequester("Menu","Item 2")
Case #MenuItem_3
MessageRequester("Menu","Item 3")
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
OpenWindow_0()
Repeat
Define evento=WaitWindowEvent()
Window_0_Events(evento)
Until evento = #PB_Event_CloseWindow
Re: Form Designer(Form tab) Question about shortcut
Posted: Fri Oct 07, 2022 4:49 pm
by Distorted Pixel
Caronte3D wrote: Fri Oct 07, 2022 9:28 am
The form designer shortcut field works like mk-soft said.
Thi's an example (.pb) of the form output. I added the event loop and some messagerequesters to show the function:
Code: Select all
;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;
Global Window_0
Enumeration FormMenu
#MenuItem_2
#MenuItem_3
EndEnumeration
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
AddKeyboardShortcut(Window_0, #PB_Shortcut_Control | #PB_Shortcut_K, #MenuItem_2)
AddKeyboardShortcut(Window_0, #PB_Shortcut_Control | #PB_Shortcut_J, #MenuItem_3)
CreateMenu(0, WindowID(Window_0))
MenuTitle("MenuTitle")
MenuItem(#MenuItem_2, "MenuItem2" + Chr(9) + "Ctrl+k")
MenuItem(#MenuItem_3, "MenuItem3" + Chr(9) + "Ctrl+J")
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
Case #MenuItem_2
MessageRequester("Menu","Item 2")
Case #MenuItem_3
MessageRequester("Menu","Item 3")
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
OpenWindow_0()
Repeat
Define evento=WaitWindowEvent()
Window_0_Events(evento)
Until evento = #PB_Event_CloseWindow
If the shortcut works then I must have not done something right. Do you have to put the whole AddKeyboardShortcut() command in the box to the right?
Re: Form Designer(Form tab) Question about shortcut
Posted: Sat Oct 08, 2022 1:57 am
by mk-soft
No, ...
Only for Shortcut "Ctrl+S" or "Alt+S"
Re: Form Designer(Form tab) Question about shortcut
Posted: Sat Oct 08, 2022 3:22 am
by Distorted Pixel
mk-soft wrote: Sat Oct 08, 2022 1:57 am
No, ...
Only for Shortcut "Ctrl+S" or "Alt+S"
Ok, I'll try things after work tomorrow and post back