How to know when user has edited a field?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

How to know when user has edited a field?

Post by sritcp » Sat Oct 06, 2012 10:10 pm

I see that, on iOS, the message inputTextChanged is sent.
What about OSX? In general, how is this recognized, so the program can prompt the user to save the changes?

Thanks,
Sri.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: How to know when user has edited a field?

Post by sturgis » Sat Oct 06, 2012 10:12 pm

Not sure its in the dictionary yet, but if you have 5.5 (I think that is when it showed up) you can use the textChanged message.

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: How to know when user has edited a field?

Post by sritcp » Sat Oct 06, 2012 10:15 pm

Yes, I have LC 5.5
No, textChanged is not in the (downloaded) dictionary.

Thanks, sturgis!

Sri.

edit: not in the online dictionary either!

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to know when user has edited a field?

Post by Klaus » Sat Oct 06, 2012 10:40 pm

It is in the dictionary in LC 5.5.2.

But maybe you are looking for "closefield", which seems to be a better time to ask the user to save his changes.
If this would happen every time if a new character is entered in a field, this MIGHT disturb the user a BIT! 8)


Best

Klaus

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: How to know when user has edited a field?

Post by sritcp » Sat Oct 06, 2012 11:21 pm

Klaus:

closeField is no good when the user is filling out a form with a number of fields, e.g., Name, Date of Birth, etc.
We need to stop him only when he does something (like leaving the card) without saving the changes.

Of course, we don't disturb him after every character! I have a global variable gEdited which is initialized to false.
The textChanged message handled by the group containing the fields sets gEdited to true.
When the issue is resolved (saved or discarded), gEdited is reset to false.

Thanks,
Sri.

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: How to know when user has edited a field?

Post by sritcp » Sat Oct 06, 2012 11:22 pm

A follow-up question:
Is the textChanged message sent only on user input
or, even when the field text is changed by the program through script?

Thanks,
Sri.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: How to know when user has edited a field?

Post by sturgis » Sat Oct 06, 2012 11:45 pm

Programming also triggers textChanged. As Klaus pointed out though, if you only want to remind prompt the user after they manually change the field, closefield is the way to go.

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: How to know when user has edited a field?

Post by sritcp » Sun Oct 07, 2012 2:20 am

Yes, I see that!

Thanks,
Sri.

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to know when user has edited a field?

Post by Klaus » Sun Oct 07, 2012 10:52 am

:D

Post Reply