I have TPopup menu with 3 items setup with the following properties.
AutoCheck = True
RadioItem = True
and for the first menu item I set the Checked property to True as well so the menu has at least 1 item selected with it is initially displayed. This is all good and well, but if I click on the item that is currently selected, the check (dot) goes away and I want to make it so that at least 1 item in the popup is selected at all times. How do I go about doing that?
The items in the group should also have the same non-zero
GroupIndex. This, together withRadioItemshould make the items behave like a radio group.However, it seems that
AutoCheckdoesn’t respectGroupIndexandRadioItemproperties, since it will clear the check when you click on a currently checked item.(Arguably, this could be considered a bug in the VCL.)
Here’s a workaround:
Set
AutoChecktoFalse, assign all items the same non-zeroGroupIndexand a commonOnClickhandler to check the clicked item like this:Or use Actions, with them this seems to work as expected.