• 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: Scrolling NSScrollView by fractional amounts - why would values get rounded?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scrolling NSScrollView by fractional amounts - why would values get rounded?


  • Subject: Re: Scrolling NSScrollView by fractional amounts - why would values get rounded?
  • From: Piotr Grzybowski <email@hidden>
  • Date: Thu, 10 Sep 2009 16:42:52 +0200

Hullo Martin,

 maybe you should check:

v0=[scrollviewfromNib verticalLineScroll];
v1=[otherscrollview verticalLineScroll];

where scrollviewfromNib and otherscrollview correspond to your
two controls. then if (fabs(v0-v1)>=0.00001) ;-) you know..

hope this helps,
pg

On Thu, Sep 10, 2009 at 4:01 PM, Martin Redington
<email@hidden> wrote:
> I've got two NSScrollView's in separate windows, that I'm trying to
> scroll programmatically in synchrony.
>
> I'm calling
>
> [[scrollView contentView] scrollToPoint:theNewPoint];
>
> This works fine when the new y value is a whole integer, but I'm
> seeing some strange behaviour when trying to scroll by fractional
> amount (e.g. .25 or .5 of a pixel).
>
> In one window, the fractional pixel values are respected. If I scroll
> the origin from 50.0 to 50.25, its 50.25 when I come to scroll again.
>
> However, in the other window, values seem to get rounded. e.g. If I
> scroll from 50.0 to 50.25, the y origin is still 50.0 when I come
> round to scroll again. If I scroll from 50.0 to 50.5, then the y
> origin actually moves to 51.0
>
> There are a few minor differences in how I'm setting up the windows
> (one is extracted fully set up from a nib, while the other has a
> manually created NSTextView added to it after it's unarchived), but
> inspection of the view hierarchy shows no obvious differences between
> the two setups.
>
> Hopefully this is something dumb that I've just overlooked, but if
> anyone can point me in the right direction, that would be great ...
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Scrolling NSScrollView by fractional amounts - why would values get rounded? (From: Martin Redington <email@hidden>)

  • Prev by Date: Send POST to browser
  • Next by Date: singleton pattern in cocoa
  • Previous by thread: Re: Scrolling NSScrollView by fractional amounts - why would values get rounded?
  • Next by thread: CGWindowListCreateImage fails on Snow Leopard with kCGNullWindowID
  • Index(es):
    • Date
    • Thread