• 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
how to intercept call to [NSTextView print:] of NSSearchfield in a toolbar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to intercept call to [NSTextView print:] of NSSearchfield in a toolbar


  • Subject: how to intercept call to [NSTextView print:] of NSSearchfield in a toolbar
  • From: Ken Victor <email@hidden>
  • Date: Mon, 27 Feb 2006 08:40:33 -0800

the "environment"

my MyWindow (a subclass of NSWindow) has an NSToolbar that contains an NSToolbarItem with an NSSearchfield as its view.

in my main nib, the Print menu item has its action set to print: in the first responder.

MyWindow has a print: method that prints the contained tableview with appropriate headers/footers and pagination.

the "problem"

if the user is entering text into the search field (or if s/he has simply tabbed into the search field) and then selects the Print menu item (or types Command-P), then the NSTextView which is the field editor for the search field gets sent the print method and proceeds to print the search field contents. what i want (and what i believe users will expect) is for print to print the table view, not the search field.

my "solution"

in MyWindow, i have overridden fieldEditor:forObject: to return MyTextView (a subclass of NSTextView) and sets it up as a field editor. MyTextView has only one method, print:, which simply calls [[self window] print: sender].

my "question"

is this the only/best way to solve my "problem"? it seems a little clumsy to me. ie, is there some other way that i could simply intercept the print message sent to the field editor?

thanx,
ken

_______________________________________________
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


  • Follow-Ups:
    • Re: how to intercept call to [NSTextView print:] of NSSearchfield in a toolbar
      • From: Jim Correia <email@hidden>
  • Prev by Date: Re: Menu Item Hot Key
  • Next by Date: Re: Help needed
  • Previous by thread: Re: Problem with copiesOnScroll of NSClipView
  • Next by thread: Re: how to intercept call to [NSTextView print:] of NSSearchfield in a toolbar
  • Index(es):
    • Date
    • Thread