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

[REBOL] Text-List Slider Question (reply to a lost email)

From: brett::codeconscious::com at: 23-Apr-2002 0:39

Someone emailed me directly about a slider question for text-list. Unfortunately I lost the message when my machine crashed. So if the sender happens to be subscribed to this list - you're best off posting your question here - it is not as likely to be lost! :^) Nevertheless, I think it was something like - given an element how do you set the slider to show it? To which I believe the answer is that you need to ensure the textual part is scrolled properly and the slider can then be synchronised with that change. In the text-list style (TL) there is a field TL/LC ("line count") that holds the number of lines that can be displayed. Another field TL/SN (perhaps "scroll number") that is equals the number of lines scrolled off the top. To be consistent with the default text-list functionality, TL/SN should be less than or equal to (1 + length? head TL/LINES) Finally to change the slider position modify TL/SLD/DATA. This example code will scroll the line you click on to the top and synchronise the slider to match. tl-scroll-to: function [ face line-num ][max-scroll-num][ max-scroll-num: (1 + length? head face/lines) - face/lc face/sn: line-num - 1 face/sld/data: face/sn / max-scroll-num show face ] view layout [ text-list 200x50 data copy system/locale/months [ if not empty? face/picked [ num: index? find face/lines first face/picked tl-scroll-to face num ] ] ] Brett.