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

Info on 'list style

 [1/7] from: reboler:programmer at: 11-Apr-2002 15:32


Can anyone point me to a good reference for the 'list style? I've looked at several examples, using 'data and 'supply, but have not found any goods docs. 'Supply seems to use 'count and 'index ? If you have a moment to spare, could someone show a _simple_ example (with minimum of two columns) using 'supply and the following data... m-l-c: [ ["from1" "subject1" "contents1"] ["from2" "subject2" "contents2"] ["from3" "subject3" "contents3"] ] TIA, Alan.

 [2/7] from: anton:lexicon at: 12-Apr-2002 13:20


Try this: view layout [list 300x300 [across button field] data m-l-c] Also look at a more complicated example: http://anton.idatam.com.au/rebol/gui/demo-vid-list.r It deals with refreshing the data, capturing click events and scrolling. It's not perfection, though. Anton.

 [3/7] from: geza67:freestart:hu at: 12-Apr-2002 20:40


Hello Alan, Here is a quite simple simple solution: rebol [] m-l-c: [ ["from1" "subject1" "contents1"] ["from2" "subject2" "contents2"] ["from3" "subject3" "contents3"] ] view layout [ below list 550x180 [ btn: button [probe reform [btn/text fld1/text fld2/text]] fld1: field fld2: field ] supply [ if count > length? m-l-c [face/show?: false exit] face/show?: true face/text: m-l-c/:count/:index ] ] Points to keep in mind when designing an iterated list: - harmonize the overall list size and the sizes of the individual items in the list - 'count holds the iterated row number - 'index holds the face index in the row (in the above example, as faces appear in the layout they are linked to the data consecutively: 'btn = 1, 'fld1 = 2, 'fld2 = 3 - faces WILL be iterated to the total height of the list - in the 'supply block setting the face/show? to 'false is _vital_ to hide obsolete extra (repeating the list row!) elements; in this algorithm "overflow" of the iteration is prohibited by the 'if control structure. If you want a list with a scrollbar, look at Anton's rebsite for vid-usage.r and merge in its slider code. -- Best regards, Geza mailto:[geza67--freestart--hu]

 [4/7] from: anton:lexicon at: 13-Apr-2002 15:22


Actually demo-vid-list.r, not vid-usage.r :) http://anton.idatam.com.au/rebol/gui/demo-vid-list.r Anton.

 [5/7] from: geza67:freestart:hu at: 13-Apr-2002 18:33


Hello Alan!
> Actually demo-vid-list.r, not vid-usage.r :)
[Thank you, Anton!]
> http://anton.idatam.com.au/rebol/gui/demo-vid-list.r >> If you want a list with a scrollbar, look at Anton's rebsite for >> vid-usage.r and merge in its slider code.
Oops! I meant really vid-usage.r, but mistakenly credited it to Anton. vid-usage.r is actually on Cybarite's rebsite (which is apparently down at the moment as I write this message): it has three dynamic list examples, each is more complex than the previous one. Anton's demo-vid-list.r shows an excellent extension of the basic iterated list style with scrollbar AND scroller arrows. Better to take the first look at vid-usage.r, as "hors d'oeuvre" :-) , then, if everything is clear to you, step onto the level of the most complex vid-list.r -- Best regards, Geza mailto:[geza67--freestart--hu]

 [6/7] from: reboler:programmer at: 16-Apr-2002 13:05


Thanks for the pointers, Anton and Geza! I now have nearly complete success with what I wanted to do with 'list and supply. One more thing though, if you all would be so kind... Anton's scroller demo is still a bit complex for me (especially given that I am still learning the 'list style). Anton, the demo mentions that your special scroller style is not necessary for scrolling a 'list. What are the essentials for scrolling a 'list? (I know about 'scroll-para and have and have used 'crop on images, and investigated the origin method, but none of these work on 'list). Is it similar to a 'text-list, with face/sld/data and face/sn, etc?

 [7/7] from: felixs:ihug:au at: 17-Apr-2002 6:06


Hi Alan, I had the same problem but I found http://www.rebol.org/userlist/archive/504/765.html I played with it a little and ended up with this ( I took out the 3l33t column sorting bit though ;) REBOL [ row-item: make object! [ val1: copy "" val2: copy "" val3: copy "" ] list-data: copy [] for i 1 50 1 [ append list-data make row-item [ val1: reform ["Item" i] val2: "Column number 2" val3: "Col 3"] ] onSel: func [row-index] [ itm: pick list-data row-index if none? itm [exit] print reform ["picked:" itm/val1] ] ;- For the scroll bar cnt: 0 sel: -1 curr: 0 count: 0 data-list: layout [ origin 0x0 space 0x0 across button "Col1" 50 button "Col2" 180 button "Col3" 74 return tbl: list 300x200 [ origin 0 pad 0x0 across space 0 txt 50x20 [sel: curr unfocus show tbl onSel sel] txt 180x20 [sel: curr unfocus show tbl onSel sel] txt 74x20 [sel: curr unfocus show tbl onSel sel] ] supply [ curr: count + cnt face/text: copy "" face/color: ivory if even? count [face/color: ivory - 20.20.20] row-itm: pick list-data curr if none? row-itm [exit] switch index [ 1 [ str: row-itm/val1 ] 2 [ str: row-itm/val2 ] 3 [ str: row-itm/val3 ] ] face/text: str face/font/color: black if sel = curr [face/color: 160.255.160] ] sld: slider 16x200 [ c: max 0 to-integer (length? list-data) * value if c <> cnt [cnt: c show tbl ] ] ] view data-list ] One thing I'm not sure of how to do though, is to make this into a reusable widget. Could anyone give me an idea of where to start on that? HTH, Felix ----- Original Message ----- From: "alan parman" <[reboler--programmer--net]> To: <[rebol-list--rebol--com]> Sent: Tuesday, April 16, 2002 11:05 AM Subject: [REBOL] Re: Info on 'list style
> Thanks for the pointers, Anton and Geza! > > I now have nearly complete success with what I wanted to do with 'list and
supply.
> One more thing though, if you all would be so kind... > > Anton's scroller demo is still a bit complex for me (especially given that
I am still learning the 'list style). Anton, the demo mentions that your special scroller style is not necessary for scrolling a 'list.
> What are the essentials for scrolling a 'list? > (I know about 'scroll-para and have and have used 'crop on images, and
investigated the origin method, but none of these work on 'list). Is it similar to a 'text-list, with face/sld/data and face/sn, etc?