tom@iconsys.UUCP (Tom Kimpton) (09/16/88)
I have some editText fields in a dialog with statText labels. Depending on where the information from the dialog is going I may want some editText fields inactive. Thus I want to do something to the labels to "dim" them, like inactive labels of buttons. I tried GetDItem(), and then HiliteControl(), but that just crashed me. Any ideas? Thanks. -- Tom Kimpton UUCP: {uunet,caeco,nrc-ut}!iconsys!tom Software Development Engineer ARPANET: icon%byuadam.bitnet@cunyvm.cuny.edu Icon International, Inc. BITNET: icon%byuadam.bitnet (multi-user acct) Orem, Utah 84058 PHONE: (801) 225-6888
bob@eecs.nwu.edu (Bob Hablutzel) (09/18/88)
> I have some editText fields in a dialog with statText labels. > Depending on where the information from the dialog is going > I may want some editText fields inactive. Thus I want to > do something to the labels to "dim" them, like inactive labels > of buttons. I tried GetDItem(), and then HiliteControl(), but > that just crashed me. Any ideas? The reason they crashed is that the editText items are textEdit items, not controls. There isn't a really clean way of "dimming" a text edit item that I know of, but you might want to play with this: Inactivate the item (using SetDItem and adding itemDisable to the item type), then set the paint mode to srcAnd and paint the view rectangle with a grey pattern. When the item is reactivated, grab the text edit handle (tricky, but not impossible), and refresh it. The real problem here should be getting the handle and refreshing - making these user items would be something worth looking into (especially for modeless dialogs...) Bob Hablutzel BOB@NUACC.ACNS.NWU.EDU
lsr@Apple.COM (Larry Rosenstein) (09/18/88)
In article <10050017@eecs.nwu.edu> bob@eecs.nwu.edu (Bob Hablutzel) writes: > >set the paint mode to srcAnd and paint the view rectangle with a grey There is no srcAnd. What you want to do is use patBic and a pattern of gray. This is what the menu manager does for grayed out items. If it is a standard edit text item, then it will be in the system font (Chicago), which looks OK when grayed out this way. >pattern. When the item is reactivated, grab the text edit handle (tricky, >but not impossible), and refresh it. The real problem here should be >getting the handle and refreshing - making these user items would be Another way is to get the item's bounding box and call InvalRect. The Dialog Manager will take care of the update for you. (This may result in an undesirable flash, however.) Larry Rosenstein, Object Specialist Apple Computer, Inc. 20525 Mariani Ave, MS 46-B Cupertino, CA 95014 AppleLink:Rosenstein1 domain:lsr@Apple.COM UUCP:{sun,voder,nsc,decwrl}!apple!lsr
tony@arcsun.UUCP (Tony Copping) (09/21/88)
[] Here's how I handled this exact situation : Editable text (in the program I am working on) appears in a THICKLY outlined box. When the edit text is disabled, It is still in a box (thus indicating that it is an editable field), but with a thin outline. This looks quite nice, actually, and the text remains quite readable. (I hate trying to read greyed-out text). From the programmer's point of view, it is naturally much messier than it appears. These text items are really two items (Just like the default circle for the OK button) where one is the user item which draws a rectangle, and the other is a text item (notice that I didn't specify that it was necessarily an editText item). To disable the item, use SetDItem to change its type to statText, and then set the DialogPeek->editField to -1. (Of course, if there are other editText items in the window, you should SelIText() one of those items.) To enable the item, just set its type back to editText. Note that this also gives you the advantage of not having a blinking cursor sitting in one of your disabled text items. How 'bout some feedback on this idea as it is the most radical departure I have made from the MacGuidelines I have made - I was quite surprised to find that there was no facility for doing this in the mac toolbox. Tony.
ech@poseidon.UUCP (Edward C Horvath) (09/22/88)
From article <10050017@eecs.nwu.edu>, by bob@eecs.nwu.edu (Bob Hablutzel): >> ...I may want some editText fields inactive. Thus I want to >> do something to the labels to "dim" them... > > ...Inactivate > the item (using SetDItem and adding itemDisable to the item type), then > set the paint mode to srcAnd and paint the view rectangle with a grey > pattern. When the item is reactivated, grab the text edit handle (tricky, > but not impossible), and refresh it.... Indeed, a userItem that exactly overlaps the text item -- and appears LATER in the DITL, works just fine here. When your drawing routine is called, it either does nothing or does the gray paint with srcBic. There is no need to "grab the text edit handle" to force the refresh: just use GetDItem to get the item's rectangle, and call InvalRect with that. The subsequent draw will refresh the text (and your userItem drawing routine will presumably do nothing). =Ned Horvath=