Home   Archive   Permalink



Cannot use path on word! value

Hi guys: I'm trying to change (by code) the state of several toggles every time the user clicks on a check box. This is my code and the error message I receive. Why? How can I do that? Thanks
    
R E B O L []
    
view layout [
    chkAll: check-line "All of them" [
    foreach tg [tgA tgB tgC] [tg/state: chkAll/data show tg]]
    tgA: toggle "A"
    tgB: toggle "B"
    tgC: toggle "C"
]
    
** Script Error: Cannot use path on word! value
** Where: func [face value][foreach tg [tgA tgB tgC] [tg/state: chkAll/data show tg]]
** Near: tg/state: chkAll/data show tg

posted by:   cosacam       25-Mar-2019/9:43:39-7:00



Ok, after digging anywhere I took an idea from vid-build.r, here is the solution:
    
R E B O L []
    
view w: layout [ ; use w to get every face in the layout
         ; next, use face instead of tg so i can reach the state refinement
         ; of course, not all faces are toggles so check it out first
    chkAll: check-line "All of them" [foreach face w/pane [if face/style = 'toggle [face/state: chkAll/data show face]]]
    
    tgA: toggle "A"
    tgB: toggle "B"
    tgC: toggle "C"
]
    
Now it works fine

posted by:   cosacam       29-Mar-2019/11:02:36-7:00



Name:


Message:


Type the reverse of this captcha text: "g r a - d i l a v n i"



Home