Jump to content
  • Advertisement
Sign in to follow this  
bah

MFC List Box

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

Hi, I am using an MFC(?) component called List Box where I periodically insert lines of text without sorting them alphabetically. The problem is that if the initial height of the component is not large enough to contain the new lines, the vertical scrollbar to the right will be activated but will not scroll down to the last line. The user needs to do that manually but I prefer this to happen automatically. Thanks

Share this post


Link to post
Share on other sites
Advertisement
hm i think you need to derive your own list box class and overwrite the mouseinput
routines

and whenever the focus is on your list box you will receive the mouse input and can dothe scrolling on your own

Share this post


Link to post
Share on other sites
When you insert an item, get the height of all the items and the height of the control. If the height of all the items are greater, scroll the list box down.

Alternatively, use a CListCtrl and call EnsureVisible to ensure that your latest item added is visible.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You might want to look at: SetCaretIndex() and GetCount(). This way you can move the caret position to the end of your list once you have inserted an item and it hopefully will get focus.

Share this post


Link to post
Share on other sites
Thanks for the replies guys, especially the last one which I found really helpful.

Problem solved.

-Edit-

Re: Anynomous Poster

Log in with your proper nickname so that I may rate you. Cheers

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!