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

[scrolling] Scroll-wheel problem with area

 [1/6] from: carl:cybercraft at: 3-Aug-2004 17:48


Hi all, I've been writing a routine to add scroll-wheel support to scripts and I've hit a slight snag with stopping an area scrolling out of the top of its box - ie, I can't see any way to do it. :-) With text-lists you have lc and the length of the list's block to control this, but I can't find how to get such values with an area or any other way it could be done. With areas I'm changing their para/scroll/y value to scroll them. The routine I'm working on, which is usable now, can be found here... http://homepages.paradise.net.nz/left/rebol/scripts/scrolling.r Any ideas? -- Carl Read

 [2/6] 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

 [3/6] 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
<<quoted lines omitted: 12>>
> 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... http://homepages.paradise.net.nz/left/rebol/scripts/scrolling.r -- Carl Read

 [4/6] from: greggirwin:mindspring at: 4-Aug-2004 10:14


CR> http://homepages.paradise.net.nz/left/rebol/scripts/scrolling.r Very nice Carl! -- Gregg

 [5/6] from: carl:cybercraft at: 5-Aug-2004 8:11


>CR> http://homepages.paradise.net.nz/left/rebol/scripts/scrolling.r > >Very nice Carl!
Will do till (hopefully) 1.3 makes it redundant, and for the OSs 1.3 isn't going to appear on. -- Carl Read

 [6/6] from: antonr::lexicon::net at: 6-Aug-2004 1:08


Agree, very nice example. :) Anton.

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted