I noticed a strange behavior. Including the HotCocoa::Behaviors module
in subclasses indeed seem to merge the appropriate custom methods.
>> class MyButton < NSButton; include HotCocoa::Behaviors; end
=> MyButton
>> b = MyButton.new
=> 0
>> b.on_action {}
=> 0
But extending an existing object
class MyView < NSView
include HotCocoa::Behaviors
def drawRect(rect)
#do something...
end
end
That HotCocoa::Behaviors was what you were missing.
On Dec 3, 2008, at 12:58 AM, John Shea wrote:
Hi Ben,
thanks for your answer.
I tried that initially, but my subclass was having
Hi Ben,
thanks for your answer.
I tried that initially, but my subclass was having problems being
added to the layout view.
Anyway - somehow I got something going a little further - the
important thing was to have a create method which has :
alloc.initWithFrame([0, 0, *GameSize]) in my NS
I am sure there is an easy answer to this question, but I have not
figured it out after some experimenting (nor can I find an example
in the examples)
What do I do if i want to subclass (say) an NSView ? And yet still
employ that subclass with all the rest of the hot cocoa magic? (so
with
Hi folks,
I am sure there is an easy answer to this question, but I have not
figured it out after some experimenting (nor can I find an example in
the examples)
What do I do if i want to subclass (say) an NSView ? And yet still
employ that subclass with all the rest of the hot cocoa magic