Subclasses in projectbuilder
Subclasses in projectbuilder
- Subject: Subclasses in projectbuilder
- From: Bishop <email@hidden>
- Date: Sat, 3 Nov 2001 17:18:50 +0100
Hi, I want to move over to Cocoa development and I'm having trouble
getting started first of all i know nothing about obj-C, and only a
little java but I'm fluent in C,C++ but I still think my best choice
would be Java, any comments on this.
Here is the REAL question:
I create an subclass of NSScrollView, HexScrollView (in IB) and I assign
a CustomView to be of this type (Hex...). After some trouble I figured
that I needed a constructor to get it running, I fixed this but nothing
draws in the window. To me it seems that a subclass should behave as the
superclass if I don't modify it (All the constructor does is call
super(frame); ). Why does it not behave like an NSScrollView. I added a
drawRect function and managed to draw a rectangle around the frame.
This is what the code looks like:
public class HexScrollView extends NSView {
protected int bla;
public HexScrollView(NSRect frame)
{
super(frame);
bla = 2;
}
/*public void drawRect(NSRect frame)
{
NSGraphics.frameRectWithWidth(frame, (float)bla);
}
*/
} (if it is of any help)
Why doesn't the custom view act as a NSScrollView from start what am I
doing wrong.
Thanx Bishop
--
Codito, ergo sum