[comp.sys.mac.programmer] Hiding editable text

tarr-michael@CS.Yale.EDU (michael tarr) (07/11/90)

I have a modal dialog box with some radio buttons and associated
editable text fields. When a button is clicked I want the appropriate
text field to appear, when its opponent is clicked I wish the field to
disappear and become uneditable (not just hidden as in drawing over
it)...

IM is unclear on how to change the properties of text fields -- any
suggestions would be greatly appreciated...

Mike Tarr
tarr@cs.yale.edu

jackiw@cs.swarthmore.edu (Nick Jackiw) (07/11/90)

tarr-michael@CS.Yale.EDU (michael tarr) writes:
> 
> I have a modal dialog box with some radio buttons and associated
> editable text fields. When a button is clicked I want the appropriate
> text field to appear, when its opponent is clicked I wish the field to
> disappear and become uneditable (not just hidden as in drawing over
> it)...
> 
> Mike Tarr

As of Inside Mac IV, the Dialog Manager accepts two toolbox calls,

	HideDItem(theDialog:DialogPtr; itemNo:integer);
 	ShowDItem(theDialog:DialogPtr; itemNo:integer);

which remove and display dialog items, respectively.  EditText items
are handled properly (i. e. deactivated if active, and no longer
accessible by the tab key).

If you need to create a DITL in which an item is by default hidden, you
can either make the DLOG initially invisible and HideDItem after GetNewDialog
and before ShowWindow, or you can add 16384 to its regular left and right
coordinates in the DITL itself.



--
------------------------
Nick Jackiw		jackiw@cs.swarthmore.edu  "Every minute of the future
Visual Geometry Project	jackiw@swarthmr.bitnet     is a memory of the past."
Swarthmore College, PA 19081-1397				-Laivach

han@apple.COM (Byron Han, Project Scapegoat) (07/12/90)

In article <25533@cs.yale.edu> tarr-michael@CS.Yale.EDU (michael tarr) 
writes:
> I have a modal dialog box with some radio buttons and associated
> editable text fields. When a button is clicked I want the appropriate
> text field to appear, when its opponent is clicked I wish the field to
> disappear and become uneditable (not just hidden as in drawing over
> it)...

What I like to do is to change the editText item to a statText item.

use HideDItem(), GetDItem(), SetDItem(), ShowDitem() in that order.

I also like to add a dimmed outline box around the (now) statText item in 
the same position as the outline box for the editText item.

+-------------------------------------------------------------------------+
| Disclaimer: Apple has no connection with my postings.                   |
+-------------------------------------------------------------------------+
Byron Han, CommToolbox Architect  "Not Working 100 hrs/wk and loving it!"
Apple Computer, Inc.              --------------------------------
20525 Mariani Ave, MS 69L         Internet: han@apple.COM
Cupertino, CA 95014               UUCP:{sun,voder,nsc,decwrl}!apple!han
--------------------------------  GENIE:BYRONHAN   CompuServe:72167,1664
ATTnet: 408-974-6450              Applelink:HAN1   HAN1@applelink.apple.COM
---------------------------------------------------------------------------

pepke@gw.scri.fsu.edu (Eric Pepke) (07/13/90)

What I do in situations like this is, when the user changes the button, 
select the appropriate text box, and when the user clicks in the 
appropriate text box, change the radio button.

Actually, first I try to figure out a better way of organizing the problem.

Eric Pepke                                    INTERNET: pepke@gw.scri.fsu.edu
Supercomputer Computations Research Institute MFENET:   pepke@fsu
Florida State University                      SPAN:     scri::pepke
Tallahassee, FL 32306-4052                    BITNET:   pepke@fsu

Disclaimer: My employers seldom even LISTEN to my opinions.
Meta-disclaimer: Any society that needs disclaimers has too many lawyers.