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

[REBOL] [vid] Re: Text Area scroll.

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