Главная страница | назад





Article #28277: ItemIndex property of TStaticActionList and TVirtualActionList does not represent which item is selected.

Question:

Why is the ItemIndex property of TStaticActionList and TVirtualActionList not indicating which item is selected?

Answer:

This is the designed behavior. In the help for TCustomListAction.OnItemSelected it states "Before this event is called, the list action first updates the ItemIndex property of any client controls that descend from TCustomListControl."

And in the help for TCustomListAction.ItemIndex "Note: List actions do not supply ItemIndex to all clients. The ItemIndex property controls only the ItemIndex property of clients that descend from TCustomListControl."

TStaticListAction does not descend from TCustomListControl.

If you want to get the selected text for these components you can do it like this:

ShowMessage((Control as TCustomActionCombo).SelText);

Last Modified: 24-JAN-02