home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / misc / 4365 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  2.4 KB

  1. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!smurf.sub.org!flatlin!ovum!cmm!cm
  2. From: cm@cmm.ovum.ka.sub.org (Christoph Mueller)
  3. Newsgroups: comp.os.ms-windows.programmer.misc
  4. Subject: Re: where is my listbox horizontal scrollbar?
  5. Keywords: Listbox, vertical scrolling
  6. Message-ID: <km6XVB1w165w@cmm.ovum.ka.sub.org>
  7. Date: Thu, 17 Dec 92 22:59:55 CET
  8. References: <MUFFY.92Dec16182741@remarque.berkeley.edu>
  9. Distribution: world
  10. Organization: Christoph's PC, Karlsruhe, Germany
  11. Lines: 46
  12.  
  13. muffy@remarque.berkeley.edu (Muffy Barkocy) writes:
  14.  
  15. >
  16. > I have created an MDI child window which has a listbox as its child.
  17. > When I resize the MDI child window, I resize the listbox to fit in it.
  18. > The listbox is created with WS_HSCROLL and WS_VSCROLL.  The vertical
  19. > scroll bar is fine, but the horizontal one refuses to appear.  I tried
  20. > doing a "ShowScrollBar," and it flashes in briefly, but then goes away
  21. > again, even if I have resized the window so small that the listbox items
  22. > definitely do not fit.
  23. >
  24. > Can anyone help?
  25. >
  26. > Thanks...
  27. >
  28. > Muffy
  29.  
  30. There was an article on this subject on the Microsoft Developers Network CD.
  31. (it should also be available via ftp on ftp.uu.net in the
  32. vendor/microsoft/developer-network/user directory)
  33. I haven't tried this yet but I will summarize the article briefly.
  34.  
  35. Use WS_HSCROLL and WS_VSCROLL styles.
  36.  
  37. The problem is that while vertical scrolling is handled automatically by
  38. the control, it needs some help with horizontal scrolling.
  39. You need to supply the listbox with the extent of the longest visible
  40. string: * Select the listbox font (WM_GETFONT) into the device context of
  41.           the listbox.
  42.         * With that device context get the text extent (GetTextExtent).
  43.         * Add buffer to compensate for clipping (use text extent of 'X'
  44.           as approximation, use same device context/font)
  45.         * Send a LB_SETHORIZONTLEXTENT message to the listbox with the
  46.           text extent you just calculated.
  47.         * In Windows 3.0, maybe you have to cause the listbox to redraw
  48.           its content
  49.  
  50. Hope this helps.
  51. Hope you get done before Christmas.
  52. Hope you have Happy Holidays.
  53. Christoph.
  54.  
  55. ---Christoph, Germany    ---   cm@cmm.ovum.ka.sub.org
  56. -------------------------------------------------------------------------
  57. Dysklaemours?  What's that?  How do you spell that?  Do I need that?
  58. I  *AM*  the  SYSTEM,  the  EMPLOYER,  and  the  ORGANIZATION  !!
  59.