Handler behaving oddly

Mark Smith mark at maseurope.net
Wed Jul 19 04:55:28 EDT 2006


Does the handler that calls checkSize put something into fld  
"Display" when checkSize returns? If so, despite the 'exit to top',  
the calling handler maybe putting the value returned from checkSize  
(ie. empty) into the field. You could put a "wait 1 second" before  
the "exit to top", and see if that's what's happening.

If it is, you could just return "error" from checkSize and let the  
calling handler deal with it.

Best,

Mark

On 19 Jul 2006, at 09:36, Ian McKnight wrote:

> 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
>
> ===============================================
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list