Jump to content
  • Advertisement
Sign in to follow this  
kelcharge

Retrieving items from a drop-down menu?

This topic is 4824 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

Lets say for example that I have a calculator program. This program has a drop down with "Multiply", and "Divide" in it. How would I retrieve which one is selected in the drop down? This is in C++ and Win32.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by kelcharge
I still cannot figure out how to use CB_GETCURSEL. The MSDN site doesn't really help me a whole lot.


int index = (int)::SendMessage(hwnd, CB_GETCURSEL, 0, 0);

where "hwnd" is the handle to the ComboBox.

The index corresponds to whichever string is selected in your combo box.

Multiply = 0
Divide = 1

That's how you'd know which one was selected.



Share this post


Link to post
Share on other sites
There's also a macro called ComboBox_GetCurSel() defined in the header <windowsx.h>, for example:

int selectedIndex = ComboBox_GetCurSel(hwndComboBox);

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!