Home   Archive   Permalink



List with dynamic faces

Can list handle dynamic faces?
    
R ebol[
    purpose: 'dynamic face list'
]
dynamic-face: []
x: copy [] loop 10 [append x reduce [ random 'abcd']]
    
view center-face layout g: [
    across
    li: list 330x400 [
     across
     :dynamic-face
     rec-no: text 20    
     text 330 blue
    
    ] supply [
        face/text: either count > length? x [''][pick x count]
        rec-no/text: count
        
        either (modulo rec-no/text 2) = 0
            [ dynamic-face: ['button]]
            [ dynamic-face: []]
    ]
]

posted by:   OneArb       15-Mar-2017/18:26:33-7:00



You can't do dynamic faces in that way. Remember that in a list, there is effectively one pane with one group of sub-faces that are re-shown as many times as they'll fit in the list face. Your best bet here is to hide the face when it represents data where hiding is appropriate.
    
Also remember that supply is iterated over every row (count) and every face within the row (index).
    
     li: list 330x400 [
         across
         button "Do Something" [probe face/data]
         text 20
         text 330 blue
    
     ] supply [
         ; probe as-pair count index ; shows the operative 'position'
         switch index [
             1 [
                 face/show?: zero? modulo count 2
                 face/data: pick x count
             ]
             2 [face/text: form count]
             3 [face/text: pick x count]
         ]
     ]

posted by:   Chris       15-Mar-2017/19:14:04-7:00



Name:


Message:


Type the reverse of this captcha text: "f o - m u m i n i m"



Home