Home   Archive   Permalink



Scrolling a list

I am trying to explain how to scroll a list, and I realize that I don't know how and don't even know if it can be done. Is it possible to scroll a list, or is a list designed to hold a small and fixed number of items? I do know how to scroll a text-area, but a list doesn't seem to contain the same kind of data as a text-area. A text-area is a big string of text. A list is a block of items.
    
Thank you.
    
R E B O L [
     Title: 'VID test harness'
]
    
view layout [
     label 'No default list size'
     across
     DEMO-LIST: list 200x200 [
             across
             text 100 [print ['clicked ' value]]
             text 100 [print ['clicked ' value]]
         ]
         data [
             ['Item 01-01' 'Item 02-01']
             ['Item 01-02' 'Item 02-02']
             ['Item 01-03' 'Item 02-03']
             ['Item 01-04' 'Item 02-04']
             ['Item 01-05' 'Item 02-05']
             ['Item 01-06' 'Item 02-06']
             ['Item 01-07' 'Item 02-07']
             ['Item 01-08' 'Item 02-08']
             ['Item 01-09' 'Item 02-09']
             ['Item 01-10' 'Item 02-10']
             ['Item 01-11' 'Item 02-11']
             ['Item 01-12' 'Item 02-12']
             ['Item 01-13' 'Item 02-13']
             ['Item 01-14' 'Item 02-14']
             ['Item 01-15' 'Item 02-15']
             ['Item 01-16' 'Item 02-16']
             ['Item 01-17' 'Item 02-17']
             ['Item 01-18' 'Item 02-18']
             ['Item 01-19' 'Item 02-19']
             ['Item 01-20' 'Item 02-20']
         ]
     SCROLL-BAR: scroller 20x200 [
     ; ?????
     ]
]


posted by:   Steven White       24-Sep-2015/16:21-7:00



http://www.rebol.org/ml-display-message.r?m=rmlQTQS


posted by:   Gorf       24-Sep-2015/19:14:28-7:00



These may be helpful too:
    
http://business-programming.com/business_programming.html#section-8.1
    
http://business-programming.com/business_programming.html#section-17.21
    
http://business-programming.com/business_programming.html#section-21.3

posted by:   Nick       24-Sep-2015/20:41:20-7:00



Look for the examples in 17.21 which start with this:
    
x: copy [] for i 1 397 1 [append x i]
    
slider-pos: 0
view layout [
     across
     the-list: list 240x400 [text 200] supply [
         count: count + slider-pos
         face/text: pick x count
     ]
     slider 16x400 [
         slider-pos: (length? x) * value
         show the-list
     ]
]
    
You could do your example above like this:
    
R E B O L [
     Title: "VID test harness"
]
data: [
     ["Item 01-01" "Item 02-01"]
     ["Item 01-02" "Item 02-02"]
     ["Item 01-03" "Item 02-03"]
     ["Item 01-04" "Item 02-04"]
     ["Item 01-05" "Item 02-05"]
     ["Item 01-06" "Item 02-06"]
     ["Item 01-07" "Item 02-07"]
     ["Item 01-08" "Item 02-08"]
     ["Item 01-09" "Item 02-09"]
     ["Item 01-10" "Item 02-10"]
     ["Item 01-11" "Item 02-11"]
     ["Item 01-12" "Item 02-12"]
     ["Item 01-13" "Item 02-13"]
     ["Item 01-14" "Item 02-14"]
     ["Item 01-15" "Item 02-15"]
     ["Item 01-16" "Item 02-16"]
     ["Item 01-17" "Item 02-17"]
     ["Item 01-18" "Item 02-18"]
     ["Item 01-19" "Item 02-19"]
     ["Item 01-20" "Item 02-20"]
]
slider-pos: 0    
view layout [
     label "No default list size"
     across
     DEMO-LIST: list 200x200 [
         across
         text 100 [print ["clicked " value]]
         text 100 [print ["clicked " value]]
     ] supply [
         count: count + slider-pos
         if none? y: pick data count [face/text: none exit]
         face/text: pick y index
     ]
     slider 16x200 [
         slider-pos: (length? data) * value
         show DEMO-LIST
     ]
]

posted by:   Nick       24-Sep-2015/21:10:51-7:00



