• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: subclassed NSOpenGLView won't draw in subclassed NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: subclassed NSOpenGLView won't draw in subclassed NSView


  • Subject: Re: subclassed NSOpenGLView won't draw in subclassed NSView
  • From: Stephane Sudre <email@hidden>
  • Date: Mon, 7 Feb 2005 17:36:01 +0100


On 7 févr. 05, at 17:33, Carl Gieringer wrote:

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.

Have you checked that NSLog(@"%@", aHistoryGraphView) was not printing that the outlet is nil?


_______________________________________________
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


  • Follow-Ups:
    • Re: subclassed NSOpenGLView won't draw in subclassed NSView
      • From: Carl Gieringer <email@hidden>
References: 
 >subclassed NSOpenGLView won't draw in subclassed NSView (From: Carl Gieringer <email@hidden>)

  • Prev by Date: subclassed NSOpenGLView won't draw in subclassed NSView
  • Next by Date: Re: subclassed NSOpenGLView won't draw in subclassed NSView
  • Previous by thread: subclassed NSOpenGLView won't draw in subclassed NSView
  • Next by thread: Re: subclassed NSOpenGLView won't draw in subclassed NSView
  • Index(es):
    • Date
    • Thread