I have made a tiny app in Xcode with a unique text field.
Is it possible to send its action continuously?
(I mean like the Safari URL field does…)
In the Attributes
inspector, click on the Continuous
checkbox (in the section labelled State
). And make sure your handler can deal with rapid repeat calling.
The continuous
attribute is already set.
The script takes 0,000493 seconds to make its calculation and after that sets the content of a label and changes the source image of a little dot (e.g. NSImageNameStatusAvailable
).
It does not work: the action is sent only at end editing.
OK, it looks like that only affects bindings.
Make your app delegate the delegate of the text field. Then add a handler like this to the app delegate:
on controlTextDidChange:notif
-- do stuff
end controlTextDidChange:
And if you need to do it for more than one field:
on controlTextDidChange:notif
set theField to notif's |object|()
if theField's isEqualTo:firstField then
[...]
-- do stuff
end controlTextDidChange:
You mean if I use bindings instead of IBOutlets, there’s no need for the delegate
and the controlTextDidChange:
handler?
I believe so. I’m still not sure why it’s not working now, though.
That’s it!
It works flawlessly!