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

The sample stack

Create a stack and add a field, name the field "display".

Add some text to the field, in this example I have used the first paragraph of Alice in Wonderland, and have deliberately misspelled some of the words.

Flagging a piece of text using a chunk expression

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

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

on mouseUp

set the flagged of the selectedChunk to true

end mouseUp

The script of  the "Unflag Selection" button is

on mouseUp

set the flagged of the selectedChunk to false

end mouseUp

Now highlight a piece of text and click the "Flag Selection" button.

0 Comments

Add your comment

E-Mail me when someone replies to this comment