• 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: Update the scroller in a NSScrollView from its documentView ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Update the scroller in a NSScrollView from its documentView ?


  • Subject: Re: Update the scroller in a NSScrollView from its documentView ?
  • From: Oliver Quas <email@hidden>
  • Date: Thu, 9 Feb 2006 15:05:52 +0100

hi Volker,

thanks for your reply!

I dragged a CustomView in Interface Builder into my main NSWindow, set the appropriate class using the Inspector and chose "Layout/Make subview from/ScrollView" from the menu bar.

I will check, if i can make use of your tip below and get everything to work properly.

thanks + best regards,
olli


Am 09.02.2006 um 14:33 schrieb Volker Runkel:

Hi Olli,

how did you add the WaveFormView to the ScrollView ?

I use similiar solutions for a frequency-time display (sonagram) and have added one NSView (which acts as container for three other View subclasses) as documentView of the ScrollView. I have no need at all to change the superview frame from within my subviews. Zooming is handled by my ScrollView (which I have subclassed). For example I can zoom into my data:

- (void)doubleZoom
{
	zoomFactor = zoomFactor*2;
	numberOfTicksXAxis = numberOfTicksXAxis*2;
	NSRect tempRect = [scrollContentView frame];
	tempRect.size.width = tempRect.size.width*2;
	[scrollContentView setFrameSize:tempRect.size];
	[self setNeedsDisplay:YES];
}

If have no clever caching methods or anything since I never expect more then a couple of points to be plotted inside the ScrollViews content, most work has NSImageView which displays my sonagram data.


Volker

- - - - - - - - - - - - - ------ ---- ---- --- -- - - - - - - - - - - - - - - -
Dipl.-Biol. Volker Runkel
Lehrstuhl f. Zoologie II www.biologie.uni- erlangen.de/zoo2
Staudtstr. 5 Telefon: 09131-85 28788
91058 Erlangen email@hidden- erlangen.de
- - - - - - - - - - - - - ------ ---- ---- --- -- - - - - - - - - - - - - - - -


Am 09.02.2006 um 12:41 schrieb Oliver Quas:

Hi all,

i got a problem with a document-based Cocoa-application i am currently working on.

I made a subclass of NSView to display waveform data, that is collected from a QTMovie. In Interface Builder, i setup a custom view and set its class to the WaveformView class. Additionally, i made it a subview of Scroll View so if the waveform exceeds the current window width, you should be able to scroll the view.

The application also contains a NSSlider, that changes the zoom of the WaveformView (it invokes an IBAction in the MyDocument class, which triggers WaveformView to update using the new zoom value).

Everything works just fine, but when i drag the slider at a high speed, the WaveformView just disappears. It turned out, that the WaveformView's frame width resizes to 0.0. Once it gets this small, the slider can still be dragged, but the WaveformView remains empty.

Here's what i do in the WaveformView's drawRect-method:


- (void) drawRect:(NSRect)rect
{
[self lockFocus];
....
[self setFrameSize:NSMakeSize([scrollView contentSize].width, [self frame].size.height)]; // (1)
[[self superview] setFrameSize:NSMakeSize([scrollView contentSize].width, [[self superview] frame].size.height)]; // (2)
....
// some bezier drawing here
....
[self unlockFocus];
}



By commenting out (2), the bug disappears, but the horizontal scroller doesn't show up any more, when the drawn waveform exceeds the width of the visible space, because the NSScrollView's NSClipView doesn't update it's width any more.


So i wonder, how can i implement it correctly? How do you implement things like this? Where and how should i implement the NSScrollView's updating?

Also i would like to add another view to the NSScrollView. It should provide some basic timeline-editing known from applications like Final Cut Pro or iMovie. How do i have to add it to the NSScrollView? And if i use the NSSlider, how do i update the width of both (TimelineView and WaveformView) dynamically?

Any help would be greatly appreciated.

Thanks in advance.

Best regards,
Oliver

_______________________________________________
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


_______________________________________________ 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
References: 
 >Update the scroller in a NSScrollView from its documentView ? (From: Oliver Quas <email@hidden>)

  • Prev by Date: [solved] my text goes under a the scrollers....
  • Next by Date: Re: Crash when color well panel is open
  • Previous by thread: Update the scroller in a NSScrollView from its documentView ?
  • Next by thread: Re: NSBezierPath containsPoint is buggy?
  • Index(es):
    • Date
    • Thread