Command key shortcut constant

Mac OSX specific forum
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Command key shortcut constant

Post by Kale »

I use this in an app im porting to Mac OS X:

Code: Select all

AddKeyboardShortcut(#WINDOW_ROOT, #PB_Shortcut_Control | #PB_Shortcut_Q, #MENU_QUIT)
How can i use the apple command key for a shortcut?

#PB_Shortcut_MacOSCommand maybe?

Also how did you get those command key charaters to show in the menus of the IDE for MacOS. I cant find a character that looks like that?
--Kale

Image
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

You can use the #PB_Shortcut_Command constant (on Windows/Linux it will be like #PB_Shortcut_Control)
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

#PB_Shortcut_Command is not defined on Windows version. Kind of make cross platform development unfriendly. :wink:
Also how did Freak get those command key charaters to show in the menus of the IDE for MacOS. I cant find a character that looks like that?
:?:
--Kale

Image
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

About the windows one, i'm adding it :)

About the character, you will have to add "CMD" in your menu text field: MenuItem(0,"Test"+Chr(9)+"CMD+O")
m0
New User
New User
Posts: 8
Joined: Thu Nov 22, 2007 3:38 pm
Location: DE

Post by m0 »

Hi!
This AddKeyboardShortcut is a bit buggy with mac, hm? you have to push the keys way longer than usual, otherwise the program ignores the event.
Did i something wron, or why is it like that?

Code: Select all

window=OpenWindow(0,0,0,700,400,"Chart Plot",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
AddKeyboardShortcut(0,#PB_Shortcut_Command|#PB_Shortcut_Q, 15)

Repeat

  Select  WaitWindowEvent()
     Case #PB_Event_CloseWindow
      quit = #True
     Case #PB_Event_Menu
       If EventMenu() = 15
           quit=#True
       EndIf
     Case #PB_Event_Gadget
   EndSelect 


 
Until quit

CloseWindow(0)
End
Post Reply