Dmitriy_Cert
Dmitriy_Cert

Reputation: 177

Disable autoscroll in ListBox in mfc application

So, in my MFC application there is a Listbox, where sometimes calls method AddString. In properties of Listbox - Scroll is true, and it works fine. And when added strings are many, scrollbar appears, but slider is always below. When I raise it to look previous strings, it goes down after calling Addstring method.

How can I bring slider don't movie after calling Addstring?

Thanks.

Upvotes: 0

Views: 1118

Answers (2)

Ragesh Chakkadath
Ragesh Chakkadath

Reputation: 1531

CListBox::AddString adds the string to the end of the list if LBS_SORT is not given. But there is no chance of slider moving down as it cannot cause a selection change. Make sure you are not calling SetCurSel, SetTopIndex or SelectString after AddString.

Upvotes: 2

acraig5075
acraig5075

Reputation: 10756

If I understand you correctly just call SetCurSel(0); after the AddString.

Upvotes: 0

Related Questions