Add CheckMark to menuitem in API2

I thought this should be well documented, but I can’t find any examples regarding the use of the HasCheckMark in any of the API-2 docs. Just this rather obvious entry:

HasCheckmark As Boolean

Indicates whether or not the menu item is checked.

Anyone have anything more useful?

HasCheckmark refers to whether or not the MenuItem is going to show a checkmark next to it:
Screen Shot 2022-04-10 at 13.09.27

It’s a simple boolean true/false property and you can use it however you like.

Is there something specific you’re not sure about?

Yes - how does it work with DesktopMenuItem? I thought I had it sorted, but this is a new design for me in a new app.

In other words, I have my mbMain menubar
I have 4 items in the mbHelp menu
I want to check/uncheck item 3 in that menu at runtime

:face_with_diagonal_mouth:

It works just the same as it had for MenuItems.

TheTargetDesktopMenuItem.HasCheckmark = true

This will add a checkmark as seen next to “Break On Exceptions” in the screenshot.

Inversely, to remove the checkmark:

TheTargetDesktopMenuItem.HasCheckmark = false

In the screenshot, the “Profile Code” menu item is not selected.

Hmmm, that’s where I went initially, but autocomplete wasn’t recognizing my menuitem. Maybe I’m right and autocomplete is broken (again …)?

Ah, yes, that could be it. Sometimes things don’t show up in autocomplete even though they’re correct. Analyze Project or attempting to Run will let you know for sure.

That was it. Autocomplete trying to wreck my Sunday :face_with_spiral_eyes:

Autocomplete is certainly broken if you have code with brackets with spaces inside. The following code would not complete methods of this array of instances of a class:

MyClass( nInstance ).Somethin<tab will NOT auto complete>

MyClass(nInstance).Somethin<tab will auto complete here>

The spaces make a difference.

No spaces - simply

miHelp … TAB Fails
miHelpDenugEnabled.HasCheckMark = True/False - compiles fine.

I moderately trust autocomplete.

Whenever something does not seem right, my first reflex is to look into the LR.

Typo ?

Debug?

Yep.