Re: When has a field changed?

2011-10-26 Thread James Hurley
> 
> Message: 10
> Date: Wed, 26 Oct 2011 15:05:09 -0700
> From: Pete 
> To: How to use LiveCode 
> Subject: Re: When has a field changed?
> Message-ID:
>   
> Content-Type: text/plain; charset=windows-1252

[snip]

>> 
>> On Oct 26, 2011, at 11:29 AM, Pete wrote:
>> 
>>> Hi Ken,
>>> This took me by surprise so I just did a test.  Pasted text into a field
>>> then clicked on another field on the card and I did get a closeField, so
>>> maybe this was a bug that has been fixed?  LC 4.6.3/OS X 10.6.8


Hi Pete,

The bug, or questionable behavior, was not that the closeField message was sent 
when the field is change and then the user clicks in another FIELD. That works 
as expected. The puzzle was when one click on a BUTTON. This did not change the 
focus from the changed field. It would be necessary to insert a "focus on 
nothing" or "select empty" in the button script to trigger the closeField 
message. 

(My personal preference is for "focus on nothing". Less emotional strain on the 
button.)

Jim Hurley
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-26 Thread Pete
I'm glad they fixed it, 'cause that didn't seem right!
Pete
Molly's Revenge 




On Wed, Oct 26, 2011 at 2:44 PM, Ken Ray  wrote:

>
> On Oct 26, 2011, at 11:29 AM, Pete wrote:
>
> > Hi Ken,
> > This took me by surprise so I just did a test.  Pasted text into a field
> > then clicked on another field on the card and I did get a closeField, so
> > maybe this was a bug that has been fixed?  LC 4.6.3/OS X 10.6.8
>
> Well whaddaya know? You're right…
>
> (I can now cross that off my list…)
>
> :D
>
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: k...@sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-26 Thread Ken Ray

On Oct 26, 2011, at 11:29 AM, Pete wrote:

> Hi Ken,
> This took me by surprise so I just did a test.  Pasted text into a field
> then clicked on another field on the card and I did get a closeField, so
> maybe this was a bug that has been fixed?  LC 4.6.3/OS X 10.6.8

Well whaddaya know? You're right… 

(I can now cross that off my list…)

:D


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

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-26 Thread Bob Sneidar
How about inserting the mouseUp handler into the frontScript. That should run 
before the button script then. Make sure to pass mouseUp though! Here is what I 
did:

Create a button called btnFrontScript
in the script of that button put
on mouseUp
  focus on nothing
  pass mouseUp
end mouseUp

in the preOpencard (or preOpenstack) handler put
insert the script of button "btnFrontScript" into front

Budda bing, budda boom, Bob's yer Uncle. The closeField happens before the 
button script. Yes? 

Bob


On Oct 26, 2011, at 9:32 AM, Pete wrote:

> I guess that works but it means the button script will execute before the
> focus on nothing in the card script which could be an issue, depending on
> the application requirements.
> Pete
> Molly's Revenge 
> 
> 
> 
> 
> On Wed, Oct 26, 2011 at 9:09 AM, Bob Sneidar  wrote:
> 
>> 
>> 
>> As I said in another post, if you trap for mouseUp in the card or stack,
>> set the focus to nothing, then pass mouseup, and remember to pass mouseUp in
>> all your button handlers, everything will work the way you would expect it
>> to.
>> 
>> Bob
>> 
>> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-26 Thread Pete
I guess that works but it means the button script will execute before the
focus on nothing in the card script which could be an issue, depending on
the application requirements.
Pete
Molly's Revenge 




On Wed, Oct 26, 2011 at 9:09 AM, Bob Sneidar  wrote:

>
>
> As I said in another post, if you trap for mouseUp in the card or stack,
> set the focus to nothing, then pass mouseup, and remember to pass mouseUp in
> all your button handlers, everything will work the way you would expect it
> to.
>
> Bob
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-26 Thread Pete
Hi Ken,
This took me by surprise so I just did a test.  Pasted text into a field
then clicked on another field on the card and I did get a closeField, so
maybe this was a bug that has been fixed?  LC 4.6.3/OS X 10.6.8
Pete
Molly's Revenge 




On Tue, Oct 25, 2011 at 7:02 PM, Ken Ray  wrote:

