Problems with tabbing between custom text fields
Problems with tabbing between custom text fields
- Subject: Problems with tabbing between custom text fields
- From: Alex Penner <email@hidden>
- Date: Sat, 20 Mar 2004 22:05:37 +0100
- Envelope-to: email@hidden
Hi,
I'm trying to implement custom text field that acts mostly like from
iCal or Address Book: looks normally like a label, but get a background
and border while selected.
The code works so far, if I select fields with a mouse. If I'm tabbing
between fields these draw correctly, but there is no cursor in selected
Field and I cannot input anything (just getting those "error sound" on
key press).
I'm sure this one is a pretty basic question, but I found no answer in
Cocoa Archive :-(
Thanks and best regards,
Alex
My code...
@interface LabelTextField : NSTextField
{}
@end
...
- (void)showAsLabel:(BOOL)flag{
[self setBordered:!flag];
[self setDrawsBackground:!flag];
}
- (id)initWithFrame:(NSRect)rect{
if (self = [super initWithFrame:rect])
[self showAsLabel:YES];
return self;
}
- (BOOL)becomeFirstResponder{
[self showAsLabel:NO];
[self setNeedsDisplay];
return YES;
}
- (BOOL)resignFirstResponder
{
[self showAsLabel:YES];
[self setNeedsDisplay];
return YES;
}
_______________________________________________
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.