text-list arrow problem.
[1/2] from: mike::yaunish::shaw::ca at: 26-Apr-2006 23:16
Anyone have a fix for the down arrow in the following text-list requiring
7 clicks before the list moves?
view layout [ text-list 50x55 data [ 1 2 3 4 5 6 7 8 9 10] ]
Thanks ...Mike
[2/2] from: anton::wilddsl::net::au at: 28-Apr-2006 14:24
Very quick fix:
view layout [
text-list 50x55 data [1 2 3 4 5 6 7 8 9 10] with [
append init [sld/step: 1 / (10 - 3 + 1)]
]
]
text-list/sld is set to the scroller. The scroller has a step facet
which is 1 (the whole scroll area) divided by:
10 (total data) minus 3 (visible data) plus 1 (hack to prevent
floating point error causing an entry to be skipped sometimes).
When you change the length of your data, or the number of rows
visible, you will have to update the value of step.
I think text-list is not very well written, or at least, it's
very old - I just get mad every time I look at its code.
I would like to rework it some day.
Ah, noticed the text-list/update function. This patches
the text-list style update function to recalculate step:
use [code body face][
code: [sld/step: 1 / ((1 + length? data) - lc)]
if not find body: second get in face: svv/vid-styles/text-list 'update
code [
insert body bind code face
]
]
view layout [
text-list 50x55 data [1 2 3 4 5 6 7 8 9 10] with [
append init [update]
]
]
Regards,
Anton.