subclassed NSOpenGLView won't draw in subclassed NSView
subclassed NSOpenGLView won't draw in subclassed NSView
- Subject: subclassed NSOpenGLView won't draw in subclassed NSView
- From: Carl Gieringer <email@hidden>
- Date: Mon, 7 Feb 2005 07:33:46 -0900
Hello,
I am having problems subclassing NSView with a subclassed OpenGlView
inside. I apologize, because this seems like a simple problem, but I
haven't found anything that helps in the archives (cocoa-dev's or
mac-opengl's) or in the AppKit documentation.
I am subclassing NSView to make a graph with labeled axes. The NSView
subclass, HistoryView, is in my nib file, and during its awakeFromNib
it creates NSTextFields to label the axes and also creates a subclass
of NSOpenGLView, HistoryGraphView. HistoryView is responsible for
laying out its subviews, making them draw in -drawRect: and resizing
the subviews. I do call -lockFocus and -unlockFocus before drawing
every subview of HistoryView. I do also add the subviews to my History
view via [aHistoryView addSubview:subview];
The problem I am having is that the OpenGLView subclass
HistoryGraphView does not draw except for when it is first placed on
the screen. The only exception is as I resize HistoryView's window.
Then HistoryGraphView draws correctly. The most correct way to draw
the subview (I think) would be to do [aHistoryGraphView
setNeedsDisplay:YES] when -updateHistory is called (that is, when the
data that aHistoryGraph represents changes.) Unfortunately, this
method does not cause aHistoryGraphView's frame to refresh on my
screen.
I have tried things like calling both HistoryView and
HistoryGraphView's drawRect methods via timers. I have also had timers
call -setNeedsDisplay:YES on both HistoryView and HistoryGraphView.
Any advice would be appreciated. I don't know how to access any more
information about OS X's drawing implementation to figure out why
[aHistoryGraphView setNeedsDisplay:YES] doesn't cause the correct
visual to be drawn, even though constantly resizing the window does
cause the correct visual to be drawn.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden