Re: setHidden: on MacOS 10.2
Re: setHidden: on MacOS 10.2
- Subject: Re: setHidden: on MacOS 10.2
- From: Michael Becker <email@hidden>
- Date: Tue, 4 May 2004 23:04:47 +0200
Am 04.05.2004 um 17:31 schrieb Glenn Andreas:
This is the way to go fo me. Unfortunately it doesn't seem like I
could simply create a category of NSButton with a setHidden: method,
right? As far as I understand categories, I cannot create further
object variables, and so I cannot store my superview, right?
No, you can't add a variable in a category, but you can fake it.
Basically, you've got a parallel dictionary that maps between the
object and the "pseudo-instance var", using the object as the key
(note that you need to be careful about reference counting - removing
the object from the dictionary when you try to make it go away).
I don't get it. If I cannot add variables in a category, how can I use
a dictionary in a category? That dictionary would have to be a
variable, too, right? The thing is: I would like to go down the route
which involves the least work. If I choose to subclass, I'd have to
subclass NSButton, NSView, NSBox and NSTextField. Then I would have to
include the same overrides in every subclass. Then again add the import
statement in every file and make sure (via Interface Builder and
programmatically) that every variable uses the appropriate subclass.
This is definitely a lot of work in a project with over 10.000 lines of
code :-)
I know I'd have to do almost the same with categories, but at least I
wouldn't have to search through (localized) InterfaceBuilder-files and
make sure that everything is alright...
Bye,
Michael
_______________________________________________
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.