Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!apple!claris!clay From: clay@claris.com (Clay A. Maeckel) Newsgroups: comp.sys.mac.programmer Subject: Re: Changing the Font of Dialog Items Message-ID: <6281@claris.com> Date: 26 Oct 88 15:06:04 GMT References: <261fordjm@byuvax.bitnet> <10050037@eecs.nwu.edu> Reply-To: clay@claris.com (Clay A. Maeckel) Organization: Claris Corporation, Mountain View CA Lines: 43 In article <10050037@eecs.nwu.edu> bob@eecs.nwu.edu (Bob Hablutzel) writes: >You can easily set the font and size for static text and editable text >items, but changing the font for controls takes more work, and usually >isn't worth it. But, if you still want to fight with the dialog manager and it's quirks here is how I have set up a dialog to use another font. (The variable names have been changed to protect the innocent :-). Instead of creating CNTL resources for all the controls to change the variant type (values > 8 tells the control to use the windows font) you can do a slight of hand trick of changing the variants directly after the dialog manager has created the controls for the DITL list. SetDAFont(dfNum); {Set font for the dialog} dBox := GetNewDialog(149, NIL, pointer(-1)); {Get the dialog box, invisible} SetDAFont(0); {Restore the normal dialog font} dBox^.txSize := dfSize; {Set font size} FOR i := 4 TO 12 DO {Loop through all the controls} BEGIN GetDItem(dBox, i, j, h, r); {Need the control handle} BSET(LongInt(ControlHandle(h)^^.contrlDefProc), 27); {Change the control variant} END; {FOR} ShowWindow(dBox); {Now show the dialog} WARNING -- This will not work with A/UX because they have moved the control's variant to another location. There is a new call, GetCVariant, but there is no SetCVariant that I know of. WARNING TWO -- This trick depends on the CDEFs not caring which variant it is going to draw at initialization time. If Apple changes this, it will most likely break. Given these two problems, it works now, but the official and most likely not to break way is to use a CNTL resource for each control in the dialog box a setting the variant to use the window's font. -- Clay Maeckel * UUCP: {ames,apple,portal,sun,voder}!claris!clay (I know nothing!) * Internet: clay@claris.com * GEnie: C.MAECKEL Claris Corporation * AppleLink: Maeckel1 * CompuServe: 73057,255