I am struggling with a problem related to the selection of parts of a text in a 
field. I would like to know which words are selected, that is, I would like to 
know the range of words selected. None of the functions available in LiveCode 
will do this. If I use selectedChunkI will get the range of characters in the 
selection. If I use selectedText or just the selection I will get the words 
that are selected, but not where in the range of words of the text the selected 
words are placed. 

I find this strange, as it is possible to manipulate any given word (or 
trueWord) by referring to its placement in the text by number. I can delete, 
put into, put before or after, alter style, size or font of any given word by 
referring to its position in the text by number. I would think that it would be 
possible to implement a function called selectedWords or selectedTrueWords as a 
way of getting this information.

This information is useful if you want to implement changes to the styles of 
the selected text, where textStyles report mixed. In a selection with mixed 
styles, setting the textStyle has to be done on a word by word basis (or char 
by char basis if different styles are used within a word).

Now I probably will have to use the selectedChunk, and loop through the text, 
character by character, keeping track of word delimiters to decide the range of 
words selected. I can do that, but I cannot possibly expect my students to 
really understand what they are doing, two weeks into their course. If said 
functions had been available, it would have been much easier to teach my 
students about all the powerful text handling features in LiveCode by making a 
small and powerful text editor.

Am I the only person who would like to see these functions implemented?

Best regards
Tore Nilsen
use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to