FNCRadioGroup question

Delphi 11.2
FMX App for Windows and Android

Using a FNCRadioGroup with 6 items listed. By default, the Itemindex is set to 0. What I need to do is each time another item is selected a Yes/No question is asked whether the user really intended to make that selection and if Yes then proceed normally otherwise I need to set the itemindex back to the index before the item was selected. Am doing this via the OnRadioButtonClick event but if I reset itemindex back to preselection the selected item still remains as selected.

For example, default itemindex is 0. If user selects item where itemindex equals 4 and then answers No to question then I need to remain on itemindex = 0. My code in the event is which asks the question is:

TDialogService.PreferredMode := TDialogService.TPreferredMode.Platform;
TDialogService.MessageDialog('Are you sure you want to change your fill option to - ' +
sOption + '?...',
procedure(const AResult: TModalResult)
case AResult of
mrYes : begin
iCountFillOption := aItemIndex;
mrNo : AItemIndex := iCountFillOption;
end; //case

sOption is the item name selected and iCountFillOption is set to the currently selected itemindex.

Any help would be appreciated


Setting AItemIndex will not reset the itemindex. It's not a var parameter. You need to reset the actual ItemIndex:

mrNo : TMSFNCRadioGroup1.ItemIndex := iCountFillOption;

I had tried that before but did not work. But have now found if I follow that line with


it now works.