bking@nro.cs.athabascau.ca (Barry King) (01/05/91)
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.