Important: The information in this document is obsolete and should not be used for new development.
SelectDialogItemText
To select and highlight text contained in an editable text item, use theSelectDialogItemText
procedure. TheSelectDialogItemText
procedure
is also available as theSelIText
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 theitemNo
parameter is an editable text item that contains text, theSelectDialogItemText
procedure sets the text selection range to extend from
the character position specified in thestrtSel
parameter up to but not including the character position specified in theendSel
parameter. The selection range is highlighted unlessstrtSel
equalsendSel
, 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 theendSel
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.