Perhaps it is of interest to some of you.
Code: Select all
; -- HOW TO USE IT --
; CheckMenuRadioItem_(hSubMenu, itemFirst, itemLast, itemCheck, flags)
; hSubMenu = the unique ID of the menutitle - use GetSubMenu_(hMenu, nPos) to get it. Notice that nPos is 0-indexed.
; itemFirst = 0-indexed position of the first item in the option range.
; itemLast = 0-indexed position of the last item in the option range.
; itemCheck = 0-indexed position of the item which will have an option check mark.
; flags = #MF_BYPOSITION if you want to use item positions as above.
; -------------------
OpenWindow(0, 100, 150, 250, 150, "Option Check Mark Test")
If CreateMenu(0, WindowID(0))
MenuTitle("MenuTitle")
MenuItem(1, "First")
MenuItem(2, "Second")
MenuItem(3, "Third")
MenuItem(4, "Fourth")
MenuTitle("Another title")
MenuItem(5, "First")
MenuItem(6, "Second")
MenuItem(7, "Third")
MenuItem(8, "Fourth")
MenuItem(9, "Fifth")
MenuItem(10, "Sixth")
EndIf
; Sets some option check marks
CheckMenuRadioItem_(GetSubMenu_(MenuID(0), 0), 0, 3, 1, #MF_BYPOSITION)
CheckMenuRadioItem_(GetSubMenu_(MenuID(0), 1), 0, 2, 2, #MF_BYPOSITION)
CheckMenuRadioItem_(GetSubMenu_(MenuID(0), 1), 3, 5, 5, #MF_BYPOSITION)
; Sets a standard check mark to make a comparison with the option check marks when using GetMenuItemState()
SetMenuItemState(0, 5, 1)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Menu
; The option check mark acts like the standard check mark when using GetMenuItemState()
MessageRequester("", "The checked state of the selected item:" + Chr(13) + Str(GetMenuItemState(0, EventMenu())))
EndIf
Until Event = #PB_Event_CloseWindow
End