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: greggirwin:mindspring at: 3-Aug-2004 9:08

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] ] scroll-edit: func [page n] [ s1/data: s1/data + (n * (either page [t1/size/y] [t1/font/size]) / max 1 second size-text t1 ) show s1 scroll-para t1 s1 ] init: does [ ed-lo/feel: make ed-lo/feel [ detect: func [face event] [ switch event/type [ offset [save-prefs] scroll-line [scroll-edit false event/offset/y] scroll-page [scroll-edit true event/offset/y] resize [ resize max 100x64 ed-lo/size refresh save-prefs return true ] key [switch event/key keymap] close [quit-edit] ] event ] ] ] -- Gregg