Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: [scrolling] Scroll-wheel problem with area

From: carl:cybercraft at: 4-Aug-2004 20:41

>Hi Carl, > >CR> I've been writing a routine to add scroll-wheel support to scripts >CR> and I've hit a slight snag with stopping an area scrolling out of >CR> the top of its box - ie, I can't see any way to do it. :-) > >CR> With text-lists you have lc and the length of the list's block to >CR> control this, but I can't find how to get such values with an area >CR> or any other way it could be done. With areas I'm changing >CR> their para/scroll/y value to scroll them. > >Have you looked at the source for EDITOR? Here are some pertinent >bits: > > scroll-to: func [txt /local xy] [ > xy: (caret-to-offset t1 txt) - t1/para/scroll > t1/para/scroll: min 0x0 t1/size / 2 - xy > s1/data: (second xy) / max 1 second size-text t1 > show [s1 t1] > ]
Ah! I had't twigged that size-text would work out the area of all the text in a face. I kinda figured it'd be just what's displayed, so hadn't thought to use it. Thanks Gregg! Updated version uploaded... -- Carl Read