closeField and exitField problem

Ken Ray kray at sonsothunder.com
Mon Oct 15 17:04:34 EDT 2007


On Mon, 15 Oct 2007 19:48:36 +0100, Dave wrote:

> Hi,
> 
> I asked about this problem ages ago, but didn't get a response, so 
> I'm asking again as it's just come up again!
> 
> I am running on a Mac. If the user fills in a field and then tabs out 
> of the field, either a closeField or exitField message is sent to the 
> field. All well and good. However, if the user clicks on a button, 
> nether messages are sent!
> 
> This effectively means that it\s impossible to ensure that a field is 
> valid using these messages, so what's the use of having them or am I 
> missing something.

The messages are useful, you just need to manually trigger them on 
MacOS - the easiest way (IMHO) is to issue "select empty" on a 
mouseDown. If you're not trapping mouseDown anywhere this can go in the 
card/stack script:

on mouseDown
  select empty
  pass mouseDown
end mouseDown

If you *do* trap mouseDown, you can set up a frontscript that does the 
same thing. Create an object (say, a button), and give it a name (like 
"FS") and give it the script above. Then at some point prior to the 
user being able to enter data, execute:

insert script of btn "FS" into front

Doing a "select empty" forces the cursor out of the field and should 
trigger an exitField or closeField depending on whether the contents 
have changed or not.

HTH,

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list