Jump to content
  • Advertisement
Sign in to follow this  
JPulham

[.net] ComboBox 'checked'

This topic is 4595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a checkbox user control and have made a ComboBox based on the same code (partly). The problem occurs when I have:
if(Checked)
{
    //draw toggled
}
else if(!Checked)
{
    //don't draw toggled
}
The ComboBox class dosn't have Checked and I wasn't sure what the property was to say its been pressed ect. Does any one know it?

Share this post


Link to post
Share on other sites
Advertisement
Look at the Selected* properties (SelectedIndex, SelectedItem, SelectedValue, SelectedText).

Share this post


Link to post
Share on other sites
If(CB.SelectedIndex!=-1)

or

If(CB.SelectedItem!=null)

these are the cases, when there is something (an item in the list) selected in the combobox.

I suggest creating a new control:

class myComboBox : ComboBox
{
Bool Checked
{
get
{
return CB.SelectedItem!=null;
}
}
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!