[Win] MDI Childs and KeyboardShortcuts

Post bugreports for the Windows version here
Tranquil
Addict
Addict
Posts: 949
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

[Win] MDI Childs and KeyboardShortcuts

Post by Tranquil »

The Code below does not fire an event if the hotkey, which is assigned to the MDI's childs window, to the mainloop. GadgetToolBar Events on EventMenu() works indeed fine.

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 
Tranquil