Article View: comp.os.os2.programmer
Article #2356Fixed Fonts in List Boxes???
From: Barry King
Date: Sat, 05 Jan 1991 09:18
Date: Sat, 05 Jan 1991 09:18
133 lines
4014 bytes
4014 bytes
I am writing an application in which I require a fixed font in a listbox.
Thinking that this _should_ be fairly straightforward, I basically set
out the following scheme:
In response to WM_MEASUREITEM
if it's for my listbox
retrieve hps
GpiQueryFonts for a fixed font
store font metrics in a global FATTR structure for later use
GpiCreateLogFont
GpiSetCharSet
return height of listbox item from new font
release the hps
This works and the effects show up in my listbox.
In response to the WM_DRAWITEM message I do the following:
if it's my listbox
get a pointer to the item to be drawn from mp2
GpiCreateLogFont from my global FATTR structure
GpiSetCharSet from the same structure
This doesn't appear to work... The functions return no errors but I do
not get my fixed font (Courier, in this case) in the listbox although the
spacing of the proportional system font is changed to reflect the new
font metrics...???
I know the above is very general but what kinds of things should I be
looking for? I am using calls to WinSendMsg to insert items into the
listbox. I use WinWindowFromID to get a hwnd to my listbox and use that
in my calls...no errors are returned from WinSendMsg.
After checking around for some source that does something similar, I came
across a file finder that uses virtually the same technique. My code
(appears) functionaly identical to the file finder code with the distinct
difference being that mine doesn't work properly...
I find it odd that the listbox item height changed correctly and that
the formatting of the listbox items appears as though it might if it were
in a fixed font even though it is actually displayed in the system
proportional font.
Ideas anyone?
Thanks.
Technical Details
Message-ID:
<5oNaV1w163w@ersys.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!uw-beaver!ubc-cs!alberta!aunro!ersys!bkingShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!uw-beaver!ubc-cs!alberta!aunro!ersys!bking From: ersys!bking@nro.cs.athabascau.ca (Barry King) Newsgroups: comp.os.os2.programmer Subject: Fixed Fonts in List Boxes??? Message-ID: <5oNaV1w163w@ersys.uucp> Date: 5 Jan 91 09:18:15 GMT Organization: Edmonton Remote Systems,Edmonton,AB,Canada:Public Access USENET Lines: 133