|
-
May 4th, 1999, 03:45 PM
#1
Automatic Scrolling in CListBox
I have a ListBox control in a dialog application, and I am programmatically adding lines to the listbox. I want the listbox to automatically scroll down as each new line is added by the program. I created the following function to do this:
void CPVSMainDlg::ScrollWithIt(CListBox& lbox)
{
int limit;
limit = lbox.GetScrollLimit(SB_VERT);
lbox.SetScrollPos(SB_VERT, limit, TRUE);
lbox.UpdateWindow();
}
Note: CPVSMainDlg is my main dialog box and I am passing the listbox to a member function that I created.
This works partially in that the scrollbar on the listbox does go down to the bottom. The problem is that the listbox window itself does not actually scroll. I have tried many things and it is probably something simple that I am missing, but I just can't seem to get it to work. Anyone have any ideas??? Thanks in advance.
-
May 4th, 1999, 06:11 PM
#2
Re: Automatic Scrolling in CListBox
If you know the index of the added item - returned from AddString() - use SetTopIndex()
Howard
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|