Skip navigation.
 
mlSolved: widgets don't work properly in a bordrless window?!?
FROM : Ondra Cada
DATE : Wed Nov 20 14:54:15 2002

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.
---
Ondra Cada
OCSoftware:    <email_removed>              http://www.ocs.cz
private        <email_removed>            http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.