Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: list: multiple columns update

From: robert:muench:robertmuench at: 14-Feb-2002 18:58

> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf Of > Allen Kamp > Sent: Thursday, February 14, 2002 2:27 PM > To: [rebol-list--rebol--com] > Subject: [REBOL] Re: list: multiple columns update > Here is a simple multilist column example. Hope it helps.
Hi, thanks. Yes it does but I have some questions
> view layout [ > style txt txt [if row [selected: row show lst]] 100
What does the [...] block stand for in a style command? Is this the code that gets executed if a row is clicked? You use 'row and 'row gets set to 'count within the supply block. So when is the code in the style definition executed? IMO this can only happen after the supply block has been exectued so that 'row has a valid value. On the other hand you use the 'selected value with the 'if in the supply block... This indicates that the code must be executed before the supply block so that 'selected has a valid value.
> lst: list 300x300 [across space 0x0 txt txt txt] supply [ > row: count > either line: pick data count [ > item: pick line index > face/text: item > ; color our columns > face/color: pick reduce [red blue green] index > ; hilight selected row > if row = selected [face/color: gold] > ][ > ; not a row with data set defaults > set-font face 'color black > face/color: snow > face/text: none > ] > ] > ]
Here is my code that doesn't work, maybe you find the problem :-| ; The _layout is used in a LIST to specify how the list should look like and ; how many columns it has ; If you want to add an action to some of the fiels just provide a function ; that gets called. _layout: [ across space 0 text 20 _project-select text 120 text 120 text 120 text 120 ] _project-select: [ tmp: pick project-list face/user-data tmp/selected: not tmp/selected show _list ] ; FUNC [FACE COUNT INDEX] ; face the VID object to work with ; count numbers the rows ; index numbers the columns _supply: [ ; do we have enough data? if count > length? project-list [face/show?: false exit] face/show?: true ; get project current-project: pick project-list count ; add stripes look to the list face/color: ivory if even? count [face/color: ivory - 50.50.50] ; change color if project is selected print [count index current-project/selected] if current-project/selected [face/color: yellow] ; we use the current index to pick the entry from our object to display ; first current-project gives the list of fields in the object ; +1 skips the self reference field: pick first current-project index + 1 face/text: current-project/:field ; store the project index into the predefined user-data field of the ; face, so that we can later access it face/user-data: count ] list 100x100 _layout supply _supply Robert