Article View: comp.os.ms-windows.programmer.misc
Article #2035Re: where is my listbox horizontal scrollbar?
From: Christoph Mueller
Date: Thu, 17 Dec 1992 21:59
Date: Thu, 17 Dec 1992 21:59
46 lines
2491 bytes
2491 bytes
muffy@remarque.berkeley.edu (Muffy Barkocy) writes:
>
> I have created an MDI child window which has a listbox as its child.
> When I resize the MDI child window, I resize the listbox to fit in it.
> The listbox is created with WS_HSCROLL and WS_VSCROLL. The vertical
> scroll bar is fine, but the horizontal one refuses to appear. I tried
> doing a "ShowScrollBar," and it flashes in briefly, but then goes away
> again, even if I have resized the window so small that the listbox items
> definitely do not fit.
>
> Can anyone help?
>
> Thanks...
>
> Muffy
There was an article on this subject on the Microsoft Developers Network CD.
(it should also be available via ftp on ftp.uu.net in the
vendor/microsoft/developer-network/user directory)
I haven't tried this yet but I will summarize the article briefly.
Use WS_HSCROLL and WS_VSCROLL styles.
The problem is that while vertical scrolling is handled automatically by
the control, it needs some help with horizontal scrolling.
You need to supply the listbox with the extent of the longest visible
string: * Select the listbox font (WM_GETFONT) into the device context of
the listbox.
* With that device context get the text extent (GetTextExtent).
* Add buffer to compensate for clipping (use text extent of 'X'
as approximation, use same device context/font)
* Send a LB_SETHORIZONTLEXTENT message to the listbox with the
text extent you just calculated.
* In Windows 3.0, maybe you have to cause the listbox to redraw
its content
Hope this helps.
Hope you get done before Christmas.
Hope you have Happy Holidays.
Christoph.
---Christoph, Germany --- cm@cmm.ovum.ka.sub.org
-------------------------------------------------------------------------
Dysklaemours? What's that? How do you spell that? Do I need that?
I *AM* the SYSTEM, the EMPLOYER, and the ORGANIZATION !!
Technical Details
Message-ID:
<km6XVB1w165w@cmm.ovum.ka.sub.org>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!smurf.sub.org!flatlin!ovum!cmm!cmReferences:
<MUFFY.92Dec16182741@remarque.berkeley.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!smurf.sub.org!flatlin!ovum!cmm!cm From: cm@cmm.ovum.ka.sub.org (Christoph Mueller) Newsgroups: comp.os.ms-windows.programmer.misc Subject: Re: where is my listbox horizontal scrollbar? Keywords: Listbox, vertical scrolling Message-ID: <km6XVB1w165w@cmm.ovum.ka.sub.org> Date: Thu, 17 Dec 92 22:59:55 CET References: <MUFFY.92Dec16182741@remarque.berkeley.edu> Distribution: world Organization: Christoph's PC, Karlsruhe, Germany Lines: 46