Re: NSBezierPath
Re: NSBezierPath
- Subject: Re: NSBezierPath
- From: Daniel Todd Currie <email@hidden>
- Date: Mon, 1 Dec 2003 18:37:01 -0800
This all works fine now, but I'm unsure of how to remove the line.
Since the strokeLineFromPoint:toPoint: method is a class method which
returns void, I don't have an object that i can release. The only
thing resembling what I need would require setting up GStates, which I
assume is not what I want to do, as system performance is rather
critical in my app. In case it matters, I am not calling this method
from the gaugeView's drawRect method. Thanks for your help.
// D
On 2003 Dec 01, at 03:49, Louis C. Sacha wrote:
Hello...
I would add to the previous comments by James Chen about locking the
focus before drawing, that this depends on how your
drawNeedleForError: method is being called. If you only call this
method from inside GaugeView's drawRect: method, then the focus has
already been taken care of for you automatically. If you are calling
this method from outside the GaugeView's drawRect: method or any other
object is calling this method on your gaugeView instance, then you
definitely need to do as he said and lock/unlock focus properly.
Also, you might want to change the
gaugeRect = [gaugeView frame];
call to
gaugeRect = [gaugeView bounds];
A view's frame represents its position and size in it's superview, a
view's bounds represents the rect used internally for drawing its
content.
Anyway, the following code isn't working (at all). This is currently
just a test method that should simply draw a line from the bottom
left corner to the top right corner. gaugeView is declared in my .h
file and is linked to an NSQuickDrawView in IB. I have verified that
the output of the NSLog is appropriate. Any help would be
appreciated; TIA!
Finally, you might want to verify that you have added your gaugeView
to the NIB file correctly in Interface Builder. I may be
misunderstanding what you are trying to say above, but it doesn't
sound right to me. If your GaugeView class is a subclass of NSView,
then you need to drag an NSView to your window (it looks like a shaded
rectangle, which I believe says "Custom View" on it). Then either drag
the GaugeView.h file onto Interface Builder, or choose the "Classes"
tab in the shelf that displays the objects in the nib file and then
select "Read Files" from the "Classes" menu in the main menubar and
choose your GaugeView.h file. After that, click on the custom View
that you dragged to the window earlier and then choose the "Custom
Class" tab on the Inspector panel. Select GaugeView in the list of
classes displayed. You'll also need to make whatever connections to
the gaugeView from the objects that you need to send commands from.
Hope that helps,
Louis
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.