[comp.sys.mac.programmer] How does one set a single edittext item's font in a dialog?

rdd@walt.cc.utexas.edu (Robert Dorsett) (11/27/89)

I guess the title says it all...:-)  Anyone have any demo code?  I have 
several edittext items in a modeless dialog.  I want one of them to be in 
monaco 9, the rest in Chicago 12.  I've tried getditem and changing (what
I believe) to be the appropriate edittext fields, but nothing happens...





Robert Dorsett                                   
Internet: rdd@rascal.ics.utexas.edu               
UUCP: ...cs.utexas.edu!rascal.ics.utexas.edu!rdd  

amanda@intercon.com (Amanda Walker) (11/27/89)

In article <21431@ut-emx.UUCP>, rdd@walt.cc.utexas.edu (Robert Dorsett) writes:
> I have 
> several edittext items in a modeless dialog.  I want one of them to be in 
> monaco 9, the rest in Chicago 12.

The main problem you will run into is that the Dialog Manager uses a single
TextEdit record for *all* of the editText items.  As you click on different
items (or hit the tab key) it changes where this TextEdit record sits, and
points the hText field at the contents of the item.

The simplest way to get the effect you want would probably be to take the
item that's supposed to be monaco 9, make it a UserItem, and handle clicks
and keystrokes in it yourself with a dialog filter procedure.  This way you
can maintain your own TextEdit record for that particular item, and thus
have full control over the font, size, etc.

Handling the tab key and the insertion point could be hairy, though...

Amanda Walker
InterCon Systems Corporation
amanda@intercon.com
--

pvh@Apple.COM (Pete Helme) (11/28/89)

This sounds good to me.  In fact to get the best use out of the dialog manager,
make EVERY item a user item.

Pete Helme
MacDTS
Apple Computers, Toasters & Notions

(All my opinions are actually utterances made by Keith Rollin while he was 
asleep on one of the DTS couches)

mystone@mondo.engin.umich.edu (Dean Yu) (11/28/89)

In article <5442@internal.Apple.COM> pvh@Apple.COM (Pete Helme) writes:
>This sounds good to me.  In fact to get the best use out of the dialog manager,
>make EVERY item a user item.
>

  Whatever happened to "The Dialog Manager is not a User Interface"?

_______________________________________________________________________________
Dean Yu                            | E-mail: mystone@caen.engin.umich.edu
Self-declared License Czar         | Real-mail: Dean Yu
University of Michigan             |            909 Church St
Computer Aided Engineering Network |            Apt C
     INCLUDE 'Disclaimers.a'       |            Ann Arbor, MI 48104
-------------------------------------------------------------------------------

svc@well.UUCP (Leonard Rosenthol) (11/29/89)

In article <1569@intercon.com> amanda@intercon.com (Amanda Walker) writes:
>In article <21431@ut-emx.UUCP>, rdd@walt.cc.utexas.edu (Robert Dorsett) writes:
>> I have 
>> several edittext items in a modeless dialog.  I want one of them to be in 
>> monaco 9, the rest in Chicago 12.
>
>The simplest way to get the effect you want would probably be to take the
>item that's supposed to be monaco 9, make it a UserItem, and handle clicks
>and keystrokes in it yourself with a dialog filter procedure.  This way you
>can maintain your own TextEdit record for that particular item, and thus
>have full control over the font, size, etc.
>
>Handling the tab key and the insertion point could be hairy, though...
>
	I would say that Amanda's method would probably be the best, but there
is one other way and that is to use ictb resources.  The ictb resource was 
designed so that you could color dialog items, as well as setting the font/size
etc. for edit and statText fields in a dialog.  The biggest problems with using
ictb's are 1) the structure is a bitch to use and you have to hand do the hex
since there is not editor or TMPL for ResEdit and 2) Apple doesn't guarentee it
to work (don't you just love it!).  I tried using it once and it was not to
cooperative, but then I was trying it in a modeless dialog, and it will probably
work better for modal dialogs.
	Just another thought on the subject...


-- 
+--------------------------------------------------+
Leonard Rosenthol        |  GEnie : MACgician
Lazerware, inc.          |  MacNet: MACgician
UUCP: svc@well.UUCP      |  ALink : D0025

jackiw@cs.swarthmore.edu (Nick Jackiw) (11/30/89)

In article <14748@well.UUCP> svc@well.UUCP (Leonard Rosenthol) writes:
> 	I would say that Amanda's method would probably be the best, but there
> is one other way and that is to use ictb resources.  The ictb resource was 
> designed so that you could color dialog items, as well as setting the font/size
> etc. for edit and statText fields in a dialog.  The biggest problems with using
> ictb's are 1) the structure is a bitch to use and you have to hand do the hex
> since there is not editor or TMPL for ResEdit and 2) Apple doesn't guarentee it

I wrote an ictb/dctb/actb editor a while back to avoid hand-hexing forty
alerts in an application I'm building.  It has an absolutely hideous
user interface (which reflects an even more hideous data structure--I
don't know *what* Apple was thinking of when they came up with the ictb),
but it gets the job done.  If anyone would like it, send me e-mail. (If
response is overwhelming, I might put it on *.binaries, though it's
*not* intended for use by resource-tyros).

> to work (don't you just love it!).  I tried using it once and it was not to
> cooperative, but then I was trying it in a modeless dialog, and it will probably
> work better for modal dialogs.

True. Someone else pointed out that it frequently ignores FontInfo for new
fonts, though it seems to like Geneva 9 fine. In my opinion, its main 
drawback is that there's no way to pre-empt it.  If you set your background
color to a dark red, say, it will be mapped to black on any Color Quickdraw
machine set to B&W (e. g. my SE/30), and the foreground text will be
completely illegible.  Lots of experimentation is necessary to find fore
and back colors which are both aesthetically pleasing and useful interface-
wise and which preserve these two criteria when mapped to black and white.


> 	Just another thought on the subject...
> 
> 
> -- 
> +--------------------------------------------------+
> Leonard Rosenthol        |  GEnie : MACgician
> Lazerware, inc.          |  MacNet: MACgician
> UUCP: svc@well.UUCP      |  ALink : D0025


-- 
     _  _|\____    Nick Jackiw | Visual Geometry Project | Math Department
   / /_/   O>  \   ------------+-------------------------+ Swarthmore College
   |       O>   |  215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081
    \_Guernica_/   ------------+-------------------------+                 USA