Re: Working with text selections in Xpress
Re: Working with text selections in Xpress
- Subject: Re: Working with text selections in Xpress
- From: Michael Turner <email@hidden>
- Date: Tue, 13 Nov 2001 10:02:23 -0400
>
Is there a way of ensuring that you are referring to a chunk of text that is
>
highlighted rather than a text box? So that you don't end up processing a
>
large
>
amount of text should you inadvertently start the script when you have a
>
text
>
box selected (that would also be a selection would it?)
>
Fred
Fred,
Yes, users will hit the script while they have the wrong tool selected.
You can use
set tool mode to contents mode
and
set tool mode to drag mode
To ensure that you have the text selection tool enabled (first one).
Or the drag tool (second line). Note that these commands take
measurable TIME.
While in content mode, you can check that there is a selection
like this:
set currentSelection to current box
if currentSelection = null then
display dialog "No selection, try again."
return
end if
I suppose you could test the range of the selection directly.
When a box is selected in content mode, but there is not a text selection,
then there is an insertion point. You might test for that if you find
this test insufficient.
/Michael