GetIText
GetIText Obtain a copy of the text of an editText item Handle iHandle ; Handle of an editText or statText item Str255 textStr ; address of a 256-byte buffer to hold text GetIText obtains a copy of the text currently stored in an editText or statText item in a dialog. It can be used to obtain a Pascal-style string from a
TextEdit text handle.
iHandle is handle obtained from a previous call to GetDItem. It is actually the hText field of a TERec, as used by TextEdit. textStr is the address of a buffer to hold the returned text. Upon return, it
will contain a pascal-style length-prefixed string of the current
value of the dialog item.
Notes: GetIText lets you know the result when a user edits an editText item. Precede this with a call to GetDItem to obtain a valid value for iHandle . The following example assumes you have a resource that prompts for a new
window title and that item 5 of that dialog is an editText item.
Example
#include <Dialogs.h>
short iType, itemHit;
Str255 theTitle; [TOKEN:12074] a.k.a: char theTitle[256] */ GetDItem( myDlg, 5, &iType, &iHndl, &iRect); SelIText ( myDlg, 5, 0, 32767 ); /* pre-select all for convenience */ /* ----- loop to handle the dialog ----- */
do {
switch ( itemHit ) {
case 5:
GetDItem( myDlg, 5, &iType, &iHndl, &iRect); break;
case 6:
/* ...etc... */
} while ( (itemHit != ok) && (itemHit != cancel) );