AW: Dynamically Changing the 'text of Button
[1/7] from: jean::holzammer::faedv-n::bayern::de at: 18-Jun-2001 15:54
> Hi REBOlian:
> A little problem I couldn't resolve right now: how can I dynamically
<<quoted lines omitted: 7>>
> button "Change" [
> ; b/text: "Second Text"
!!!! CHANGE THIS to:
b/text: "Second Text" show b
[2/7] from: gjones05:mail:orion at: 18-Jun-2001 8:57
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 ?
<<quoted lines omitted: 19>>
> 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]
]
]
--Scott Jones
[3/7] 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
<<quoted lines omitted: 44>>
> ]
> ]
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]
]
]
[4/7] from: gjones05:mail:orion at: 18-Jun-2001 9:51
From "Scott Jones"
> > 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):
...
From: "Volker Nitsch"
> b/texts: ["Second Text" "Third text"] ;! !!! !!! !!
Hi, Volker,
Now I get it. Christophe, the second value in the block is the "depressed"
value. Thanks, Volker.
(Volker, I am still waiting for you to add your name to your email address!!!
;-)
--Scott Jones
[5/7] from: coussement:c:js:mil:be at: 18-Jun-2001 15:18
Hi REBOlian:
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 ?
chr==
[6/7] from: coussement:c:js:mil:be at: 19-Jun-2001 9:04
> >
> > view layout [
<<quoted lines omitted: 11>>
> > ]
> >
[Thanks, Jean, for your answer, but I'm afraid it didn't do the
job...
Please refer to the GS Jones' solution. It works OK !
Thanks anyway
Take care,
chr==]
[7/7] from: coussement:c:js:mil:be at: 19-Jun-2001 9:07
> >From "Scott Jones"
> > > I offer the following option but I have to admit that I do not know
<<quoted lines omitted: 13>>
> ;-)
> --Scott Jones
[Now I get it !!!
Thanks to you both for bringing light to my ignorance ;-) It works
OK !
CU,
chr==]
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted