[comp.os.os2.programmer] Changing fonts in dialog boxes

edg@netcom.COM (Ed Greenberg) (05/14/91)

I am trying to create a dialog box, and have the fonts inside two
controls be something other than the default font.  

My controls look like this:

       CONTROL "Text", ID_CALLSIGN, 5, 52, 94, 21, WC_STATIC, SS_TEXT |
               DT_LEFT | DT_TOP | WS_GROUP | WS_VISIBLE
        CONTROL "", ID_NAMEADDRESS, 107, 47, 114, 27, WC_MLE, MLS_BORDER | 
                WS_GROUP | WS_TABSTOP | WS_VISIBLE

Can anyone suggest how to tell the Dialog box to display different
fonts?
				-edg

PS:  OS/2 1.21 and C6.0


-- 
Ed Greenberg 		| Home: +1 408 283 0184 | edg@netcom.com
P. O. Box 28618		| Work: +1 408 764 5305 | CIS: 76703,1070
San Jose, CA  95159	| Fax:  +1 408 764 5003 | WB2GOH @ N6LDL.CA.USA

cadsi@ccad.uiowa.edu (CADSI) (05/14/91)

From article <1991May13.210053.13978@netcom.COM>, by edg@netcom.COM (Ed Greenberg):
> I am trying to create a dialog box, and have the fonts inside two
> controls be something other than the default font.  
> 
> My controls look like this:
> 
>        CONTROL "Text", ID_CALLSIGN, 5, 52, 94, 21, WC_STATIC, SS_TEXT |
>                DT_LEFT | DT_TOP | WS_GROUP | WS_VISIBLE
>         CONTROL "", ID_NAMEADDRESS, 107, 47, 114, 27, WC_MLE, MLS_BORDER | 
>                 WS_GROUP | WS_TABSTOP | WS_VISIBLE
> 
> Can anyone suggest how to tell the Dialog box to display different
> fonts?

Tell the entire Dialog to use a different font in the Dialog definition,
otherwise, send the WM_SETFONT message during the WM_INITDIALOG message.

|----------------------------------------------------------------------------|
|Tom Hite					|  The views expressed by me |
|Manager, Product development			|  are mine, not necessarily |
|CADSI (Computer Aided Design Software Inc.	|  the views of CADSI.       |
|----------------------------------------------------------------------------|

wbonner@yoda.eecs.wsu.edu (Wim Bonner) (05/14/91)

In article <1991May14.030855.18188@ccad.uiowa.edu> cadsi@ccad.uiowa.edu (CADSI) writes:
>> Can anyone suggest how to tell the Dialog box to display different
>> fonts?
>
>Tell the entire Dialog to use a different font in the Dialog definition,
>otherwise, send the WM_SETFONT message during the WM_INITDIALOG message.

Is there a chance that someone can demonstrate either of these methods in this
newsgroup?   I have not found any way to do it in the references I have, and as
this is the second time I've seen this type of request, and I have no idea how
to do it, I'd like to see an example.

Wim
-- 
|  wbonner@yoda.eecs.wsu.edu  | The Loft BBS
| 27313853@wsuvm1.csc.wsu.edu | (509)335-4339
|  72561.3135@CompuServe.com  | USR HST Dual Standard HST/V.32

klos@bcrvmpc3.vnet.ibm.com (Marty Klos 407/443-5411, TL 443) (05/15/91)

From article <1991May13.210053.13978@netcom.COM>, by edg@netcom.COM (Ed Greenber
> I am trying to create a dialog box, and have the fonts inside two
> controls be something other than the default font.
>
> My controls look like this:
>
>        CONTROL "Text", ID_CALLSIGN, 5, 52, 94, 21, WC_STATIC, SS_TEXT |
>                DT_LEFT | DT_TOP | WS_GROUP | WS_VISIBLE
>         CONTROL "", ID_NAMEADDRESS, 107, 47, 114, 27, WC_MLE, MLS_BORDER |
>                 WS_GROUP | WS_TABSTOP | WS_VISIBLE
>
> Can anyone suggest how to tell the Dialog box to display different
> fonts?

I use the PRESPARAMS statement.  For example, to change the font of a
*previous* CONTROL to 8 point Helvetica, use the following
PRESPARAMS statement:

   CONTROL "Text", ID_CALLSIGN, 5, 52, 94, 21, WC_STATIC, SS_TEXT |
           DT_LEFT | DT_TOP | WS_GROUP | WS_VISIBLE
   CONTROL "", ID_NAMEADDRESS, 107, 47, 114, 27, WC_MLE, MLS_BORDER |
           WS_GROUP | WS_TABSTOP | WS_VISIBLE
   PRESPARAMS PP_FONTNAMESIZE "8.Helv"

This will change the font for the ID_NAMEADDRESS control but not
for the ID_CALLSIGN control.  Also, subsequent controls will *not*
have this new font.

There are other presentation parameters and they are defined in
the file pmwin.h.

Marty Klos                           | Disclaimer: The statements above
IBM, Boca Raton, FL                  | are my own and not necessarily
Internet: klos@bcrvmpc3.vnet.ibm.com | those of my employer.