Short of supply
[1/2] from: patrick:philipot:laposte at: 6-Jul-2003 15:30
Hi List, It seems to me that Rebol documentation is very short in list example. The SUPPLY fonction in fact is giving me a headache. For example, from the few examples I had found here and there, I thought the SUPPLY function was called once for each element of the list. This short piece of code proves me wrong. mydata: ["Red" "Green" "blue"] view center-face layout [ list 100x100 [ text 80 ] supply [ print count ;<------------------------- printing occurs every time the mouse goes over an element face/text: either count > length? mydata [""][pick mydata count] ] ] During my "research", I have found this exclamation from pekr
>> .... maybe you will not agree, but 'supply part of list style is a real stopper to style usage, >> and I have proof with three other ppl I get to some VID coding .... I wonder if there is more intuitive way? >> -pekr-
from http://www.escribe.com/internet/rebol/m30783.html May be things have changed... Is there any piece of didactic documentation, some SUPPLY tutorial or LIST for dummies out there? Regards Patrick
[2/2] from: nitsch-lists::netcologne::de at: 6-Jul-2003 18:31
Am Sonntag, 6. Juli 2003 15:30 schrieb patrick:
> Hi List, > It seems to me that Rebol documentation is very short in list example.
<<quoted lines omitted: 11>>> [""][pick mydata count] ] > ]
supply is called whenever /view needs information about the faces in the row. after usage the information is thrown away. because the same face is filled with the next rows data. to handle mouse-events, /view needs the row-faces filled with this rows data and has to calculate them. so it calls 'supply. so, there is no calling order, you have to supply the data always based on 'count and 'index . list-data: [[a 1] [b 2] [c 3]] view layout [ list [across text 50 "a" ;sample face with action text 50 "b" [ either row-data [ alert remold [face/text row-data/1 row-data/2] ] [ alert "empty row" ] ] ] supply [ either row-data: pick list-data count [ face/text: pick row-data index ] [ face/text: "-empty-" ] ] ] We use 'row-data also in face/action. It contains the last row supplied. this is the one used to find the face under the mouse. so the current. Note it does not work with 'info-fields. its only valid for a short time next 'show, mouse-move may break it, because they triggered supply again. and 'info does something with focus for mouse-marking. which triggers 'show i gusss.
> During my "research", I have found this exclamation from pekr > >> .... maybe you will not agree, but 'supply part of list style is a real
<<quoted lines omitted: 5>>> Regards > Patrick
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted