• 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
problem with custom nsview as first responder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with custom nsview as first responder


  • Subject: problem with custom nsview as first responder
  • From: "roberto toro" <email@hidden>
  • Date: Wed, 25 Jul 2007 15:43:46 +0100

Hello,

I'm writing a 3D mesh viewer using the document-based cocoa
application template. As most of the functions affect the viewer, I
want to have my custom nsview as first responder for the GUI's
actions. In the document's window I have MyView, and a bunch of
NSTextFields and NSPopUpButtons. There's no problem if I handle the
IBActions in MyDocument, but when I handle them at MyView, if I click
on a NSTextField I cannot select the NSPopUpButtons anymore.

This is a minimal example of the problem: I created a new
document-based application, draged a NSPopUpButton, an NSTextField and
a custom NSView. I added two actions to the FirstResponder – action1,
action2 – and I linked them to item1, item2 in the NSPopUpButton.

MyView.h
@interface MyView : NSView
{
}
-(IBAction)action1:(id)sender;
-(IBAction)action2:(id)sender;

MyView.m
-(BOOL)acceptsFirstResponder
{
      return YES;
}
- (void)drawRect:(NSRect)rect
{
}
-(IBAction)action1:(id)sender
{
      printf("1\n");
}
-(IBAction)action2:(id)sender
{
      printf("2\n");
}

And the problem: If you click in the NSPopUpButton, everything's ok.
But if you click before in the NSTextField, the actions in
NSPopUpButton will be disabled. You can re-enable the actions by
clicking in the custom view. There's no problem if actions are handled
at MyDocument.m instead.

Thanks for your help!
roberto
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Core Data, NSPredicate, and NSDates
  • Next by Date: Re: problem with custom nsview as first responder
  • Previous by thread: validating relationships
  • Next by thread: Re: problem with custom nsview as first responder
  • Index(es):
    • Date
    • Thread