Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 6 - Dialog Manager / Dialog Manager Reference
Dialog Manager Routines / Handling Text in Alert and Dialog Boxes


SelectDialogItemText

To select and highlight text contained in an editable text item, use the SelectDialogItemText procedure. The SelectDialogItemText procedure
is also available as the SelIText procedure.

PROCEDURE SelectDialogItemText (theDialog: DialogPtr; 
                                itemNo: Integer; 
                                strtSel: Integer; 
                                endSel: Integer);
theDialog
A pointer to a dialog record.
itemNo
A number corresponding to the position of an editable text item in the dialog box's item list resource.
strtSel
A number representing the position of the first character to begin selecting.
endSel
A number representing one position past the last character to be selected.
DESCRIPTION
If the item in the itemNo parameter is an editable text item that contains text, the SelectDialogItemText procedure sets the text selection range to extend from
the character position specified in the strtSel parameter up to but not including the character position specified in the endSel parameter. The selection range is highlighted unless strtSel equals endSel, in which case a blinking vertical bar is displayed to indicate an insertion point at that position. If the editable text item doesn't contain text, SelectDialogItemText displays the insertion point.

You can select the entire text by specifying the number 0 in the strtSel parameter and the number 32767 in the endSel parameter.

For example, if the user makes an unacceptable entry in the editable text item, your application can display an alert box reporting the problem and then use SelectDialogItemText to select the entire text so it can be replaced by a new
entry. Without this procedure, the user would have to select the item before making
the new entry.

SEE ALSO
For details about text selection range and character position, see the chapter "TextEdit" in Inside Macintosh: Text.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996