Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!julius.cs.uiuc.edu!apple!portal!sv!news From: leonardr@svc.portal.com (Leonard Rosenthol) Newsgroups: comp.sys.mac.programmer Subject: Re: How do I change Dialog font size? Message-ID: <1990Oct18.174454.15990@svc.portal.com> Date: 18 Oct 90 17:44:54 GMT References: <1990Oct9.125203.1@mel.cipl.uiowa.edu> <21229@well.sf.ca.us> Sender: news@svc.portal.com Reply-To: leonardr@svc.portal.com (Leonard Rosenthol) Organization: Software Ventures Corporation. Lines: 46 In article <21229@well.sf.ca.us>, smoke@well.sf.ca.us (Nicholas Jackiw) writes: > In article <1990Oct9.125203.1@mel.cipl.uiowa.edu> wolf@mel.cipl.uiowa.edu writes: > >How does one change the size of editable and static text items in dialogs? > > theDLOG:=GetNewDialog(129,nil,pointer(-1)); > if theDLOG<>nil then > begin {Successfully allocated} > SetPort(theDLOG); {Switch to the invisible dialog window} > TextFont(1); {Switch to application font} > TextSize(9); {Size 9} > ShowWindow(theDLOG); > ... > end; > Although this SHOULD work, it does not handle all appropriate situations. In addition to doing this, you will also have to personally munge the dialog's TERec, in order to set it up correctly. Here is the routine that I use: PROCEDURE SetDialogFontInfo(theDialog:DialogPtr: theFont, theSize:integer); VAR myFInfo: FontInfo; myTEH: TEHandle; BEGIN TextFont(theFont); {name to num conversion done externally} TextSize(theSize); GetFontInfo(myFInfo); myTEH := DialogPeek(theDialog)^.textH; myTEH^^.txFont := GetAppFont; myTEH^^.txSize := 9; myTEH^^.lineHeight := myFInfo.ascent + myFInfo.descent + myFInfo.leading; myTEH^^.fontAscent := myFInfo.ascent; TECalText(myTEH); END; > This will affect only the statText and editTxt font--buttons, etc, will > still use the system font. Alternately, if you're willing to limit > yourself to color machines, check out the ictb resource description > in Inside Mac V. It's convoluted, but will allow any combination of > fonts and sizes (and colors and styles) within a single dialog. > Don't bother using ictb's. As of System 6.0.5, Apple still does not have them working correctly - especially for edit fields. -- Leonard Rosenthol Software Ventures Corp. MicroPhone II Development Team