Hi,
can someone enlighten me? I don’t understand how I can do something simple as drawing a rectangle in a view.
I tried this:
script MainView
property parent : class “NSView”
property NSBezierPath : class “NSBezierPath”
on initWithFrame_(frame)
continue initWithFrame_(frame)
return me
end initWithFrame_
on drawRect_(aRect)
set vRect to {{10, 10}, {100, 100}}
set vPath to NSBezierPath’s bezierPath
vPath’s appendBezierPathWithRect_(vRect)
end drawRect_
end script
There is no error message, but also no rectangle.
With Objective-C, it should look like:
NSBezierPath* vPath = [NSBezierPath bezierPath];
[vPath appendBezierPathWithRect:NSMakeRect(10.0, 10.0, 100.0, 100.0)];
but if I try:
vPath’s appendBezierPathWithRect_(NSMakeRect(10.0, 10.0, 100.0, 100.0))
I get the error message:
[MainView drawRect:]: *** -[MainView NSMakeRect]: unrecognized selector sent to object <MainView @0x200755260: OSAID(7)> (error -10000)
Thank you very much in advance,
Thomas