You could also use my little shortcut display in 8.1 like this:
    
R E B O L []
    
headers: ["Column1" "Column2"]
    
x: data: [
     ["Item 01-01" "Item 02-01"]
     ["Item 01-02" "Item 02-02"]
     ["Item 01-03" "Item 02-03"]
     ["Item 01-04" "Item 02-04"]
     ["Item 01-05" "Item 02-05"]
     ["Item 01-06" "Item 02-06"]
     ["Item 01-07" "Item 02-07"]
     ["Item 01-08" "Item 02-08"]
     ["Item 01-09" "Item 02-09"]
     ["Item 01-10" "Item 02-10"]
     ["Item 01-11" "Item 02-11"]
     ["Item 01-12" "Item 02-12"]
     ["Item 01-13" "Item 02-13"]
     ["Item 01-14" "Item 02-14"]
     ["Item 01-15" "Item 02-15"]
     ["Item 01-16" "Item 02-16"]
     ["Item 01-17" "Item 02-17"]
     ["Item 01-18" "Item 02-18"]
     ["Item 01-19" "Item 02-19"]
     ["Item 01-20" "Item 02-20"]
]
    
do decompress #{
789CC518C98EDB36F4AEAF78500FB11228B2074D0AA8B3A01F904BAF860EB245
D9CAD0A2225133720CFF7B1F77D24BE324456A60C626F9F69D1C5B4A86015E4A
3A922778B3199B7445D9FA1996F6670E8763118D21E004CB298735EBF6B02CCE
4EC9AEE3FB74E8CA3581A5B7C8615E447B8D3741B46674DCB5430E94B41BBE7D
822D292BD20F91FA36FC25F8E118F5A423258706341E2C23C04FD975A4ADC0C7
819E7C664D0BCB781B237C9C713271888BA83821CD9946F0B7A355734AEFCDB0
1F38D945949595DA22550EF5D8AE615995BC4CEB8612C87AF26524032FB4644D
0D7AC783CACD9E5C65ACA5FB4C625B8842A9C5B9309D26253ED672FA5B08E3B0
2CD8B065AF401BB9161A0FE50BF945320B56C2A6E1194C2885B45C4D4BFECBCD
56A3BDAE98CAC5303870D663C82C606682B29E929388331FC12908D265119C0B
529F610E33839EC22241D2211517C28E1E740DFEAB279835F00E3E271060845C
14B2B40826554FAA11D3CE91B2B09E8E3692FE3D68FE37775D720A29D75BE851
CAE9C47EDA78B5D51D819CD24E43119B4E8B7A72BAB29EA7CA4546DBBA21B432
0A92866F490F128CF55814726819F7D69E4062335BB35D57F618F79A5A092BA4
35C3DA5582A49CC02388E54A2F9594C50FD0B9BF484719CEF8B4889E0956E075
CF28350AAA555AEED8D85A4F0E69C7B01ACB2F0CBB00C6B85A1D3EBAF4C0EC58
6A44BB5584D0F798030666AE2B05CD842F0CB32CA01788AF7F0C14F5E8C9D07C
25E9A66F6C25EB48BF262D2F37C468213A970043DAB268672F0D79CD501942DA
B4C6369475654BB2452680E04F9194F3692E516983012BB6B345EE2FE02D383E
279077B9E598DD2131AFDF4948AE85E9D18A15AAE951F5B4F6BB4D92681369CC
126D54363D2C3EFA6C25CCD84AE564EEA314A0561D6F18561B212FD2142A032D
F76CE4E0357865CBC259B56E30D92B46861FB1A3C4F0DC03336B14A1A7AF750A
EF1709B22DAB2AA54D4B0CD3B014600B9E647F6E50890DE698A927A29567BCE1
58552A529723C5C6FE5755A9E163C082228BC46F79EC178F9D4F89BDF4E9DA45
B4E0040F22447BC2C7BE5501DA92D754910C6BFB597B083C278ABBAE478E80C2
8F639D15ED4030B7A5CB44EE4E5280C48777992B9CB363588AFF2343FD8D7439
0345348FE1E76C8407BC1F09DC3FDA0E6007AFBF150B88552B535A42FC141721
0D254A60095FFD33E52512A355FA5D7A7F123CEA9EEDBE2B38844B6E60A3C90B
BB7AC4D138B399A1206C970086CECC882E7792DBEDF929B4A625736E5161B20C
855126358089D5C66F0C3BAC5463D7511C08825E475E48FB84718B851F9BA1C8
75EC8F0C1BDFEBB6E1A2D2FA7B77BFCFDFCBBF0F1F9404122FD7E8EF5489370A
B6ACC52BC297DC28E2F31026CD4DB600991A6EEDA2DD8256BB20D4DD1C99CF3D
01E4A1EA2F6BDBBC3C1692F717116E44CCA6036D2A34F65E8C2DDA0CED062BBD
9D06B0DF12BF3B3762E701DE8C1DF635373D288238318AFB831E46826B442DF9
BB99643DAAF29CDF88E90B6070E1F1012ED5A230287CA94BCAD38ABD62540DBC
94C2E31493034E69753D104F3C214D8AF1A0653C0463573F7CC5D140F8B96E7A
8CD4966C4A8E898CB54F51C442EFD14F02648C3BE90ED36BC335621AEA01165A
7966D44E2CEEA5DD5B2860642E12ADF3299DF0EC766A9764F24FF0F7454ADBAB
525D3BB926D329BC91E8F2FE35796485D04E399DC44E288939C1E21EED2FBCAC
530112C4101C9CA78E36826FC691FC8E10AE2F86B748CC4B0187C11A6CDB6075
E11F5EB590A8854173DD9FB640F3A95828F5C905448C59A46A785064B04EF7AE
C4B093023363508A81D1543E6C0AB5AC69A26BE8CD5C6F190F19664AB59B4B58
7869D53532E873A691AAC3E0B6182AF9EDA1514EDD29CCA70FF3C88E856E86C6
A39919783FCEFD693A89BE3511FFD0A86DEE25105CF0641F066B66D1B5223DD8
B9195A154429B5151F4ABC350D628693CF5FE666211DAF59C36AE49CB5560B25
2476315861F83FAB1E0B2BECDCD1B71EBD9C2C6650B03E39887FDB23621E72C3
F888C301354F5B4396E319D48450701DF028E604317059979EB1928C0C79FBB6
2173F1DC44B9D156E916F7312CFE9850D72014A5B91FECD483D32366E2536C1F
19F797225CE5A1BE8EA9FB9A0B07FF2E2D6DBF2694828C5E0D2015B74969A1CF
FDF7B34E101F44D4AE90721C3D35507DF3702AE799C15E211C6139A5AA53F45A
7199BB71DC05971DF4C3801AF6C08E7DFAA299EBBBBE78E5A0DA7C3A2FFC7BF9
5B252884CED06E385EE3FA4CF6E26FCD2AA43A765884DC7304A40BF35A118089
F12404BC0CD761894BCF68DECDAF039F5356D0C7C87BF1B6CFC2764FBD093BD5
CC83F03FD2FC2B1641170000
}
view center-face gui: layout gui-block

