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

Stylize / feel question

 [1/3] from: atruter:hih:au at: 27-Mar-2002 18:54


Given the following code, why does print-field return different results? How can I ensure that "B" is returned in both cases? stylize/master [ box2: box with [ field1: "A" print-field: does [print field1] feel: make feel [ engage: func [face action event] [ if action = 'down [print-field] ] ] ] ] view layout [ text "Click on box to print field" text "Click on button to print same field" a: box2 red button "Print" [a/print-field] do [a/field1: "B"] ] Regards, Ashley

 [2/3] from: atruter::hih::com::au at: 28-Mar-2002 10:02


Given the following code, why does print-field return different results? How can I ensure that "B" is returned in both cases? stylize/master [ box2: box with [ field1: "A" print-field: does [print field1] feel: make feel [ engage: func [face action event] [ if action = 'down [print-field] ] ] ] ] view layout [ text "Click on box to print field" text "Click on button to print same field" a: box2 red button "Print" [a/print-field] do [a/field1: "B"] ] Regards, Ashley

 [3/3] from: brett:codeconscious at: 28-Mar-2002 19:23


Hi Ashley, The direct answer is that there are two "FIELD1" words being used here. One lives in (is bound to) the context of the BOX2 style object, the other is in the A face object. When your feel/engage function was created the reference to FIELD1 was within in the context of the style BOX2. If you want the engage function to refer to the face call face/print-field . I've changed your example to show these things. stylize/master [ box2: box with [ field1: "A" print-field: does [print field1] feel: make feel [ engage: func [face action event] [ if action = 'down [print-field] if action = 'up [face/print-field] ] ] ] ] view layout [ text "Click on box to print field" text "Click on button to print same field" a: box2 red button "Print" [a/print-field] do [a/field1: "B"] button "Change style" [ set in get-style 'box2 'field1 "C" ] ] Regards, Brett