|
From: Scott H. <sc...@af...> - 2006-10-18 22:21:38
|
It seems that tab and shift+tab also fire the action.
There is alternative though. Textfields post an
NSTextField.NSControlTextDidEndEditingNotification when they stop
editing. This notification's userInfo dictionary contains an entry
with the key "NSTextMovement". This value is
NSTextMovement.NSReturnTextMovement, it means the textfield stopped
editing as a result of an enter key press. So here's what it might
look like.
//
// Method that is observing NSTextField.NSControlTextDidEndEditingNotification
// on your textfield.
//
private function textfieldDidEndEditing(ntf:NSNotification):Void {
var movement:NSTextMovement =
NSTextMovement(ntf.userInfo.objectForKey("NSTextMovement");
if (movement == NSTextMovement.NSReturnTextMovement) {
// do action!
}
}
On 18/10/06, Scott Hyndman <sc...@af...> wrote:
> Ah, I just remembered.
>
> NSTextField's action method is called when enter is pressed. So just do this:
>
> txtField.setTarget(controller);
> txtField.setAction("actionMethod");
>
> Tada!
>
> Scott
>
> On 18/10/06, Tiago Vale <tia...@gm...> wrote:
> > So you are saying that I have to manage to catch a
> > NSTextField.NSControlTextDidChangeNotification?
> >
> >
> > On 10/18/06, Scott Hyndman < sc...@af...> wrote:
> > > Oh, that doesn't answer your question. Let me think for a few minutes.
> > > There is a way to do this.
> > >
> > > Scott
> > >
> > > On 18/10/06, Scott Hyndman <sc...@af...> wrote:
> > > > You're in luck. There's a really easy way to do this.
> > > >
> > > > NSTextFields will post an
> > > > NSTextField.NSControlTextDidChangeNotification whenever
> > their text
> > > > changes.
> > > >
> > > > Scott
> > > >
> > > > On 18/10/06, Tiago Vale < tia...@gm...> wrote:
> > > > > Heres what I want to do,
> > > > >
> > > > > I have a console that whenever the user presses the enter key some
> > action
> > > > > occur.
> > > > > Im using the NSTextview and I dont see a easy way to do it:
> > > > >
> > > > > mytextfield.onChanged = function () bla, bla bal....
> > > > >
> > > > > got it?
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On 10/18/06, Scott Hyndman < sc...@af...> wrote:
> > > > > > Could you rephrase the question? I don't understand.
> > > > > >
> > > > > > Scott
> > > > > >
> > > > > > On 18/10/06, Tiago Vale < tia...@gm...> wrote:
> > > > > > > Hi all,
> > > > > > >
> > > > > > >
> > > > > > > Is there a simple way to bind the Key.Enter to textfield
> > onchanged?
> > > > > > >
> > > > > > > Still waiting for that NSTableView ;)
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Cheers Tiago Janz
> > > > > > >
> > > > >
> > -------------------------------------------------------------------------
> > > > > > > Using Tomcat but need to do more? Need to support web services,
> > > > > security?
> > > > > > > Get stuff done quickly with pre-integrated technology to make your
> > job
> > > > > > > easier
> > > > > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > > > > Geronimo
> > > > > > >
> > > > >
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > > > > >
> > > > > > > _______________________________________________
> > > > > > > actionstep-core mailing list
> > > > > > > act...@li...
> > > > > > >
> > > > >
> > https://lists.sourceforge.net/lists/listinfo/actionstep-core
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > -------------------------------------------------------------------------
> > > > > > Using Tomcat but need to do more? Need to support web services,
> > security?
> > > > > > Get stuff done quickly with pre-integrated technology to make your
> > job
> > > > > easier
> > > > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > Geronimo
> > > > > >
> > > > >
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > > > > _______________________________________________
> > > > > > actionstep-core mailing list
> > > > > > act...@li...
> > > > > >
> > > > >
> > https://lists.sourceforge.net/lists/listinfo/actionstep-core
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Cheers Tiago Janz
> > > > >
> > -------------------------------------------------------------------------
> > > > > Using Tomcat but need to do more? Need to support web services,
> > security?
> > > > > Get stuff done quickly with pre-integrated technology to make your job
> > > > > easier
> > > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > Geronimo
> > > > >
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > > >
> > > > > _______________________________________________
> > > > > actionstep-core mailing list
> > > > > act...@li...
> > > > >
> > https://lists.sourceforge.net/lists/listinfo/actionstep-core
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> > -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services, security?
> > > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > >
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > actionstep-core mailing list
> > > act...@li...
> > >
> > https://lists.sourceforge.net/lists/listinfo/actionstep-core
> > >
> >
> >
> >
> > --
> > Cheers Tiago Janz
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >
> > _______________________________________________
> > actionstep-core mailing list
> > act...@li...
> > https://lists.sourceforge.net/lists/listinfo/actionstep-core
> >
> >
> >
>
|