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: Thu, 28 Jun 2001 19:10:48 -0500
On Thursday, June 28, 2001, at 03:43 PM, cocoa-dev-
email@hidden wrote:
I have a window with an NSTextView and a tabbed area to tab through
different controls. When the user types in text, selects it,
and clicks
a tab, the text becomes unselected. Its important that the user can
keep text selected while switching between different tabs, since those
tabs all modify the selected text, and its very annoying to
have to keep
selecting the same text repeatedly.
I was thinking a solution would be to keep track of an NSRange, and
whenever anyone clicked a tab, i would reselect the NSRange.
This sounds like a pretty good solution, although there might be
some way to have the text view maintain its selection, but I
don't know what it is. I think the easiest way to implement
this solution is to give your tab view a delegate and implement
the tabView:willSelectTabViewItem: method and read the selection
range from there, just before the user switches to another tab.
You can then restore the selection in
tabView:didSelectTabViewItem:.
--
Brian Webster
email@hidden
http://www.owlnet.rice.edu/~bwebster