SelectWordAt in a Cell
Posted: Sat Apr 01, 2006 7:49 am
I've recently started converting my chat application over to using tables for displaying messages, and I've noticed something strange in regards to using SelectTextAt. Doing a SelectTextAt on a word early on in a chat session can cause an index out of bounds exception if there aren't enough lines (tables) in the document yet.
For example, if I do a SelectWordAt on the third item in a table that makes up the first line of a document, it will give an index out of bounds error on item 3. If I wait until there are three lines, then it won't... and it'll highlight the word properly.
I'm using the selectwordat function off the primary document - so there isn't a 3rd item in it at first, because the first item is the table that contains the word... but if there IS a third line, then highlighting works properly.
What should I do?
For example, if I do a SelectWordAt on the third item in a table that makes up the first line of a document, it will give an index out of bounds error on item 3. If I wait until there are three lines, then it won't... and it'll highlight the word properly.
I'm using the selectwordat function off the primary document - so there isn't a 3rd item in it at first, because the first item is the table that contains the word... but if there IS a third line, then highlighting works properly.
What should I do?