[comp.sys.mac.programmer] TextEdit Item in a dlog

soe@ames.arpa (Brad Soe) (04/28/88)

I was wondering about an item that is declared "editText" in
a resources template. Is it just like a "TEHandle"? 

Can you Call:
GetDItem(dialog, itemno, &type, &tehandle, &rect);
TEIdle(tehandle);	(or any Textedit routine) 

I want to use a textEdit and a scroll bar in a dialog window, 
I tried to declare a textedit item for the window, and a user
Item for the scroll bar, but the "tehandle" that I declared and
stored in the item list does'nt act like I expect it to. 
I want to be able to access some of the "TEHandle" to calculate
the postion of the scroll bar at any given time.
Can you do this: 

GetDItem(dialog, itemno, &type, &tehandle, &rect);
tehandle = TENew(&rect, &rect);

and then use this handle??? Or am I way off track. Any help 
would be appreciated.

					Brad Soe 
					internet : soe@ames.arc.nasa.gov
					NASA Ames Research Ctr.
					Mail Stop 233-18
					Moffett Field, CA 94035
					(415) 694-4866

scott@Apple.COM (scott douglass) (04/30/88)

In article <8006@ames.arpa> soe@ames.arpa (Brad Soe) writes:
>I was wondering about an item that is declared "editText" in
>a resources template. Is it just like a "TEHandle"? 
>...
>					Brad Soe 
>					internet : soe@ames.arc.nasa.gov

No.  The handle returned by GetDItem is just a handle to the text.
Ideally you would only access this handle by passing it to GetIText
and SetIText.

A dialog has one TERecord that is shared by all editText items (i.e.
it contains the correct values for the currently active editText item.
This is all fairly well explained in Chapter 13  The Dialog Manager of
Inside Mac Vol I (esp. pg I-408).  Hope this helps.
-- 
				--scott douglass, Apple Computer
CSNet:  scott@Apple.CSNet    UUCP:  {nsc, sun, voder, well, dual}!apple!scott
AppleLink:  Douglass1
Any opinions above are mine and not necessarily those of Apple Computer.

kaufman@polya.STANFORD.EDU (Marc T. Kaufman) (04/30/88)

In article <8006@ames.arpa> soe@ames.arpa (Brad Soe) writes:
>I was wondering about an item that is declared "editText" in
>a resources template. Is it just like a "TEHandle"? 

No, it is a handle to an "editText item", which, in fact, contains
the handle to the text (I believe in the first 4 bytes, but I may be wrong
on this).

>Can you Call:
>GetDItem(dialog, itemno, &type, &tehandle, &rect);
>TEIdle(tehandle);	(or any Textedit routine) 

No, for the reason stated above.  However, if the TEHandle to the CURRENTly
active text is in the textH field of the DialogRecord (i.e. in

	dialog^.textH

You can select a specific text item with SelIText(dialog, itemNo, start, end);
See IM-I-408,422

Marc Kaufman (kaufman@polya.stanford.edu)