Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

Welcome, Guest
Guest Settings

Thread: [XE7] How to disable items within a TComboBox?

This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Permlink Replies: 0
John Murray

Posts: 12
Registered: 1/22/16
[XE7] How to disable items within a TComboBox?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 26, 2016 3:33 AM
Essentially, I have a TComboBox that has a list of options for the user and I want to disable/remove certain options based on the selection of a prior TComboBox.

This is what I have at the moment:
        InterventionComboBox->ListItems[InterventionComboBox->Items->IndexOf("[All become healthy weight]")]->Selectable = true;
        InterventionComboBox->ListItems[InterventionComboBox->Items->IndexOf("[% become healthy weight]")]->Selectable = true;
        InterventionComboBox->ListItems[InterventionComboBox->Items->IndexOf("[All become non smoker]")]->Selectable = false;
        InterventionComboBox->ListItems[InterventionComboBox->Items->IndexOf("[% become non smoker]")]->Selectable = false;

I've also tried setting the Enabled property and the Visible property to the desired value but none appear to have the effect of removing the item from the drop-down list when the TComboBox is clicked.
Can someone point me in the right direction here?

Just to be clear as well, I have checked the results of the IndexOf calls and they do give the correct results so it's not the case that the wrong or invalid TListBoxItem is being used
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02