posted by:   Nick       24-Sep-2015/21:18:42-7:00



Maybe that last example is best given like this:
    
R E B O L [title: "Grid"]
headers: ["Column1" "Column2"]    
x: data: [
     ["Item 01-01" "Item 02-01"]
     ["Item 01-02" "Item 02-02"]
     ["Item 01-03" "Item 02-03"]
     ["Item 01-04" "Item 02-04"]
     ["Item 01-05" "Item 02-05"]
     ["Item 01-06" "Item 02-06"]
     ["Item 01-07" "Item 02-07"]
     ["Item 01-08" "Item 02-08"]
     ["Item 01-09" "Item 02-09"]
     ["Item 01-10" "Item 02-10"]
     ["Item 01-11" "Item 02-11"]
     ["Item 01-12" "Item 02-12"]
     ["Item 01-13" "Item 02-13"]
     ["Item 01-14" "Item 02-14"]
     ["Item 01-15" "Item 02-15"]
     ["Item 01-16" "Item 02-16"]
     ["Item 01-17" "Item 02-17"]
     ["Item 01-18" "Item 02-18"]
     ["Item 01-19" "Item 02-19"]
     ["Item 01-20" "Item 02-20"]
]
do http://re-bol.com/gridlib.r

posted by:   Nick       30-Sep-2015/9:42:31-7:00