text-list/text (scroll bar problem)
[1/9] from: dajoy::operamail::com at: 15-Nov-2001 12:39
Cheers wrote:
> Hi Daniel,
>
> you cant directly change the block that the text list references.
> ie You cant redefine the variable.
>
> You have to use insert/remove/clear etc.
>
> Below is some revised code .... there are still problems with the scroll bar though.
And how could that be fixed?? (I did tried and failed)
Daniel
[2/9] from: philb:upnaway at: 16-Nov-2001 8:49
Hi Daniel,
I am not an expert on scrollers and I cant remember where this function came from (I
picked it up from the list sometime) but you could try this .... it fixes the size of
the dagger but it needs to reposition the slider to the top.
There is a bug in that if you are in a large directory and and scrolled to the bottom
and select a small directory you get duplicate entries at the top of the newly displayed
directory.
(This is why I didnt immediately volunteer this function .... no point giving you bugged
code :-( )
If anyone can fix this I would be very grateful as I use this funcction elsewhere
REBOL [Title: "File Selector and Directory Navigator"]
; fix slider when text list is updated
fix-slider: func [faces [object! block!]]
[
foreach lv-list to-block faces
[
lv-list/sld/redrag lv-list/lc / max 1 length? head lv-list/lines
show lv-list
]
]
curr-dir: change-dir %.
lv-data: sort read curr-dir
view layout
[
vh2 "Current Dir"
curr: vtext to-string curr-dir 200x24
vh2 "File List:"
fileList: text-list data lv-data
[
either dir? rejoin [curr-dir value]
[
curr-dir: rejoin [curr-dir value]
curr/text: to-string curr-dir
clear lv-data
foreach lv-file sort read curr-dir
[insert lv-data lv-file]
fix-slider fileList
show curr
]
[fileLocal/text: value show fileLocal]
]
fileLocal: field
button "Great!" [
print join "fileList/data: " fileList/data
show fileList
]
]
=== Original Message ===
Cheers wrote:
> Hi Daniel,
>
> you cant directly change the block that the text list references.
> ie You cant redefine the variable.
>
> You have to use insert/remove/clear etc.
>
> Below is some revised code .... there are still problems with the scroll bar though.
And how could that be fixed?? (I did tried and failed)
Daniel
<snip snip>
[3/9] from: greggirwin:mindspring at: 16-Nov-2001 9:36
Phil, et al
<< There is a bug in that if you are in a large directory and and scrolled
to the bottom and select a small directory you get duplicate entries at the
top of the newly displayed directory. >>
I hope RT can give us a definitive solution to this problem. In the
meantime, the most complete solution I've come up with is to do:
sld/data: 0
before you do the sld/redrag call. In my empirical testing here, it seems to
solve the problem. YMMV.
--Gregg
[4/9] from: philb:upnaway at: 17-Nov-2001 21:48
Hi Gregg,
This certianly fixes the duplicates problem.
Unfortuntely it still leaves an outstanding bug.
If I have a text list with many entries update the slider to a smaller list the slider
gets fixed and moved to the top of its container but the text list is not refreshed until
you press the slidder.
See the program below.
Drag the slider to the bottom.
Press the update button.
The text-list is updated but nothing is displayed in the text list until you drag the
appently fixed slider downwards :-(
rebol []
; fix slider when text list is updated
fix-slider: func [faces [object! block!]]
[
foreach lv-list to-block faces
[
; print [length? head lv-list/lines lv-list/lc]
lv-list/sld/data: 0
lv-list/sld/redrag lv-list/lc / max 1 length? head lv-list/lines
show lv-list
]
]
tl-data: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
view layout
[
tl: text-list data tl-data 100x100
button "Update it"
[
clear tl-data
insert tl-data [1 2 3 4]
fix-slider tl
]
]
Any ideas??
Cheers Phil
=== Original Message ===
Phil, et al
<< There is a bug in that if you are in a large directory and and scrolled
to the bottom and select a small directory you get duplicate entries at the
top of the newly displayed directory. >>
I hope RT can give us a definitive solution to this problem. In the
meantime, the most complete solution I've come up with is to do:
sld/data: 0
before you do the sld/redrag call. In my empirical testing here, it seems to
solve the problem. YMMV.
--Gregg
[5/9] from: rotenca:telvia:it at: 17-Nov-2001 18:30
Hi, <[philb--upnaway--com]>
> Unfortuntely it still leaves an outstanding bug.
>
> If I have a text list with many entries update the slider to a smaller list
the slider gets fixed and moved to the top of its container but the text list
is not refreshed until you press the slidder.
Add to your code:
lv-list/sn: 0
it is not a bug, it is a non-feature (!): View-vid offer only basically
services to slider/text-list, you must almost adjust every field manually (and
without doc!).
Ciao
Romano
[6/9] from: greggirwin:mindspring at: 17-Nov-2001 14:39
<< Add to your code:
lv-list/sn: 0
it is not a bug, it is a non-feature (!): View-vid offer only basically
services to slider/text-list, you must almost adjust every field manually
(and
without doc!). >>
Thanks Romano! I hadn't tracked that one down.
--Gregg
[7/9] from: philb:upnaway at: 18-Nov-2001 9:16
Hi Gregg/Romano
This has fixed a long standing bug in my emailer :-)
1.1.15 will be posted shortly :-)
Cheers Phil
=== Original Message ===
<< Add to your code:
lv-list/sn: 0
it is not a bug, it is a non-feature (!): View-vid offer only basically
services to slider/text-list, you must almost adjust every field manually
(and
without doc!). >>
Thanks Romano! I hadn't tracked that one down.
--Gregg
[8/9] from: dajoy:operamail at: 17-Nov-2001 23:20
From: "Gregg Irwin" <[greggirwin--mindspring--com]>
> Phil, et al
> << There is a bug in that if you are in a large directory and and scrolled
<<quoted lines omitted: 5>>
> before you do the sld/redrag call. In my empirical testing here, it seems to
> solve the problem. YMMV.
Thanks Gregg,
It works partially. The bar now covers the whole vertical space available, that
is good, but then I still need to _try_ to drag the slider to update the list
of items. Otherwise the list shows no items, it appears empty.
Daniel
[9/9] from: philb:upnaway at: 18-Nov-2001 17:35
Hi Daniel,
see Romano's earlier answer .... it works for me.
Thanks for asking the original question .... it has fixed a long standing but in one
of my programs.
My example program now works ....
rebol []
; fix slider when text list is updated
fix-slider: func [faces [object! block!]]
[
foreach lv-list to-block faces
[
; print [length? head lv-list/lines lv-list/lc]
lv-list/sld/data: 0
lv-list/sn: 0 ; this is the Romano's change
lv-list/sld/redrag lv-list/lc / max 1 length? head lv-list/lines
show lv-list
]
]
tl-data: [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
view layout
[
tl: text-list data tl-data 100x100
button "Update it"
[
clear tl-data
insert tl-data [1 2 3 4]
fix-slider tl
]
]
Cheers Phil
=== Original Message ===
From: "Gregg Irwin" <[greggirwin--mindspring--com]>
> Phil, et al
> << There is a bug in that if you are in a large directory and and scrolled
<<quoted lines omitted: 5>>
> before you do the sld/redrag call. In my empirical testing here, it seems to
> solve the problem. YMMV.
Thanks Gregg,
It works partially. The bar now covers the whole vertical space available, that
is good, but then I still need to _try_ to drag the slider to update the list
of items. Otherwise the list shows no items, it appears empty.
Daniel
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted