I think making the field clear whenever the user clicks in it it is not
nice. If the user want to select some characters, the field clears. Maybe
you want to clear the field when the user clicks the first time (so a cursor
appears). Then the script would be:

on openField
  put empty into field "Degrees C"
  put empty into field "Degrees F"
end openField

A nice one would be:

on returnInField
  send "mouseUp" to button "Convert"
end returnInField

on enterInField
  send "mouseUp" to button "Convert"
end enterInField

So when the user presses return or enter, the convert starts.

BTW Do you know how to round numbers on a certain digits? If not, you can
use this:

set the numberFormat to "0.##"

Tim Barber wrote:
> Hi all 
> I'm just fiddling around trying to learn how to use MC.  I'm creating a simple
> temperature converter, and I've encountered a problem.
> My card consists of two fields (Degrees C and Degrees F), two labels(for the
> fields) and two buttons (Convert and Quit)
> If I understand the MetaTalk reference correctly (and it's more than likely I
> don't), an unlocked field doesn't receive mouseUp messages unless you hold
> down the ctrl key (I'm on a Mac).  How then do I script the field to clear
> itself when I click in it?  I've tried using a selectionChanged message
> handler, but it started acting weird.  Here is the code I'm using.
> on selectionChanged #or mouseUp   put empty into field "Degrees C"   put empty
> into field "Degrees F" #I want it to clear both fields   select field "Degrees
> C" end selectionChanged #or mouseUp
> My plan is that you click on either field and it clears both.  You then enter
> whichever value you have (Centigrade or Fahrenheit) into the field, and click
> the Convert button.  Depending on which field you entered, the Convert button
> calculates the result and populates the other.
> TIA 
> Tim 

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to