Using the flagged property in a field
The new flagged property allows you to highlight a run of characters with a red dotted underline. The is particularly useful for highlighting mistakes.
The sample stack
Flagging a piece of text using a chunk expression
You can use a chunk expression to flag any piece of text.
In this example the word 'begining' is misspelled so we want to flag is. It is the 3rd word of the field so you can do
set the flagged of word 3 of field "display" to true
You can use any chunk expression so you can flag lines, ranges of text, for example
set the flagged of line 1 of field "display" to true
set the flagged of word 3 to -1 of line 2 of field "display" to true
Flagging the selection
You can also flag, or unflag the current selection using the selectedChunk function.
Add 2 buttons to the stack, one to flag the selection and one to unflag the selection.
The script of the "Flag Selection" button is
set the flagged of the selectedChunk to true
The script of the "Unflag Selection" button is
set the flagged of the selectedChunk to false
Now highlight a piece of text and click the "Flag Selection" button.