Re: Solved: widgets don't work properly in a bordrless window?!?
Re: Solved: widgets don't work properly in a bordrless window?!?
- Subject: Re: Solved: widgets don't work properly in a bordrless window?!?
- From: "Clark S. Cox III" <email@hidden>
- Date: Wed, 20 Nov 2002 14:46:41 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday, Nov 20, 2002, at 08:54 US/Eastern, Ondra Cada wrote:
On Wednesday, Nov 20, 2002, at 12:23 Europe/Prague, Marco Binder wrote:
Ondra, I m not sure on this one, but the docs say:
- (BOOL)canBecomeKeyWindow
Returns YES if the receiver can become the key window, NO if it
can't. Attempts to make the receiver the key window are abandoned if
this method returns NO. NSWindow's implementation returns YES if the
receiver has a title bar or a resize bar, NO otherwise.
So I'd guess, it returns NO for a borderless window. If I d take a
shot on this one, I d say you ll have to make it return YES.
Right. I'm pretty dumb not to consider this myself -- just tested, it
works like a charm. Thanks!
And here is my question for you: is it possible to use a category to
override a function? Or do you have to subclass NSWindow?
Just to make this clear:
- you can override any method using a category (including this one);
- there's a catch though: if the method itself came from another
category (or if more categories override the same method, which is
more or less the same), the selection of the method which will be used
to respond to the appropriate message is essentially random (matter of
fact, it's the one of the category loaded last);
- there's another catch: using a category, you change a behaviour of
the class itself, ie. of *all* windows in the application. Often it's
what you want, but generally you might consider subclassing just to be
able to choose those instances which should have the new behaviour.
Another reason to prefer subclassing: There is no way to call the
original method from a category (i.e. the equivalent of [super
someMethod]), it is effectively lost.
- --
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)
iEYEARECAAYFAj3b5qcACgkQd6STocYT1xWSQwCeIGK32h1Iksx0E0U/Fhn3Xkkk
oqkAn2ZV+4rnA4a4s5O6so7GxOQJX/Er
=o07l
-----END PGP SIGNATURE-----
_______________________________________________
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.