AddKeyboardShortcut

Just starting out? Need help? Post your questions and find answers here.
lavachri
User
User
Posts: 19
Joined: Tue Oct 14, 2008 3:01 pm
Location: French

AddKeyboardShortcut

Post by lavachri »

Hi,
why the shortcuts Alt+Prior and Alt+Next don't work ?

Code: Select all

If OpenWindow(0, 0, 0, 322, 205, "Test raccourcis Alt+Prior", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    StringGadget(0, 8,  10, 306, 20, "")
    SetActiveGadget( 0)
    AddKeyboardShortcut(0, #PB_Shortcut_Alt + #PB_Shortcut_Prior, 1 )
    AddKeyboardShortcut(0, #PB_Shortcut_Alt + #PB_Shortcut_Home, 2 )
    Repeat 
      EV = WaitWindowEvent()
      If ev = #PB_Event_Menu
        Select EventMenu()
        Case 1
          SetGadgetText( 0, "Prior" )
        Case 2
          SetGadgetText( 0, "Home")
        EndSelect
      EndIf
    Until EV = #PB_Event_CloseWindow
  EndIf
Thanks
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

Re: AddKeyboardShortcut

Post by jesperbrannmark »

Change

Code: Select all

AddKeyboardShortcut(0, #PB_Shortcut_Alt + #PB_Shortcut_Prior, 1 )
    AddKeyboardShortcut(0, #PB_Shortcut_Alt + #PB_Shortcut_Home, 2 )
To

Code: Select all

AddKeyboardShortcut(0, #PB_Shortcut_Alt | #PB_Shortcut_Prior, 1 )
    AddKeyboardShortcut(0, #PB_Shortcut_Alt | #PB_Shortcut_Home, 2 )
And it will hopefully work better
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: AddKeyboardShortcut

Post by MachineCode »

The original example works fine here with + instead of |.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
lavachri
User
User
Posts: 19
Joined: Tue Oct 14, 2008 3:01 pm
Location: French

Re: AddKeyboardShortcut

Post by lavachri »

Hi,
i know + and | are different operator but it's possible to add modifiers and one key.

Sorry, i have found the problem...
It's skype and this globals shortcuts...
mestnyi
Addict
Addict
Posts: 1098
Joined: Mon Nov 25, 2013 6:41 am

Re: AddKeyboardShortcut

Post by mestnyi »

Code: Select all

#PB_Shortcut_Alt

How to distinguish clamped right or left?
Post Reply