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

[REBOL] Re: Dynamically Changing the 'text of Button

From: agem:crosswinds at: 18-Jun-2001 16:23

RE: [REBOL] Re: Dynamically Changing the 'text of Button [gjones05--mail--orion--org] wrote:
> From: "CRS - Psy Sel/SPO, COUSSEMENT, Christophe, CPN" > > A little problem I couldn't resolve right now: how can I dynamically change > > the 'text property of a button ? > > > > Let's consider this code: > > > > <snip> > > > > rebol [] > > > > view layout [ > > b: button "First Text" > > button "Change" [ > > b/text: "Second Text" > > print ["Button *Change* pressed:" b/text] > > show b > > ] > > button "Echo" [ > > print ["Button *Echo* pressed:" b/text] > > ] > > ] > > > > </snip> > > > > I got: > > > > >> do %test.r > > Button *Change* pressed: Second Text > > Button *Echo* pressed: First Text > > > > And, of course, the 'text of b wasn't updated ;-( > > > > How come ? > > Hi, Christophe, > > I offer the following option but I have to admit that I do not know why this > works, nor why button is different than the other controls. Note that a block > is passed to b/texts (which is the plural form): > > view layout [ > b: button "First Text" > button "Change" [ > b/texts: ["Second Text"] > print ["Button *Change* pressed:" b/text] > show b > ] > button "Echo" [ > print ["Button *Echo* pressed:" b/text] > ] > ] >
because of view layout [ b: button "First Text" button "Change" [ b/texts: ["Second Text" "Third text"] ;! !!! !!! !! print ["Button *Change* pressed:" b/text] show b ] button "Echo" [ print ["Button *Echo* pressed:" b/text] ] ]