chrisd
chrisd

Reputation: 893

Disabled horizontal scrollbar in Windows listbox

Well, I thought I was finished with this kind of question 15 years ago.

What causes the horizontal scrollbar in a Windows listbox to be disabled? Here's the control definition:

    LISTBOX IDC_FOOBAR,6,6,100,60,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP | WS_HSCROLL 

The listbox contains some items that are much longer than can be displayed. The horizontal scrollbar is visible but disabled. The vertical scrollbar is fine. What gives?

TIA.

Upvotes: 0

Views: 877

Answers (1)

Erik
Erik

Reputation: 91270

You need to set the logical width of the listbox width LB_SETHORIZONTALEXTENT. The horizontal scrollbar is disabled as long as the client width is more than this value.

Upvotes: 2

Related Questions