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 theSelectDialogItemTextprocedure. TheSelectDialogItemTextprocedure
is also available as theSelITextprocedure.
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 theitemNoparameter is an editable text item that contains text, theSelectDialogItemTextprocedure sets the text selection range to extend from
the character position specified in thestrtSelparameter up to but not including the character position specified in theendSelparameter. The selection range is highlighted unlessstrtSelequalsendSel, 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,SelectDialogItemTextdisplays the insertion point.You can select the entire text by specifying the number 0 in the
strtSelparameter and the number 32767 in theendSelparameter.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
SelectDialogItemTextto 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.