Code: Select all
#Main = 0
#MDIChild = 1
#KEY_Return = 1
If OpenWindow(#Main, 0, 0, 400, 300, "MDIGadget", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
If CreateGadgetList(WindowID(#Main)) And CreateMenu(#Main, WindowID(#Main))
MenuTitle("Menu index 0")
MenuTitle("MDI windows menu")
MenuItem(0, "self created item")
MenuItem(1, "self created item")
MDIGadget(0, 0, 0, 0, 0, 1, 2, #PB_MDI_AutoSize)
idWND = AddGadgetItem(0, #PB_Any, "child window")
AddKeyboardShortcut(idWND,#PB_Shortcut_Return,#KEY_Return)
EndIf
Repeat
Event.l = WaitWindowEvent()
Window = EventWindow()
Gadget = EventGadget()
Menu = EventMenu()
If Window=idWND And Event.l=#PB_Event_Menu And Menu = #KEY_Return
Debug "Event!"
EndIf
Until Event.l=#PB_Event_CloseWindow
EndIf