FROM : Brian Bergstrand
DATE : Tue Nov 19 10:45:05 2002
On Monday, November 18, 2002, at 08:03 PM, Michael Mulligan wrote:
> If I recall correctly, there's an article showing how to do this very
> thing
> on http://www.cocoadevcentral.com/
>
Thanks for the pointer. Google didn't turn it up on a search; must not
have used the right keywords.
Anyway, not to disparage free code, but whoever wrote this really
doesn't know what they are doing.
First off, they specify the scroll timer interval as "1/4". Well when
this is converted to a float by the compiler (for [NSTimer
scheduledTimerWithTimeInterval:...]) it ends up being 0, not .25 as
they documented in the code.
Secondly and most heinous, is the use of
maxScrollHeight = [[creditsField string] length];
How in the hell is the number of chars in the string even loosely
related to the # of pixels to scroll for the height?
Anyway I've fixed up our original code (which, turns out used this
example almost verbatim) so that it at least takes the # of lines, the
line height, and the View's height into account when scrolling.
I still don't know how to do the continuous scrolling thing though.
Right now, when all of the text has been scrolled, it "jumps" back to
the beginning, instead of continuing in a loop manner. Quite
noticeable, but it works.
> On 11/18/02 8:08 PM, "Brian Bergstrand" <<email_removed>>
> wrote:
>
>> Anyone have any examples of auto-scrolling text using NSTextView? Kind
>> of like what you see in about boxes all of the time.
>
Brian Bergstrand
<http://www.classicalguitar.net/brian/> PGP Key ID: 0xB6C7B6A2
Oh, they have the Internet on computers now. - Homer Simpson
DATE : Tue Nov 19 10:45:05 2002
On Monday, November 18, 2002, at 08:03 PM, Michael Mulligan wrote:
> If I recall correctly, there's an article showing how to do this very
> thing
> on http://www.cocoadevcentral.com/
>
Thanks for the pointer. Google didn't turn it up on a search; must not
have used the right keywords.
Anyway, not to disparage free code, but whoever wrote this really
doesn't know what they are doing.
First off, they specify the scroll timer interval as "1/4". Well when
this is converted to a float by the compiler (for [NSTimer
scheduledTimerWithTimeInterval:...]) it ends up being 0, not .25 as
they documented in the code.
Secondly and most heinous, is the use of
maxScrollHeight = [[creditsField string] length];
How in the hell is the number of chars in the string even loosely
related to the # of pixels to scroll for the height?
Anyway I've fixed up our original code (which, turns out used this
example almost verbatim) so that it at least takes the # of lines, the
line height, and the View's height into account when scrolling.
I still don't know how to do the continuous scrolling thing though.
Right now, when all of the text has been scrolled, it "jumps" back to
the beginning, instead of continuing in a loop manner. Quite
noticeable, but it works.
> On 11/18/02 8:08 PM, "Brian Bergstrand" <<email_removed>>
> wrote:
>
>> Anyone have any examples of auto-scrolling text using NSTextView? Kind
>> of like what you see in about boxes all of the time.
>
Brian Bergstrand
<http://www.classicalguitar.net/brian/> PGP Key ID: 0xB6C7B6A2
Oh, they have the Internet on computers now. - Homer Simpson
| Related mails | Author | Date |
|---|---|---|
| Brian Bergstrand | Nov 18, 17:12 | |
| Michael Mulligan | Nov 18, 18:04 | |
| Ryan Z. Hale | Nov 18, 20:43 | |
| Ryan Z. Hale | Nov 18, 20:44 | |
| Brian Bergstrand | Nov 19, 10:45 | |
| Cameron Hayne | Nov 19, 11:10 | |
| David Sinclair | Nov 19, 11:58 | |
| Andreas Mayer | Nov 19, 13:51 |






Cocoa mail archive

