Also there is a bug with Menue-Shortcuts. The definitions are outside the InitWindow procedure -> Compiler Error: "[ERROR] ... #Windows is not initialized.".
As a minor issue for german users: the Control-Key (CTRL) is named STRG on german keyboards. Localized Programs use "STRG+[Key]" (see "MenuItem(#MenuItem_5,"Quit" + Chr(9) + "Strg+Q")"). This results in a wrong PB-Constant (#PB_Shortcut_Strg). It would be nice to have the correct (#PB_Shortcut_Control) Constant ...
Code: Select all
Global Window_0
Global Button_0
Enumeration #PB_Compiler_EnumerationValue
#MenuItem_2
#MenuItem_3
#MenuItem_4
#MenuItem_5
EndEnumeration
AddKeyboardShortcut(Window_0, #PB_Shortcut_Control | #PB_Shortcut_O, #MenuItem_2)
AddKeyboardShortcut(Window_0, #PB_Shortcut_Control | #PB_Shortcut_W, #MenuItem_3)
AddKeyboardShortcut(Window_0, #PB_Shortcut_Strg | #PB_Shortcut_Q, #MenuItem_5)
Procedure InitWindow_0()
Window_0 = OpenWindow(#PB_Any, 0, 0, 250, 300, "", #PB_Window_SystemMenu)
CreateMenu(0, WindowID(Window_0))
MenuTitle("File")
MenuItem(#MenuItem_2,"Open ..." + Chr(9) + "Ctrl+O")
MenuItem(#MenuItem_3,"Close" + Chr(9) + "Ctrl+W")
MenuBar()
MenuItem(#MenuItem_5,"Quit" + Chr(9) + "Strg+Q")
Button_0 = ButtonGadget(#PB_Any, 65, 240, 100, 25, "OK")
EndProcedure
Procedure Window_0_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
Case #MenuItem_2
Case #MenuItem_3
Case #MenuItem_4
Case #MenuItem_5
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure