Form Designer(Form tab) Question about shortcut

You need some new stunning features ? Tell us here.
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Form Designer(Form tab) Question about shortcut

Post 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
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Form Designer(Form tab) Question about shortcut

Post by Caronte3D »

Maybe writing the constant shortcut directly?
https://www.purebasic.com/documentation ... rtcut.html
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: Form Designer(Form tab) Question about shortcut

Post by Distorted Pixel »

Caronte3D wrote: Thu Oct 06, 2022 9:48 am Maybe writing the constant shortcut directly?
https://www.purebasic.com/documentation ... rtcut.html
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
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Form Designer(Form tab) Question about shortcut

Post 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
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: Form Designer(Form tab) Question about shortcut

Post 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
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
mk-soft
Always Here
Always Here
Posts: 5334
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Form Designer(Form tab) Question about shortcut

Post 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

My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: Form Designer(Form tab) Question about shortcut

Post 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
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Form Designer(Form tab) Question about shortcut

Post 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
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: Form Designer(Form tab) Question about shortcut

Post 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?
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
User avatar
mk-soft
Always Here
Always Here
Posts: 5334
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Form Designer(Form tab) Question about shortcut

Post by mk-soft »

No, ...

Only for Shortcut "Ctrl+S" or "Alt+S"
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Distorted Pixel
Enthusiast
Enthusiast
Posts: 233
Joined: Sun Aug 29, 2021 4:34 am

Re: Form Designer(Form tab) Question about shortcut

Post 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
To be popular is way to much work. I just want to be me, myself and I. Oh no, does that mean I'm bipolar? :shock:

No one cares how much you know until they know how much you care
Post Reply