[comp.sys.mac.programmer] Hiliteing Text Items in Dialogs

barry@world.std.com (Barry L Wolman) (05/24/91)

I've got a dialog box that contains several static and edit text fields that
I'd like to "grey out" or show normally depending on what user selects from a
set of radio buttons.  Is there a simple equivalent to HiliteControl that can
be used with text fields? If it would be easier, I'd be willing to make the
text fields visible or invisible.
 
Would it be "cheating" to arrange for these fields to have the last N item
numbers and include or omit them from the DITL by setting the item count in
the first two bytes of the DITL resource?  If this approach works, is it
possible to patch the DITL while the dialog is active?
 
Any tips, suggestions, code fragments, etc. will be greatly appreciated.
 
Thanks, Barry Wolman

-- 
Barry Wolman
159 Oxbow Road
Needham, MA 02192
617-449-3874

dweisman@umiami.ir.miami.edu (Ordinary Man) (05/26/91)

In article <1991May24.040412.6929@world.std.com>, barry@world.std.com (Barry L Wolman) writes:

> I've got a dialog box that contains several static and edit text fields that
> I'd like to "grey out" or show normally depending on what user selects from a
> set of radio buttons.  Is there a simple equivalent to HiliteControl that can
> be used with text fields? If it would be easier, I'd be willing to make the
> text fields visible or invisible.

There are a couple of ways I can think of off-hand. Either:

1) Stick a userItem around the text to be greyed (one for each text Item). Then 
when you want to grey that item, just use a FillRect on the userItem's rect 
with penmode patBic with grey. That should "dim" the text. 

2) Use the Dialog Manager's routines Hide/Show DItem documented in IM IV I 
believe. These routines just hide the item (by moving them out of the dialog's 
visRgn).

> Thanks, Barry Wolman

You're welcome,
Dan

/-------------------------------------------------------------------------\
|   Dan Weisman -  University of Miami - Florida   |  ||   ||   ||   ||   |
|--------------------------------------------------|  ||   ||   ||\ /||   |
|   INTERNET  -----> dweisman@umiami.IR.Miami.edu  |  ||   ||   || | ||   |
|     BITNET  -----> dweisman@umiami               |  |||||||   || | ||   |
|-------------------------------------------------------------------------|
| "...the fact is- this friction will only be worn by persistance." -RUSH |
\_________________________________________________________________________/

ari@eleazar.dartmouth.edu (Ari Halberstadt) (05/27/91)

In article <1991May25.132654.10182@umiami.ir.miami.edu> dweisman@umiami.ir.miami.edu (Ordinary Man) writes:
>In article <1991May24.040412.6929@world.std.com>, barry@world.std.com (Barry L Wolman) writes:
>
>>I've got a dialog box that contains several static and edit text fields that
>>I'd like to "grey out" or show normally depending on what user selects from a

>Stick a userItem around the text to be greyed (one for each text Item). Then 
>when you want to grey that item, just use a FillRect on the userItem's rect 
>with penmode patBic with grey. That should "dim" the text. 
>
>Use the Dialog Manager's routines Hide/Show DItem documented in IM IV I 
>believe. These routines hide the item (by moving them out of the dialog's 
>visRgn).

If the item is an editText item you should also change its type to a
static text item. This should prevent a tab from moving the insertion
point to the grayed out or invisible item; notice that it may be a
little trickier do keep the item from responding to tabs than just
changing its type. The routines Hide/Show DItem don't move an item out
of the dialog's visRgn, they move it out of the dialog's portRect.