ScrollInfo.cbSize = sizeof(ScrollInfo);
ScrollInfo.fMask = SIF_ALL;
GetScrollInfo(AdvWinFeatList, SB_VERT, &ScrollInfo);
FillFeatSelectBox(); //this is where the contents get reset
ScrollInfo.fMask = SIF_POS ;
SetScrollInfo(AdvWinFeatList, SB_VERT, &ScrollInfo, true);
ScrollWindow(AdvWinFeatList, 0, -ScrollInfo.nPos, NULL, NULL);
UpdateWindow(AdvWinFeatList);
Retaining Scroll Position
Well, this seems like it ought to be quite simple, but in fact it has me stumped.
I have a List Box that is Owner Drawn, created like so:
AdvWinFeatList = CreateWindowEx(NULL, "LISTBOX", "Feat List", WS_CHILD | WS_VSCROLL | LBS_NOSEL | LBS_NOINTEGRALHEIGHT | LBS_OWNERDRAWFIXED | LBS_NOTIFY, 615, 215, 280, 240, Parent, (HMENU)MS_ADVWINFEATSLIST, Instance, NULL);
If a user drags an icon off this box and drops it in a particular place, the contents of this window get reset. The problem with this is that resetting the content also causes the vscrollbar to reset to the top, which is undesirable.
So, all I need to do is grab the position of the scrollbar, reset the box contents, and put the scroll position back. Seems easy, but it's making me nuts :)
Here is the code I have to do this:
This does put the scrollbar where it's supposed to be, but the contents of the listbox appear as if the scrollbar is a the top. What in the world am I doing wrong here?
Thanks -Ron
[/source]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement