Das Problem ist nur, das Menutitel teilweise die gleichen Rückgabewerte
haben wie menuitems, bzw denke ich, das ich diese nur falsch auswerte.
http://msdn2.microsoft.com/en-us/library/ms646352.aspx
Beispielcode:
Code: Alles auswählen
If OpenWindow(0, 0, 0, 200, 150, "Menu", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
If CreateMenu(0, WindowID(0))
MenuTitle("Title 1")
MenuItem(0, "Item 1")
MenuItem(1, "Item 2")
MenuItem(2, "Item 3")
MenuTitle("Title 2")
MenuItem(3, "Item 1")
MenuItem(4, "Item 2")
MenuItem(5, "Item 3")
EndIf
If CreateGadgetList(WindowID(0))
TextGadget(0, 10, 80, 180, 15, "...", #PB_Text_Center)
EndIf
EndIf
Procedure WindowCallback(hWnd, Msg, wParam, lParam)
Protected Result.l
Result = #PB_ProcessPureBasicEvents
If hWnd = WindowID(0)
If Msg = #WM_MENUSELECT
SetGadgetText(0, Str(wParam & $FF))
Result = 0
EndIf
EndIf
ProcedureReturn Result
EndProcedure
SetWindowCallback(@WindowCallback())
While WaitWindowEvent() <> #PB_Event_CloseWindow: Wend