How do I... or Up and Down
[1/3] from: cybarite::sympatico::ca at: 10-Oct-2001 8:27
Andrew,
This sensor use might be what you want.
---Some limitations:
a. applies to the whole window not just the text-list so
you can't have several together
b. does not interact with previous mouse selections.
c. I don't believe it will scroll a list. at least it does not in easyvid.r
when the list of screens gets long.
---Sample
i: 1
show-pick: func [tl direction] [
i: either direction = 'up [i - 1] [i + 1]
i: max 1 min length? tl/data i
tl/picked: compose [(pick tl/data i)]
show tl
]
view layout [
days: text-list 200x140 data ["Monday" "Tuesday" "Wednesday" "Thursday"
Friday
"Saturday" "Sunday"]
sensor keycode [up left] [show-pick days 'up]
sensor keycode [down right] [show-pick days 'down]
]
[2/3] from: al:bri:xtra at: 11-Oct-2001 8:30
Thanks, Mike. I think your code, with the hints about using feel events in
Allen Kamp's Rebol Forces site (thanks Chris!), should do the trick.
Hopefully I have something worked out later today that'll do the trick.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[3/3] from: john_kenyon:mlc:au at: 12-Oct-2001 9:31
Andrew/Mike,
This is a quick addition to Mikes code to pick up the currently selected
item then move up or down. (ie limitation b fixed)
(I'm sure it could be done more concisely, but it works)
;i:1 this line is not needed now
show-pick: func [tl direction] [
either none? find tl/texts tl/picked [ i: 1 ] [
i: index? find tl/texts tl/picked
i: either direction = 'up [i - 1] [i + 1]
i: max 1 min length? tl/data i
]
tl/picked: compose [(pick tl/data i)]
show tl
]
I'll try and fix the scrolling too if I get chance :)
Cheers,
John
Andrew,
This sensor use might be what you want.
---Some limitations:
a. applies to the whole window not just the text-list so
you can't have several together
b. does not interact with previous mouse selections.
c. I don't believe it will scroll a list. at least it does not in easyvid.r
when the list of screens gets long.
---Sample
i: 1
show-pick: func [tl direction] [
i: either direction = 'up [i - 1] [i + 1]
i: max 1 min length? tl/data i
tl/picked: compose [(pick tl/data i)]
show tl
]
view layout [
days: text-list 200x140 data ["Monday" "Tuesday" "Wednesday"
Thursday
Friday
"Saturday" "Sunday"]
sensor keycode [up left] [show-pick days 'up]
sensor keycode [down right] [show-pick days 'down]
]