SelIText
SelIText
Select all or part of the text of editText item void SelIText( theDialog, theItem, rngFrom, rngTo ); DialogPtr theDialog ; the dialog containing item of interest short theItem ; item number of interest
short rngFrom ; starting position; 0=from the beginning
short rngTo ; ending position; 32767=to the end
SelIText ("Sel-eye-text") selects text of an editText item; setting up for a subsequent replacement, cut, copy, or paste operation. The specified editText
item becomes the current active item.
theDialog is the address of a 170-byte DialogRecord structure. It identifies the dialog containing the item you wish to manipulate. It's actually a
theItem identifies which item you wish to manipulate. This item becomes
the default editText item; ready for immediate keyboard input.
rngFrom and . . .
rngTo identify the desired selection range. Use rngFrom=0 and
rngTo=32767 to select all of the text in cases where you expect the
user will want to replace it.
and extends up to, but not including, rngTo . The text is highlighted (or the
insertion point is displayed) immediately.
A common operation is to preselect the entire text. See GetIText for an example.
Setting both rngFrom and rngTo to the same value selects nothing, but
places the insertion point (the blinking iBeam cursor) at that position. For
instance, if you expect the user to add to the end of the text, you might use:
GetDItem( myDlg, INPUT_ITEM, &iType, &iHandle, &iRect); SelIText( myDlg, INPUT_ITEM, 32767, 32767 ); ... etc ...
There is only one selection range for all items (the second call nullifies a
previous one). When the user tabs from item to item, the default selection
range is all of the text.
Note: Cut-and-paste is NOT automatically implemented; i.e., pressing C replaces the current range with the letter 'C'. If you need cut-and-paste in