Re: NSTextView unselects on tab clicks...
Re: NSTextView unselects on tab clicks...
- Subject: Re: NSTextView unselects on tab clicks...
- From: Brian Webster <email@hidden>
- Date: Tue, 3 Jul 2001 15:27:42 -0500
On Tuesday, July 3, 2001, at 02:35 PM, cocoa-dev-
email@hidden wrote:
And what if it's set up like this
+-------------------------------+ +------+ +--------+ +-------+
| | | \/ \/
\-------+
| | |
|
| NSTextView | | tab
view |
| | |
|
+-------------------------------+
+-------------------------------------
You have some text selected in the text view and want what you do in
the various tab views to apply to what you have selected. Which tab
view you have shouldn't have any affect on what/whether you have text
selected in the text view. Even if you have an editable text box of
some sort in one of the tab views, that's just another, different
selection and should not drop the current selection in the text view.
I was playing around with this in IB and noticed something
interesting. I had a text view set up next to a tab view that
has a text field in it. I made a selection in the text view,
and then clicked in the text field. The selection disappeared
in the text view and the cursor appeared in the text field. If
I click in the text view, then it just places the cursor where I
clicked, but if I hit the tab key, it switches the text view to
be the first responder and highlights the previous selection.
So apparently, the text view does maintain its selection range
internally, it just doesn't display it visibly when it's not the
first responder.
The problem seems to be that clicking on a tab in a tab view
takes first responder status away from the text view and gives
it to the tab view. You can tell that the tab view is the first
responder since you can then press the arrow keys to switch
tabs. Note to Apple: there should really be some sort of visual
indication of this state. You could try subclassing NSTabView
and overriding -acceptsFirstResponder to return NO.
--
Brian Webster
email@hidden
http://www.owlnet.rice.edu/~bwebster