>
>  However it's still not bulletproof, however, because you can paste text
> from the clipboard into a field and then click out of it and the field does
> NOT receive a closeField; it receives and exitField instead.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-26 Thread Bob Sneidar
Hi Jacque. I verified yesterday that the issue still exists. Apparently, since 
a button does not gain focus in a Macintosh UI, the field never loses focus, 
hence no closefield. There is a note about it in the help I think. 

As I said in another post, if you trap for mouseUp in the card or stack, set 
the focus to nothing, then pass mouseup, and remember to pass mouseUp in all 
your button handlers, everything will work the way you would expect it to. 

Bob


On Oct 25, 2011, at 4:57 PM, J. Landman Gay wrote:

> On 10/25/11 6:48 PM, James Hurley wrote:
>> I worry about the size of the field text that it would be hashing. It
>> would be book length.
>> 
>> I don't have that much in there at present, so I can't test it, but
>> that is the ultimate goal.
> 
> I'd just use closefield myself. The bug with the buttons was a problem for a 
> long time, but I thought it was fixed. It's been a while, but last time I 
> checked I was getting appropriate closefield messages. If you find that you 
> aren't, turn off traversalOn on your button and it should bypass the bug.
> 
> Trapping closefield is way easier than all that scripting.
> 
> -- 
> Jacqueline Landman Gay | jac...@hyperactivesw.com
> HyperActive Software   | http://www.hyperactivesw.com
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread J. Landman Gay

On 10/25/11 11:24 PM, James Hurley wrote:


It appears to make no difference whether the traversalOn is true or
false for the button, which seems a bit odd.


Yeah. I misspoke. It's auto-hilite that matters. But then you have to 
write your own hiliting handlers, so the focus solution is much better.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread James Hurley
Thanks all. Problem solved. 

The closeField is triggered only when the field is changed and the focus is 
changed to something outside the field.

The only problem is when the next selection is a button (on the Mac at least) 
the focus remains in the field.

The work around, as several pointed out, is either  "select empty" or "focus on 
nothing" in the button scripts. (A bit of a nuisance.)

It appears to make no difference whether the traversalOn is true or false for 
the button, which seems a bit odd.

Jim Hurley
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread Ken Ray

On Oct 25, 2011, at 7:30 PM, Keith (Gulf Breeze Ortho Lab) wrote:

> Hi All,
> 
> Was following this thread and tried the instructions (see below),  just for 
> the fun of it, and it worked fine. I set a "bogus" field so that it was not 
> visible, then simply set the focus to this hidden field upon mouseUp. Works 
> like a charm and activates the closeField of the desired field…

This is the same as issuing "select empty" or "focus on " - in 
both cases it forces the closeField (or exitFIeld message if the field hasn't 
changed) to the target field. However it's still not bulletproof, however, 
because you can paste text from the clipboard into a field and then click out 
of it and the field does NOT receive a closeField; it receives and exitField 
instead. So Mark's approach that he posted (with or without the MD5 hash) is 
probably the best: grab either the field contents or an MD5digest of the 
contents on open field, and then check the same thing on closeField AND 
exitField to let you know if something's changed. 

