[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField questions

From: Dirk Lattermann
Subject: Re: NSTextField questions
Date: Mon, 16 Sep 2002 23:42:01 +0200
User-agent: Mutt/1.4i

On Mon, Sep 16, 2002 at 09:13:50PM +0200, David Ayers wrote:
> Dirk Lattermann wrote:
> >The question is: how can I figure out when an NSTextField has just
> >become the firstResponder? Is there a notification that is sent
> >in this case?
> > [...]

> [...]
> But even once he has fixed it, it is not necessarily trivial. When you 
> tell an NSWindow to make an NSTextField firstResponder through the 
> makeFirstResponder method, it ultamtliy should do this by invoking 
> NSTextField's becomeFirstResponder. It is the responsiblity of the 
> NSTextField, to propagate the firstResponder to the window's 
> fieldEditor, which is an NSTextView shared by all NSTextFields of the 
> window. Everytime another NSTextField's becomeFirstResponder is invoked, 
> it takes this shared NSTextView and sets it up for it's needs, makes it 
> firstResponder therefor the NSTextField resignsFirstResponder, before 
> the original becomeFirstResponder will return.
> I just went through describing this 

Wow. It's a bit clearer now. I was wondering why a text field gains
firstResponder status and loses it immediately again. I suspected
the field editor, but the semantics of this is rather difficult
to find out from the API specification.

> Maybe you could detail a bit more of what you want to do.

I'm currently hacking together an naive database GUI that is a little
bit like a very lightweight version of oracle's forms runtime.
Right now, it supports only text fields for items (I'm not quiet sure
how to extend this to other NSControls, because I don't see how to
"add member variables to NSControl and use functionalities of its
subclasses", but that's another issue...).
For several things, e.g. to move from one record in a block to another
by pressing a "next record" button, I need to know the active block
which is the block to which the active item (text field) belongs.
The active item is the one which has the input focus, so I'm trying
to be notified when the text field gets the input focus.

I don't know how to get this info from the window later when I need it,
for example when a click on "next record" has occured, because then,
the firstResponder has changed again.

> And I'll look into the notification bug.


> Cheers,
> Dave


reply via email to

[Prev in Thread] Current Thread [Next in Thread]