Handler behaving oddly

Ian McKnight iangmcknight at googlemail.com
Wed Jul 19 04:36:57 EDT 2006


Hi

The handler below is designed to check that a value is within a certain range.
If it is outside the range it displays the word ERROR and stops
otherwise it displays the first 10 characters in the value.

The handler behaves oddly.
Values passed to it that are within the range are handled correctly.

However, when a value is passed to it that is outside the range the
fld "Display" shows up empty. Yet when I put the line

put "Error" into message

immediately before the existing   Put "error"   the word ERROR appears
in the message box and when I type

  put "Error" into fld "Display"

into the message box, I get the expected output ie "Error" appears in the field.

I have stepped through the handler in the Debugger and the statements
execute in the correct order. I even checked that the text colour had
not been changed to white!

Any advice would be much appreciated


Thanks

Ian McKnight

===============================================

function checksize theAns
  -- check if too big or too small
  if (theAns > 10^8 -1) or (theAns < 10^(-8))
  then
    put "Error" into fld "Display"
    exit to top
  else
    set the numberformat to "0.########" -- maximum 8 places of decimals
    return (char 1 to 10 of theAns ) -- show 10 sig figs truncated
  end if
end checksize

===============================================



More information about the Use-livecode mailing list