Also note that even THAT is not bulletproof (since if you have messages locked 
during any of this you may/may not get the messages you're looking for), but 
it's about as close as you can get. 

:D


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

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread Keith (Gulf Breeze Ortho Lab)

Hi All,

Was following this thread and tried the instructions (see below),  just for 
the fun of it, and it worked fine. I set a "bogus" field so that it was not 
visible, then simply set the focus to this hidden field upon mouseUp. Works 
like a charm and activates the closeField of the desired field...


Cheers,

- Boo

-Original Message- 
From: Bob Sneidar

Sent: Tuesday, October 25, 2011 7:08 PM
To: How to use LiveCode
Subject: Re: When has a field changed?

Actually, the workaround I was thinking of trapped mouseUp in the card or 
stack handler, then used the command focus on nothing. This will force the 
loss of focus by the field thereby forcing a closeField to be sent to the 
field that lost the focus.


This way you can use closeField in fields, and still trap for those 
mouseups. Just be sure to pass mouseUp in all of your button handlers and 
you are good to go!


Bob


On Oct 25, 2011, at 4:24 PM, James Hurley wrote:


Thanks all for the info about the effect of closeField.

I have assumed that it was called only when a field is closed.

As you point out  it is also called when the field loses focus.

It appears that that will happen when one clicks in another field or on 
the card, BUT not when one immediately clicks on another button.


That would be a problem in my application. The user could change the field 
and then immediately click a button, a button that will not see the effect 
of the chance in the field.


My tortured script at least sends the "change" message as soon as the 
mouse leave the field.


Jim
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your 
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode 



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread Bob Sneidar
Actually, the workaround I was thinking of trapped mouseUp in the card or stack 
handler, then used the command focus on nothing. This will force the loss of 
focus by the field thereby forcing a closeField to be sent to the field that 
lost the focus. 

This way you can use closeField in fields, and still trap for those mouseups. 
Just be sure to pass mouseUp in all of your button handlers and you are good to 
go!

Bob


On Oct 25, 2011, at 4:24 PM, James Hurley wrote:

> Thanks all for the info about the effect of closeField. 
> 
> I have assumed that it was called only when a field is closed.
> 
> As you point out  it is also called when the field loses focus.
> 
> It appears that that will happen when one clicks in another field or on the 
> card, BUT not when one immediately clicks on another button.
> 
> That would be a problem in my application. The user could change the field 
> and then immediately click a button, a button that will not see the effect of 
> the chance in the field.
> 
> My tortured script at least sends the "change" message as soon as the mouse 
> leave the field.
> 
> Jim
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread Pete
James,
The button click/closeField problem happens because, on OS X anyway, the
filed doesn;t lose focus when you click on the button (you'll see the cursor
is still in it).  Put "focus on nothing" at the top of your button's
mouseDown handler.  That removes focus from the field thus causing the
closeField event to happen if the content changed, or exitField if nothing
changed.

Not sure if this has been mentioned in this thread but you don't get a
closeField if you change a field's contents by script, which may or may not
be a problem depending on your application.  The workaround is to send
closeField to the field in your script.

Hope that helps,

Pete
Molly's Revenge 




On Tue, Oct 25, 2011 at 4:24 PM, James Hurley wrote:

> Thanks all for the info about the effect of closeField.
>
> I have assumed that it was called only when a field is closed.
>
> As you point out  it is also called when the field loses focus.
>
> It appears that that will happen when one clicks in another field or on the
> card, BUT not when one immediately clicks on another button.
>
> That would be a problem in my application. The user could change the field
> and then immediately click a button, a button that will not see the effect
> of the chance in the field.
>
> My tortured script at least sends the "change" message as soon as the mouse
> leave the field.
>
> Jim
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread Terry Judd
In the button script you could put "select empty" in the first line. That 
should cause the field's closeField handler to fire before the rest of the 
button script.

Terry...


On 26/10/2011, at 10:48 AM, James Hurley wrote:

Mark,

Well there's another RR command (md5hash)  I was unaware of.

I worry about the size of the field text that it would be hashing. It would be 
book length.

I don't have that much in there at present, so I can't test it, but that is the 
ultimate goal.

Jim


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Dr Terry Judd
Senior Lecturer in Medical Education
Medical Eduction Unit
Faculty of Medicine, Dentistry & Health Sciences
The University of Melbourne



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread J. Landman Gay

On 10/25/11 6:48 PM, James Hurley wrote:

I worry about the size of the field text that it would be hashing. It
would be book length.

I don't have that much in there at present, so I can't test it, but
that is the ultimate goal.


I'd just use closefield myself. The bug with the buttons was a problem 
for a long time, but I thought it was fixed. It's been a while, but last 
time I checked I was getting appropriate closefield messages. If you 
find that you aren't, turn off traversalOn on your button and it should 
bypass the bug.


Trapping closefield is way easier than all that scripting.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread James Hurley
Mark,

Well there's another RR command (md5hash)  I was unaware of.

I worry about the size of the field text that it would be hashing. It would be 
book length.

I don't have that much in there at present, so I can't test it, but that is the 
ultimate goal.

Jim


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



Re: When has a field changed?

2011-10-25 Thread Mark Schonewille
Hi James,

In addition to my previous field script, for your button:

on mouseUp
  if the changed of fld "Whatever" is true then
// continue
  end if
end mouseUp

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Become our partner in sales http://qery.us/16r Start selling Color Converter 
today. 20% commission!

On 26 okt 2011, at 01:24, James Hurley wrote:

> Thanks all for the info about the effect of closeField. 
> 
> I have assumed that it was called only when a field is closed.
> 
> As you point out  it is also called when the field loses focus.
> 
> It appears that that will happen when one clicks in another field or on the 
> card, BUT not when one immediately clicks on another button.
> 
> That would be a problem in my application. The user could change the field 
> and then immediately click a button, a button that will not see the effect of 
> the chance in the field.
> 
> My tortured script at least sends the "change" message as soon as the mouse 
> leave the field.
> 
> Jim



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread Mark Schonewille
James,

// this is a field script, providing
// a safe way to check if a field has changed
local lHash
local lHasChanged

on openField
  put md5Digest(the text of me) into lHash
  pass openField
end openField

on closeField
  checkHash
  pass closeField
end closeField

// depending on the purpose of your field
// you may or may not want to include ths handler
on exitField
  checkHash
  pass exitField
end exitField

// alter this handler as needed
private command checkHash
  put md5Digest(the text of me) into myHash
  put (myHash is not lHash) into lHasChanged
  if lHasChanged then
send "mouseUp" to btn ProcessChanges
  end if
end checkHash

getProp changed theCurret
  if theCurrent is true then
return (md5Digest(the text of me)) is lHash
  else
return (lHasChanged is true)
  end if
end changed

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Become our partner in sales http://qery.us/16r Start selling Color Converter 
today. 20% commission!

On 25 okt 2011, at 23:21, James Hurley wrote:

> I have a text field (unlocked) that the user can edit, but  I want to know 
> when and to deal with the changes.
> 
> Here is what I have come up with, something of a kludge. Is there a cleaner 
> way?
> 
> on mouseEnter --Enter the field
>   set the textChange of me to false
> end mouseEnter
> 
> on rawkeydown tKey
>   if the textChange of me is true then
>  pass rawKeyDown
>   else
>  set the textChange of me to true
>  pass rawKeyDown
>   end if
> end rawKeyDown
> 
> on mouseLeave
>   if the textChange of me is false then 
>  exit mouseLeave
>   else
>  send "mouseUP" to button "ProcessChanges" --This is where the change is 
> dealt with.
>   end if
> end mouseLeave
> 
> 
> Jim Hurley


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: When has a field changed?

2011-10-25 Thread James Hurley
Thanks all for the info about the effect of closeField. 

I have assumed that it was called only when a field is closed.

As you point out  it is also called when the field loses focus.

It appears that that will happen when one clicks in another field or on the 
card, BUT not when one immediately clicks on another button.

That would be a problem in my application. The user could change the field and 
then immediately click a button, a button that will not see the effect of the 
chance in the field.

My tortured script at least sends the "change" message as soon as the mouse 
leave the field.

Jim
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: When has a field changed?

2011-10-25 Thread John Dixon

look at 'closeField' in the dictionary...
Dixie

> Subject: When has a field changed?
> From: jhurley0...@sbcglobal.net
> Date: Tue, 25 Oct 2011 14:21:56 -0700
> To: use-livecode@lists.runrev.com
> 
> I have a text field (unlocked) that the user can edit, but  I want to know 
> when and to deal with the changes.
> 
> Here is what I have come up with, something of a kludge. Is there a cleaner 
> way?
> 
> on mouseEnter --Enter the field
>set the textChange of me to false
> end mouseEnter
> 
> on rawkeydown tKey
>if the textChange of me is true then
>   pass rawKeyDown
>else
>   set the textChange of me to true
>   pass rawKeyDown
>end if
> end rawKeyDown
> 
> on mouseLeave
>if the textChange of me is false then 
>   exit mouseLeave
>else
>   send "mouseUP" to button "ProcessChanges" --This is where the change is 
> dealt with.
>end if
> end mouseLeave
> 
> 
> Jim Hurley
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
  
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: When has a field changed?

2011-10-25 Thread John Dixon

'closeField' is your friend here... 
Dixie

> Subject: When has a field changed?
> From: jhurley0...@sbcglobal.net
> Date: Tue, 25 Oct 2011 14:21:56 -0700
> To: use-livecode@lists.runrev.com
> 
> I have a text field (unlocked) that the user can edit, but  I want to know 
> when and to deal with the changes.
> 
> Here is what I have come up with, something of a kludge. Is there a cleaner 
> way?
> 
> on mouseEnter --Enter the field
>set the textChange of me to false
> end mouseEnter
> 
> on rawkeydown tKey
>if the textChange of me is true then
>   pass rawKeyDown
>else
>   set the textChange of me to true
>   pass rawKeyDown
>end if
> end rawKeyDown
> 
> on mouseLeave
>if the textChange of me is false then 
>   exit mouseLeave
>else
>   send "mouseUP" to button "ProcessChanges" --This is where the change is 
> dealt with.
>end if
> end mouseLeave
> 
> 
> Jim Hurley
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
  
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread Klaus on-rev
Hi James,

Am 25.10.2011 um 23:21 schrieb James Hurley:

> I have a text field (unlocked) that the user can edit, but  I want to know 
> when and to deal with the changes.
> Here is what I have come up with, something of a kludge. Is there a cleaner 
> way?
> 
> on mouseEnter --Enter the field
> ...
> end mouseLeave

Maybe catching the fields "closefield" message could do what you need?

>From the docs:
"closefield"
Sent to a field when the focus is being removed from that field and the field's 
content has changed.

> Jim Hurley

Best

Klaus

--
Klaus Major
http://www.major-k.de
kl...@major.on-rev.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread Bob Sneidar
yes. on closeField. However be aware that clicking a button before tabbing out 
of the field will NOT send a closeField to an edited field. Someone sent me a 
workaround for that, but I cannot find it right now. I am sure it is in the 
archives. Note that exitField is sent when a field loses focus, whether any 
edits were made or not. CloseField only gets sent when the field has been 
edited. 

I will say that validations on leaving a field can be dicey. Let's say a field 
contains the value "Bears". Later you create a validation that only allows a 
subset of dog breeds, and you validate upon exit whether or not anything has 
changed. Empty is not a valid entry. You will end up locking your user into the 
field and the only way out is to enter a random dog breed that may not apply, 
but is the only way out. 

I would only use what I call mid-validations (as opposed to pre-validations to 
precheck and format data before putting it into a field or post-validations to 
pre-check or format data before writing it to a database) to do things like 
phone number formatting, zip code formatting, upper and title case formatting 
etc. Nothing that will halt the user and demand he do something different. Just 
my 2¢

Bob


On Oct 25, 2011, at 2:21 PM, James Hurley wrote:

> I have a text field (unlocked) that the user can edit, but  I want to know 
> when and to deal with the changes.
> 
> Here is what I have come up with, something of a kludge. Is there a cleaner 
> way?
> 
> on mouseEnter --Enter the field
>   set the textChange of me to false
> end mouseEnter
> 
> on rawkeydown tKey
>   if the textChange of me is true then
>  pass rawKeyDown
>   else
>  set the textChange of me to true
>  pass rawKeyDown
>   end if
> end rawKeyDown
> 
> on mouseLeave
>   if the textChange of me is false then 
>  exit mouseLeave
>   else
>  send "mouseUP" to button "ProcessChanges" --This is where the change is 
> dealt with.
>   end if
> end mouseLeave
> 
> 
> Jim Hurley
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: When has a field changed?

2011-10-25 Thread Joe Lewis Wilkins
Sorry to say Jim, but I had the same "problem" on my hands last year and ended 
up doing pretty much as you have done, but I never asked the list for help, so 
I'll be interested in seeing where this leads. (smile)

Joe Wilkins
Architect

On Oct 25, 2011, at 2:21 PM, James Hurley wrote:

> I have a text field (unlocked) that the user can edit, but  I want to know 
> when and to deal with the changes.
> 
> Here is what I have come up with, something of a kludge. Is there a cleaner 
> way?
> 
> on mouseEnter --Enter the field
>   set the textChange of me to false
> end mouseEnter
> 
> on rawkeydown tKey
>   if the textChange of me is true then
>  pass rawKeyDown
>   else
>  set the textChange of me to true
>  pass rawKeyDown
>   end if
> end rawKeyDown
> 
> on mouseLeave
>   if the textChange of me is false then 
>  exit mouseLeave
>   else
>  send "mouseUP" to button "ProcessChanges" --This is where the change is 
> dealt with.
>   end if
> end mouseLeave
> 
> 
> Jim Hurley
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode