i’ve a textfield with binding (mytexte)
i would like to send an action every time the textfield change (i mean every time a new caracter is enter)
i tried continuously validate but it doesn’t work
Any idea ?
i’ve a textfield with binding (mytexte)
i would like to send an action every time the textfield change (i mean every time a new caracter is enter)
i tried continuously validate but it doesn’t work
Any idea ?
I think the delegate method, controlTextDidChange, is sent after each character.
Ric
Hi,
The binding is not needed for what you want, as far the the notification goes. You must use interface builder to link from the text field to the script using the ‘delegate’ option from the black drop down, then you can use:
on controlTextDidChange_(aNotification)
--your code
--you can use the binding here to deal with the text or whatever you are doing
end controlTextDidChange_
Richard
Thanks ! It’s working very well but i have a small problem.
The “on controlTextDidChange_(aNotification)” is for all the script.
But i need to have this control for each textfield in the script.
I’ve 4 textfield that i need to act separately. Each one need to send a special action when textdidchange.
Simply with
on controlTextDidChange_(aNotification)
set theObject to aNotification's |object|()
if theObject = firstTextField then
end
end controlTextDidChange_
Thanks !
But i don’t understand how to identify the object :
if theObject = firstTextField then
even if i put a log about theObject, the response is “<NSTextField: 0x200696c40>” which help me not a lot !
Is it by the name of the property and an outlet in IB ?
Is it the name of the object in the IB Identity panel ?
Is it by bending ?
I tried many things but nothing work.
It is by the name of the property and an outlet in IB.
Regards,
Thanks every body for you help !
It’s work very well. So to finalize, here is the code and IB solution
property champOld : missing value
property champNew : missing value
on controlTextDidChange_(aNotification)
set theObject to aNotification's object()
log "modif en cours"
log theObject
if theObject = champOld then
log "ok champ 1"
else
log "CHAMP NUMERO 2"
end if
end controlTextDidChange_
In IB :
i make a delegate beetwen the script and the 2 textfield
i make a outlet for the 2 textfield with name property