Re: Subclassing NSTextField and IB Custom Class
Re: Subclassing NSTextField and IB Custom Class
- Subject: Re: Subclassing NSTextField and IB Custom Class
- From: Aurélien Hugelé <email@hidden>
- Date: Tue, 16 Nov 2004 19:42:05 +0100
ok, i did not "double check" ;) but the problem is not there since i did not even override any init methods, only those 2 simple methods :
- (void) awakeFromNib
{
[super awakeFromNib];
[self setObjectValue:[NSCalendarDate calendarDate]];
}
// NSControl
+ (Class) cellClass
{
return [GTKCalendarCell class];
}
any idea ?
i tried to avoid awakeFromNib overload, and put
[self setObjectValue:[NSCalendarDate calendarDate]]; in the init methods but it does not solve the problem :(
On 16 nov. 04, at 15:02, Robbie Haertel wrote:
I've never done what you said, so take my answer for what its worth:
its likely a matter of what methods you override. NSSView is much
more generic so you don't have to be as careful. NSTextField has
specific init methods (were you sure to overrid the designated
initializer and calll [super]) as well as other special methods.
I'm sure you were as careful as possible when subclassing, but I would
personally double check your code to make sure your subclass does
everything it needs to. Again, I suspect the real problem is the
init, which would explain why it works as NSView which has a different
designated initializer than NSTextField.
but I could be totally wrong!
Robbie
On Tue, 16 Nov 2004 09:54:20 +0100, Aurélien Hugelé
<email@hidden> wrote:
hi !
i often sublcass NSTableView (call this subclass GTKTableView), and use
Interface builder to design my interface.
Using "Read Files" Menu in IB, i make IB parse GTKTableView.h.
then i drag a NSTableView from IB palette to my window, i customize the
class of the dragged widget (NSTableView) to be a GTKTableView
what's nice with this, is that i can use IB to parameter my
GTKTableView with settings that are common with NSTableviews (number of
columns, type of cell, multiselection etc...)
at run time, my interface of course use my subclass, and everything is
parametered!
Today i subclassed NSTextField and did exactly the same thing than
above, but with GTKTextField.
But it does not work at run time : the NSTextField i dropped to my
window, then customized to be a GTKTextField does not appear like a
GTKTextField (GTKTextField add a sensitive zone at the right of the
textfield, a la iChat smiley's menu) but as a normal NSTextField
i know my GTKTextField code works, because if i drag a NSView instead
of a NSTextField in IB, then customize it to GTKTextField, i works
beautifuly!! (interface when loaded at runtime appears like a
GTKTextField).
But i can not enjoy IB NStextField ease of use to parameter alignement,
editable state etc...
is it a bug is IB ?
you can use NSTableView/NSOutlineView in IB, then customize the class
but you can not do this with a simple NSTextField ??
don't say me i need a palette just for this please ;)
thanks!
_______________________________________________
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
_______________________________________________
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