• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using NSSearchField and remaining Jaguar compatible?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSSearchField and remaining Jaguar compatible?


  • Subject: Re: Using NSSearchField and remaining Jaguar compatible?
  • From: Steve Christensen <email@hidden>
  • Date: Sat, 7 Feb 2004 15:11:56 -0800

I don't know that my solution is the best one, but I just went through this very issue myself since my app needs to run on both 10.2 and 10.3.

My nib file contains a NSTextfield, and there's a corresponding NSTextField* outlet in the window controller class that manages the window. In the controller's -awakeFromNib method, I check to see if the app is running on 10.3 or later, and if so, create a NSSearchField programmatically, copying the settings from the nib's NSTextField and NSTextFieldCell. I then remove the existing NSTextField from its superview and pop in the NSSearchField. The user sees a rounded NSTextField when running on 10.2, and a NSSearchField when running on 10.3+. I'm not using the recent searches feature, so it's a pretty simple switch to support both "worlds."

steve


On Feb 6, 2004, at 6:00 PM, Michael McCracken wrote:

Hi, I'm trying to figure out the best design for using NSSearchField
(avail. only in 10.3) and remaining backwards-compatible with Jaguar.

I'm aware that this sounds like a FAQ, but previous posts I've found
have asked about getting arbitrary classes that don't exist in 10.2,
and I'm asking about getting something I've placed in a nib. Pretty
similar, but I thought there might be a different solution in this
case. So:

My idea of best solution is to have a single app that runs on both and
just provides a different UI (just an NSTextField) on Jaguar.

The search field is in a toolbar, so I will have to test availability
macros to be sure the named toolbar item is version appropriate. No
problem there.

The problem (which I posted about earlier, but can't find in the
archives, d'oh) is that my app crashes when trying to decode the nib
that contains the NSSearchField. Right now, the nib with the
NSSearchfield is my NSDocument subclass' main nib.

So, do I need to create a separate nib with the NSSearchField, and load
that separately if I'm in 10.3?

That's not too bad, but I thought my new-format nib would have taken
care of the loading problem for me, so I was wondering if there was
something else going on.

Thanks,
-mike
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Using NSSearchField and remaining Jaguar compatible? (From: Michael McCracken <email@hidden>)

  • Prev by Date: how to get a MenuItem with NSSlider and Description
  • Next by Date: NSNotificationQueue and multithreading
  • Previous by thread: Using NSSearchField and remaining Jaguar compatible?
  • Next by thread: Correct way to insert an image into NSTextView.
  • Index(es):
    • Date
    • Thread