Cocoa equivalent of subclassing a REALbasic Canvas?
Cocoa equivalent of subclassing a REALbasic Canvas?
- Subject: Cocoa equivalent of subclassing a REALbasic Canvas?
- From: William Squires <email@hidden>
- Date: Thu, 5 Apr 2007 20:19:05 -0500
Hi all,
What's the best way to make a self-contained custom control in
Cocoa? I have a nifty Canvas subclass in REALbasic that I use to
replace the BevelButton.
1) Which Cocoa class do I use to replace the Canvas? NSImage?
2) How do I draw a specified (graphics) file in the content region?
(In RB, I would just import the graphic into the project, then refer
to it like:
Sub Paint(g As Graphics)
g.DrawPicture MyPicture, 0, 0
End Sub
Where MyPicture.PICT (or .jpg) exists in the project folder, and is
imported into the RB project. How would I display the
"MyPicture.PICT" file in an NSImage control?
3) How would I trap the MouseDown()/MouseUp() events? I'm guessing
Cocoa has a delegate for this, but how would I make the delegate code
self-contained so that the new custom control could be used in the IB
control pane (along with all the NSButtons, NSTextFields, etc...)
From what I understand, delegate code is held 'somewhere else' from
the POV of the class that has delegates, correct?
4) How would I make the resulting class self-contained so that I
could use it in IB?
Thanks.
P.S. I'm NOT looking for a 'how to' on how to use an NSBevelButton or
some such (I don't even know if there IS an NSBevelButton anyway...),
just an overview on how to start converting useful REALbasic classes
to Cocoa.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden