Syntax Error
Posted: Thu Apr 30, 2009 2:12 am
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
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