Jump to content
  • Advertisement
Sign in to follow this  
da_cobra

m_ListCtrl.GetSelectedCount() ???

This topic is 4904 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 listcontrol with no items selected and still when I run this function, the code is not executed?!? Am I missing something?
if (m_ListCtrl.GetSelectedCount() == 0)
{
	MessageBox("Please select 1 item!") ;
	return ;
}

Share this post


Link to post
Share on other sites
Advertisement
There could be a number of things.

1. The if statement is not reached in the first place
2. You actually do have some item selected
3. If the listctrl is not initialized properly an error might be returned

Why don't you print out what GetSelectedCount returns? And also print out the selected items.

Share this post


Link to post
Share on other sites
thx, I just tried your second answer and it indeed says that there is 1 selection, although nothing is selected, what is going on?!?

Share this post


Link to post
Share on other sites
Well I've never had that problem. What item is selected according to your listbox? What happens if you do select a couple of items? Does it still return 1 or the actual number? Are you sure you are checking the correct list ctrl? Double check DoDataExchange if the listctrl is connected to a dialog resource. Add a selection changed event to the ctrl and set a break in that function...

Don't be afraid to debug your application. =)

You could also create a small test program where the bug occurs and post it here.

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!