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

[vid] Re: Text Area scroll.

 [1/4] from: philb::upnaway::com at: 11-Dec-2003 11:41


Hi all, Does anyone know why I had to insert the ugly line if all [sl/data = 1 tmp = 1] [tmp: 0.999] in this code. if this line is commented out then even though the scroller data is set to 1 and the face shown, the dagger in the scroller is not moved to the bottom? To see this, comment out the above line in the code below, run the program and keep adding new lines until the area scrolls. You see that the dagger gets smaller but in not moved to the bottom even though sc/data is set to 1. Below is the previous code but with some comments indicating what is going on. ------------------------ rebol [ title: "Area with scroller" author: "Phil Bevan" date: 10-Dec-2003 version 0.0.2 ] pos-scroll: func [tx sc /local tsize ts-max tmp] [ tsize: size-text tx ; calculate size of text either tsize/y <= tx/size/y ; is text is smaller [sc/redrag 1 sc/data: 0] ; set dagger to 1, slider data to 0 [ sc/redrag tx/size/y / tsize/y ; set dagger size = (area y size)/(text y size) show sc ts-max: tsize/y - tx/size/y ; ts-max tmp: min 1 (- tx/para/scroll/y / ts-max) ; calculate slider position if all [sc/data = 1 tmp = 1] [tmp: 0.999] ; ugly patch ??? sc/data: tmp ; set slider poition ] show sc ; show scroller ] lv-lay: layout [ space 0 across tx: area 400x200 feel [ engage: func [face action event] [ ctx-text/edit/engage face action event if all [event/type = 'key] [pos-scroll tx scrl] ] ] scrl: scroller 16x200 [scroll-para tx scrl] ] pos-scroll tx scrl ; set initial dagger size view lv-lay ------------------------- Cheers Phil

 [2/4] from: g:santilli:tiscalinet:it at: 11-Dec-2003 11:10


Hi Phil, On Thursday, December 11, 2003, 4:41:52 AM, you wrote: puc> Does anyone know why I had to insert the ugly line puc> if all [sl/data = 1 tmp = 1] [tmp: 0.999] puc> in this code. IIRC this is a workaround for a bug in slider/redrag. I use this patch that fixes the bug: Slider: Slider with [ use [c] [ c: second :redrag either 15470763 = checksum mold c [ insert c [state: none] ] [print "CANNOT APPLY SLIDER PATCH!"] ] ] Scroller: Scroller with [ use [c] [ c: second :redrag either 15470763 = checksum mold c [ insert c [state: none] ] [print "CANNOT APPLY SCROLLER PATCH!"] ] ] Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

 [3/4] from: philb:upnaway at: 11-Dec-2003 19:35


Hi Gabrielle, That is great Gabrielle .... it wasnt just me going mad then !!! Have you submitted this patch for the consideration as part of vid 1.3 ? The updated area/scroller program is as follows : rebol [ title: "Area with scroller" author: "Phil Bevan" date: 10-Dec-2003 version 0.0.2 ] stylize/master [ Slider: Slider with [ use [c] [ c: second :redrag either 15470763 = checksum mold c [ insert c [state: none] ] [print "CANNOT APPLY SLIDER PATCH!"] ] ] Scroller: Scroller with [ use [c] [ c: second :redrag either 15470763 = checksum mold c [ insert c [state: none] ] [print "CANNOT APPLY SCROLLER PATCH!"] ] ] ] pos-scroll: func [tx sc /local tsize ts-max tmp] [ tsize: size-text tx ; calculate size of text either tsize/y <= tx/size/y ; is text is smaller [sc/redrag 1 sc/data: 0] ; set dagger to 1, slider data to 0 [ sc/redrag tx/size/y / tsize/y ; set dagger size = (area y size)/(text y size) show sc ts-max: tsize/y - tx/size/y ; ts-max = maximum value of top of dagger tmp: min 1 (- tx/para/scroll/y / ts-max) ; calculate slider position sc/data: tmp ; set slider poition ] show sc ; show scroller ] lv-lay: layout [ space 0 across tx: area 400x200 feel [ engage: func [face action event] [ ctx-text/edit/engage face action event if all [event/type = 'key] [pos-scroll tx scrl] ] ] scrl: scroller 16x200 [scroll-para tx scrl] ] pos-scroll tx scrl ; set initial dagger size view lv-lay

 [4/4] from: g:santilli:tiscalinet:it at: 11-Dec-2003 12:58


Hi Phil, On Thursday, December 11, 2003, 12:35:33 PM, you wrote: puc> That is great Gabrielle .... it wasnt just me going mad then !!! puc> Have you submitted this patch for the consideration as part of vid 1.3 ? Unfortunately not yet, as my home Internet connection died and I didn't have any way to post anything while at home, and I'm now very very busy here at work... I hope they can restore my connection soon, so that I'll be able to make my submissions too... I have a lot of patches here and there that I need to check and, if useful, submit... Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/