[REBOL] Re: Iterated check box anomaly
From: rotenca:telvia:it at: 13-Apr-2002 15:03
Hi, Geza
> BTW What is the exact timing of the 'supply function, i.e. on what
> occasion (event) will it be launched? As far as I can see, it is
> called not only at initialization time (filling the list with items)
> but even when I click in the list?
There is not an exact timing. It is called when view need it, for example when
you move the mouse over the list, or you click on the list, or some call show
...
It is not called always from top to down, can be called random for a single
count line
You can check it by yourself:
view layout [
l: list [
across
text no-wrap "try1"
text no-wrap "try2"
] supply [
Print [count index]
face
]
]
Instead, index (not count) are always called from 1 to end in the sequence in
which they appear in l/subface/pane
from what you can see in the list/pane function:
>> probe get in l 'pane
func [face id /local count spane][
if pair? id [return 1 + second id / subface/size]
subface/offset: subface/old-offset: id - 1 * subface/size * 0x1
if subface/offset/y + subface/size/y > size/y [return none]
count: 0
foreach item subface/pane [
if object? item [
subfunc item id count: count + 1
]
]
subface
]
> First I tried toggles instead of check boxes, but selecting one of
> them caused to redraw all toggles below the selected one in selected
> state :-( Is there a way - via some kind of reinitialization - to use
> toggles properly in an iterated list?
Should be the same, never tryed, but you must think that, when supply is
called, all the changed field are in an unknown state: you must reinitialize
every field which can be changed by previous supply call.
There are few limits to the list style, sometime it is only a little hard to
figure what is happening.
> Again, View docs are euphemically sparse on a quite difficult topic,
> like face iteration.
They are a great 0. The only way to follow is "disassembling and try" like in
the old good times.
---
Ciao
Romano