Is there a Solution for this problem?

Mark Schonewille m.schonewille at economy-x-talk.com
Wed May 9 18:01:35 EDT 2007


Hi Charles,

Write an additional command that checks the contents of all fields.  
For example:

funtion checkFields
   repeat with x = 1 to number of fields of grp 1
     if fld x of grp 1 is not a number or fld x of grp 1 < 0 or fld x  
of grp 1 > 10 then
       return false
     end if
   end repeat
   return true
end checkFields

Now, when the user uses tab or return to navigate to another field,  
make the closeField handler call the function.

on closeField
   if not checkFields() then
     set the text of the target to empty
     select text of the target
   else
     pass closeField
end if

and in the calculate button, use something like this:

on mouseUp
   if checkFields() then
     -- calculate and go next cd
   else
     select text of fld 1 of grp 1
   end if
end mouseUp

Naturally, you could add a few answer dialogs with warnings and a few  
system beeps, but I wanted to keep these examples simple.

I hope this helps.

Best,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Get your store on-line within minutes with Salery Web Store software.  
Download at http://www.salery.biz

Op 6-mei-2007, om 15:06 heeft Charles Szasz het volgende geschreven:

> I have entry fields that the user fills in with numbers by using  
> the tab, return or enter keys. Each field is checked for a range of  
> scores by catching the exit or close field. If the user enters a  
> number that is above the range for the entry field, a dialog box  
> appears warning them of the mistake and puts the focus back on the  
> field.  Here is my question: I found that if the user uses the tab,  
> return or enter keys to enter the data with fields and then goes  
> back using the cursor and changes a data entry that is above above  
> the range and instead of using the above keys then uses the mouse  
> to click a Calculate button which computes the scores and goes to  
> the next card, the error box does not appear but I get an execution  
> error  in the standalone. How do you trap for this when the user  
> does not use the tab, enter or return keys but uses the mouse to  
> move the cursor to click on the calculate button?
>
>
> Charles Szasz
> cszasz at mac.com
>
>





More information about the use-livecode mailing list