_

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
uneu
Posts: 96
Joined: Wed Dec 07, 2011 11:45 pm
Contact:

_

Post by uneu » Fri Dec 30, 2011 10:16 pm

_
Last edited by uneu on Sat Jan 07, 2012 7:32 pm, edited 1 time in total.

sgilito
Posts: 6
Joined: Thu Jan 05, 2012 4:46 pm

How do I detect field change?

Post by sgilito » Thu Jan 05, 2012 5:24 pm

Hi,

I looking for an "on Changed" field event, to do an action when the field value change.

Any idea to do this?

Thanks in advance.

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

Re: How do I detect field change?

Post by Klaus » Thu Jan 05, 2012 5:46 pm

Hi sglito,
sgilito wrote:I looking for an "on Changed" field event, to do an action when the field value change.
You need to trap the "closefield" message ideally in the script of htat field(s), check the dictionary for more info!

From the docs:
"Sent to a field when the focus is being removed from that field and the field's content has changed."
So this might be what you are looking for.


Best

Klaus

sgilito
Posts: 6
Joined: Thu Jan 05, 2012 4:46 pm

Re: detect touch of 2 controls?

Post by sgilito » Fri Jan 06, 2012 4:09 pm

Thanks Klaus,

I need to trap when the field change in any character (without lost field focus). It's for a dynamic list search depends of a field value, for example in a client list when I type "J" display all names begining with "J", when I type more characters the list is filtered for each one, finaly if the field value is "JAMES" then list show all the client names begining with "JAMES".

Regards.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: detect touch of 2 controls?

Post by jmburnod » Fri Jan 06, 2012 7:29 pm

Hi sgilito,

I think you need something like that (no iPad tested)

Code: Select all

on keydown pKey
   put pKey after fld "fType"
   put fld "fList" into tCont
   put fld "fType"&"*" into tFilter
   filter tCont with tFilter
   put tCont into fld "fFound"
end keydown
Best regards

Jean-Marc
https://alternatic.ch

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: detect touch of 2 controls?

Post by FireWorx » Fri Jan 06, 2012 9:18 pm

Nice sgilito,
So how do we go about refreshing the fFound field when the user uses the back space key or delete key because he misspelled a word? The delete key doesn't trigger the keydown pkey script. I played around but didn't find the right script for that part of it. Your script worked well other than that. Nice thread although it may have to be moved it oesn't seem to relate to the title "detect touch 2 Controls.
=] Dave

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: detect touch of 2 controls?

Post by jmburnod » Fri Jan 06, 2012 10:44 pm

Hi
The delete key doesn't trigger the keydown pkey script
Yes. rawkeydown is the way

Code: Select all

on rawkeydown pRawKey
   put pRawKey
end rawkeydown
Nice thread although it may have to be moved it oesn't seem to relate to the title "detect touch 2 Controls
Yes.

Best regards

Jean-Marc
https://alternatic.ch

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: _

Post by FireWorx » Sun Jan 08, 2012 2:11 am

Cool so yes that helped. Here is the script that makes for a pretty nice "auto populate" field when filtering based on a second hidden field of values.

on Keydown pKey
   put pKey after fld "fType"
   put fld "fList" into tCont
   put fld "fType"&"*" into tFilter
   filter tCont with tFilter
   put tCont into fld "fFound"
end Keydown

on rawKeyUp theKeyNumber
if theKeyNumber is 65288 then ## the delete key is being pressed
 put fld "fList" into tCont
   put fld "fType"&"*" into tFilter
   filter tCont with tFilter
   put tCont into fld "fFound"
else pass rawKeyUp -- don't forget this!
end rawKeyUp

Post Reply