I have a dialog box in which a TComboBox.ItemIndex must change. Setting this in code, however, triggers an OnChange event which is not supposed to happen. The OnChange event when triggered by the user makes other changes that I don't want to happen when I'm setting it in code.
I tried this:
procedure TVComboBoxHelper.SetInt(const i: integer);
var
handler: TNotifyEvent;
begin
handler := OnChange;
OnChange := nil;
ItemIndex := i;
OnChange := handler;
end;
end;
but the event still fires. I'm on Carbon (see below). This seems to be a bug. Does anyone have and experience with this, maybe a workaround?
By the way, if I don't revert OnChange from nil, the change event is not called, but of course then the ComboBox doesn't respond to the user.
Cheers,
VTwin