• 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
understand addSubview and Tab
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

understand addSubview and Tab


  • Subject: understand addSubview and Tab
  • From: "Simon Strandgaard" <email@hidden>
  • Date: Thu, 25 Jan 2007 11:30:40 +0100

When my program starts up then Tab changes focus to next textfield.
When invoking the buttonAction then Tab no longer has any effect.

What does it take to get Tab working?


I have read the event-handling guide, but I still don't get it. http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/chapter_6_section_5.html#//apple_ref/doc/uid/10000060i-CH7-SW9


In the rebuild method, I have tried if(last) [last setNextKeyView:v]; last = v; but Tab still does nothing.




I appreaciate your suggestions.


-- Simon Strandgaard





prompt> cat TestView.h
#import <Cocoa/Cocoa.h>

@interface TestView : NSView
-(IBAction)buttonAction:(id)sender;
@end





prompt> cat TestView.mm
#import "TestView.h"

@implementation TestView

-(void)awakeFromNib {
       [self rebuild];
}

-(void)rebuild {
       for(int i=0; i<4; ++i) {
               NSRect frame = NSMakeRect(0.f, 30.f * i, 150.f, 30.f);
               NSView* v = [[NSTextField alloc] initWithFrame:frame];
               [self addSubview: v];
       }
}

-(IBAction)buttonAction:(id)sender {
       [self removeSubviews];
       [self rebuild];
}

-(void)removeSubviews {
       id thing;
       NSEnumerator *en = [[self subviews] objectEnumerator];
       while(thing = [en nextObject]) {
               [thing removeFromSuperview];
       }
}

@end
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: understand addSubview and Tab
      • From: "Simon Strandgaard" <email@hidden>
  • Prev by Date: Re: Lucene/Cocoa integration
  • Next by Date: Completely broken XCode
  • Previous by thread: NSTextField resignFirstResponder problem.
  • Next by thread: Re: understand addSubview and Tab
  • Index(es):
    • Date
    • Thread