Red [ needs 'view ] doup: true mkp: func [ ] [ n: copy [] append n [ below ] repeat i 2 [ append n compose/deep [ (to-set-word rejoin [ "list" (i) ]) text-list 280x80 data [ "one" "two" ] select 1 on-change [ ;print [ "list on-change triggered and doup is" doup ] if doup [ doup: false (to-set-path rejoin [ "edit" (i) " text" ]) (quote face/data/(face/selected)) doup: true ] ] (to-set-word rejoin [ "edit" (i) ]) field 280x30 on-change [ ;print [ "field on-change triggered and doup is" doup ] if doup [ if (quote face/text) <> "" [ doup: false (to-set-path rejoin [ "list" (i) " data" "(list" (i) "/selected)" ]) face/text doup: true ] ] ] pad 0x30 ] ] probe n n ] view/tight [ title "face from func test - onchange" aa: panel 300x320 30.30.30 [ ] do [ append aa/pane layout/only mkp ] ]
Red [ needs 'view ] a: [ "one" "two" "three" ] doup: true view [ panel 200x500 [ below text "list block 'a'^/changes field below" aa: text-list 180x100 data a select 1 on-change [ if doup [ doup: false bb/text: a/(aa/selected) doup: true ] ] pad 0x30 text "changes a/(listbox/selected)^/via on-change which^/auto-updates the listbox^/but not the field below" bb: field 180x30 with [ text: "one" ] on-change [ if doup [ a/(aa/selected): face/text probe a ] ] pad 0x30 text "this is linked to a/2^/but doesn't update fields^/above" cc: field 180x30 with [ text: a/2 ] on-change [ probe a ] ] ]
a/2: face/text (or even a/2: a/2) in cc's on-change actor. data is included in the reactive system while a field's text isn't and has to be set explicity.data transfers ownership to aa of both a and it's subseries. Then text takes ownership of aa/2 only from aa and gives it to cc. So aa won't see the changes in a/2 anymore but it will see changes in a, that's why your a/thing: other-thing works, but the other one not.text-list 280x80 data copy/deep [ "one" "two" ] because you're assigning the *same* block to both lists, which is clearly gonna go south.a itself, yes.[ "one" "two" ] as it exists in the function *is* whatever is duplicated in the output block... even though it has no name (like theblock: [ "one" "two" ])Red [ needs 'view ] txtscroll: object [ on-wheel: function [face event] [ print [ "we're scrollin..." ] ] on-down: function [face even] [ print [ "click works" ] ] ] view/tight [ panel 50x50 [ below center t: text "10" ] do [ t/actors: txtscroll probe t/actors ] ]