wim@ecn.nl (Wim Rijnsburger) (03/05/91)
I need to present a list of formatted strings in my program. The scrolling list in SDK does this fine, but the font of the list (owned by the dialog popup) has variable width characters. This garbles the alignment of the colums in the strings. With the SDK's dialog editor I can choose a fixed width fonts, but then my button and text labels are affected too. Does anyone know if there is a method to create scrolling lists with fixed width font items, without choosing another font for the other dialog items? Wim. ---------- Netherlands Energy Research Foundation, ECN -------------- Wim Rijnsburger email: RIJNSBURGER@ECN.NL P.O. Box 1, 1755 ZG Petten, Holland phone: +31 2246 4673
bonneau@hyper.hyper.com (Paul Bonneau) (03/06/91)
In article <1991Mar4.162732.18183@ecn.nl> rijnsburger@ecn.nl (Wim Rijnsburger) writes: > >Does anyone know if there is a method to create scrolling lists with >fixed width font items, without choosing another font for the other >dialog items? > Send the WM_SETFONT message to the listbox when you get the WM_INITDIALOG message (see the description of WM_SETONT in the reference volume 1 of the SDK). Otherwise, you can use GetDlgBaseUnits() to help you calculate the size of the text in the list. This routine returns a (dx, dy) pair that computes an "average" scale factor to convert from charcter-width/4 and character-height/8 units to logical units (pixels if you are using MM_TEXT mode--the default). cheers - Paul Bonneau.
wei@hpctdls.HP.COM (Bill Ives) (03/07/91)
In response to your question about column positioning of text in list controls w.r.t variable width fonts. I had the same problem and ended up resorting to the owner draw list box control. There, your application does the text drawing in response to the WM_DRAWITEM (?) message. You can then use TextOut and SetTextAlign (?) to align your listing text in column format with variable sized font -- you can even select a different font to TextOut if that suits you too. I don't have my manuals here at work so the above names may not be exactly right, but hey, you get the idea.... Hope this helps Bill Ives HP CTD #include <std-disclaimer-here>