Contextual Menuitem.checked = true / false

How can I update the checked state of a menu item after it was selected?

base.Append(New MenuItem(“Import”))
base.Append(New MenuItem(“Export”))
base.Append(New MenuItem(MenuItem.TextSeparator))

base.Append(New MenuItem(“Cut”))
base.Append(New MenuItem(“Copy”))
base.Append(New MenuItem(“Paste”))
Return True // display the contextual menu

Select Case hitItem.Text
Case “Import”
MsgBox(“You chose Import”)
if hitItem.Checked = false then
hitItem.Checked = true
hitItem.Checked = false
end if

Case “Export”
MsgBox(“You chose export”)
Case “Cut”
MsgBox(“You chose Cut”)
Case “Copy”
MsgBox(“You chose Copy”)
Case “Paste”
MsgBox(“You chose Paste”)
End Select

Return True

you need to check the menu item when you construct the menu

dim m as menuitem
m=New MenuItem("Import")
base,append m
m=New New MenuItem("Export")
base,append m
m=New New MenuItem(MenuItem.TextSeparator)
base,append m

m=New New MenuItem("Cut")
base,append m
m=New New MenuItem("Copy")
base,append m
m=New (New MenuItem("Paste")
base,append m
Return True // display the contextual menu
Select Case hitItem.Text
Case "Import"
MsgBox("You chose Import")

Case "Export"
MsgBox("You chose export")
Case "Cut"
MsgBox("You chose Cut")
Case "Copy"
MsgBox("You chose Copy")
Case "Paste"
MsgBox("You chose Paste")
End Select

Return True

Many thanks. Very good solution. I could not find it in the Language Reference.

perhaps because the LangRef is just that a reference… no document of any kind is going to lay out all the possible solutions to every potential situation… That is why some of are software developers… we take a situation and devise a solution… but even then… take 10 developers and you might get 15 solutions… all of which may work, and some are better and/or worse than others