Page 1 of 1

Syntax Error

Posted: Thu Apr 30, 2009 2:12 am
by pwr
For my first Revolution app I have the user select text from a field and the selected text displays in another field. Although this is simple enough, the selected text may use the textShift property to sub- or superscript certain characters.

Since I wanted the selected text to display in the other field correctly I used the following script to search for textShift so as to correctly display the selectedText in the second field...

on selectionChanged
--update the input unit label with the selected input unit
put the selectedText of me into field "fldSelectedInputUnit"
--test code to put in sub- and superscript
repeat with i = 1 to the number of chars in selectedText of me
if the textShift of char i of selectedText of me is not empty then
get the textShift of char i of selectedText of me
set the textShift of char i of field "fldSelectedInputUnit" to it
end if
end repeat
--end test code
--check to see that the needed data is available
--and re-calculate unit conversion
if the text of field "fldSelectedInputUnit" is not empty then
if the text of field "fldSelectedOutputUnit" is not empty then
if the text of field "fldInputValue" is a number then
ConvertUnits
end if
end if
end if
end selectionChanged

However, although the compiler has no complaints, I get a runtime error on the highlighted line. The error msg is:

field "fldInputUnits": execution error at line 7 (Chunk: can't find object), char 24

Can anyone help me correct my syntax??? Thanks in advance...pwr

Posted: Thu Apr 30, 2009 8:11 am
by Mark
Dear pwr,

The selectedText is only a reference to text, not a reference to an object. You might want to use the selectedChunk instead.

Best regards,

Mark