Re: makeFirstResponder NOT working
Re: makeFirstResponder NOT working
- Subject: Re: makeFirstResponder NOT working
- From: email@hidden
- Date: Wed, 29 Sep 2004 20:23:47 -0300
I've tried something different:
Since I subclassed the NSWindow class I decided to override the
makeFirstResponder method and in it I take some precautions and in case a
certain condition is TRUE I am sending the
[super makeFirstResponder: textField1] message. Well, it is NOT working as I
wish, but it is sending the message. Now what happens is that the First
Responder is being switched to textField1, but the NSTextView in use has all
the formatting and behavior of the last edited NSTextField and NOT the
textField1's.
Any clues as to why this is happening?
Since I have an NSLog inside my makeFirstResponder code, it is showing that the
message is being sent to an NSTextView object and NOT to an NSTextField's. Why?
Thanks.
Marcos
Citando Eric Ocean <email@hidden>:
> That's probably why the performSelector: runs when you close the
> window: modal windows use a different run loop, I believe, and
> performSelector: gets added to the main run loop.
>
> My guess is that your makeFirstResponder: is either:
>
> a) succeeding, and then Cocoa is choosing a different responder after
> that, or
> b) failing, in which case you need to track down why the textField
> isn't giving up its responder status
>
> My guess is that it's the latter, since it occurs when you press
> Return; somehow, the text field isn't giving up its responder status
> (you're not leaving it before you run your action), but I don't know
> why.
>
> We need more info.
>
> Regards,
>
> Eric Ocean
>
> On Sep 29, 2004, at 3:14 PM, email@hidden wrote:
>
> > The only thing that may be relevant is that I am using
> > [NSAPP runModalForWindow: myWindow]
> > to load the Window. Do you think it could the reason for the problem?
> >
> >
> > Citando Matt Neuburg <email@hidden>:
> >
> >> On or about 9/29/04 1:49 PM, thus spake "email@hidden"
> >> <email@hidden>:
> >>
> >>> Tried it, but it did not solve the problem
> >>
> >> Then something else is going on that you are not telling, since it
> >> works
> >> fine here. I made a test project before sending you my reply. m.
> >>
> >>> Citando Matt Neuburg <email@hidden>:
> >>>
> >>>> On Wed, 29 Sep 2004 14:31:02 -0300, email@hidden said:
> >>>>> I have a Window and in it I have 3 NSTextFields and 2 NSButtons.
> >>>>> My OK
> >>>>> Button has \r for its key equivalent.
> >>>>>
> >>>>> Well, I would like to make the first NSTextField the First
> >>>>> Responder
> >> after I
> >>>>> click the OK Button or press the RETURN key. The code that will be
> >> executed
> >>>>> when I either click the OK button or type the RETURN key has the
> >> following
> >>>>> statement:
> >>>>>
> >>>>> [[self window] makeFirstReponder: textField1];
> >>>>>
> >>>>> The thing is when I click the OK button it all works just fine,
> >>>>> BUT when
> >> I
> >>>>> press the RETURN key, the statemente above is not respected by
> >>>>> COCOA and
> >>>>> the First Responder is the last NSTextField edited and NOT the
> >>>>> First
> >>>>> NSTextField.
> >>>>>
> >>>>> How can I tell COCOA that I want the First Responder to be the
> >>>>> first
> >>>>> NSTextField either when the user clicks the OK button or when the
> >>>>> user
> >>>>> presses the RETURN key, which is the OK button's key equivalent?
> >>>>
> >>>> Use delayed performance. There need not be any real delay. So:
> >>>>
> >>>> [[sender window]
> >>>> performSelector:@selector(makeFirstResponder:)
> >>>> withObject:textField1
> >>>> afterDelay:0];
> >>
> >> --
> >> matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
> >> pantes anthropoi tou eidenai oregontai phusei
> >> AppleScript: the Definitive Guide! NOW SHIPPING...! (Finally.)
> >> http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
> >> Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
> >>
> >>
> >>
> >>
> >
> >
> > _______________________________________________________________________
> > ____________
> > Acesse nosso portal www.click21.com.br
> >
> > Porque internet grátis, nem a Embratel pode fazer mais barato. Mas
> > pode fazer melhor.
> >
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Cocoa-dev mailing list (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> > email@hidden
> >
> > This email sent to email@hidden
> >
>
>
___________________________________________________________________________________
Acesse nosso portal www.click21.com.br
Porque internet grátis, nem a Embratel pode fazer mais barato. Mas pode fazer melhor.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden