BUTTON is odd widget out
[1/6] from: joel::neely::fedex::com at: 2-May-2001 7:10
As the following code demonstrates, BUTTON seems to be an antisocial
little tyke who will get marks off in "plays well with others". ;-)
This raises two questions for me:
1) Is this a bug or a "feature"?
2) Are there any nice work-arounds?
-jn-
8<-------------------------------------------------------------------
#!/usr/local/bin/rebol
rebol []
test2: make object! [
counter: 0
counter-text: to-string counter
fix-text: func [thingie] [
thingie/text: counter-text
show thingie
]
the-head: the-text:
the-vhead: the-vtext:
the-field: the-info:
the-button: the-label:
the-recount: the-close: none
uiSpec: [
the-head: h3 counter-text 50x20
the-text: text counter-text 50x20
the-vhead: vh3 counter-text 50x20
the-vtext: vtext counter-text 50x20
the-field: field counter-text
the-info: info counter-text
the-button: button counter-text
the-label: label counter-text 50x20
the-recount: button "Recount" [
counter-text: to-string counter: 1 + counter
fix-text the-head
fix-text the-text
fix-text the-vhead
fix-text the-vtext
fix-text the-field
fix-text the-info
fix-text the-button
fix-text the-label
]
the-close: button "Close" [unview]
]
ui: layout uiSpec
run: function [][][
view center-face ui
]
]
test2/run
8<-----------------------------------------------------------------
[2/6] from: c:brizell:worc:ac at: 2-May-2001 14:30
Also why if you change the value of the "field" widget and then mouse over
the "button", or click the widgets (apart from label) do they take the value
that was entered in the "field" widget?
[3/6] from: arolls:bigpond:au at: 2-May-2001 23:17
If you don't initialise the button in the initial layout,
in uiSpec:
the-button: button ;counter-text
it updates correctly.
I don't know why button acts this way either.
Anton.
[4/6] from: allenk:powerup:au at: 2-May-2001 23:46
----- Original Message -----
From: "Joel Neely" <[joel--neely--fedex--com]>
To: <[rebol-list--rebol--com]>
Sent: Wednesday, May 02, 2001 10:10 PM
Subject: [REBOL] BUTTON is odd widget out
> As the following code demonstrates, BUTTON seems to be an antisocial
> little tyke who will get marks off in "plays well with others". ;-)
>
> This raises two questions for me:
>
> 1) Is this a bug or a "feature"?
> 2) Are there any nice work-arounds?
Hi Joel,
Not a bug, but the nature of styles that can display alternate texts related
to the face's state. (such as button, toggle, choice). Such styles hold
their text
display texts in a face/texts block. Other styles do similar with face/color
and face/colors
I have modified fix-text to show the button with alt-text when it is
PRESSED, (second texts is for demonstration only, not needed in your code)
fix-text: func [thingie] [
thingie/text: counter-text
if in thingie 'texts [
thingie/texts: reduce [counter-text "PRESSED"]
probe thingie/texts
]
show thingie
]
Cheers,
Allen K
[5/6] from: allenk:powerup:au at: 3-May-2001 0:05
----- Original Message -----
From: "Colin Brizell" <[c--brizell--worc--ac--uk]>
To: <[rebol-list--rebol--com]>
Sent: Wednesday, May 02, 2001 11:30 PM
Subject: [REBOL] Re: BUTTON is odd widget out
> Also why if you change the value of the "field" widget and then mouse over
> the "button", or click the widgets (apart from label) do they take the
value
> that was entered in the "field" widget?
That's because the string value wasn't copied in the assignment, should be
thingie/text: copy counter-text, to avoid this. (standard REBOL rules on
assignment apply in View too)
Cheers,
Allen K
[6/6] from: agem:crosswinds at: 2-May-2001 15:24
>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<
Am 02.05.01, 13:10:02, schrieb Joel Neely <[joel--neely--fedex--com]> zum
Thema [REBOL] BUTTON is odd widget out:
> As the following code demonstrates, BUTTON seems to be an antisocial
> little tyke who will get marks off in "plays well with others". ;-)
> This raises two questions for me:
> 1) Is this a bug or a "feature"?
> 2) Are there any nice work-arounds?
1) feature (no quotes:) : pressed/unpressed texts available
2) yes, change face/texts/1 .
[rebol []
a: get-style 'button
print "button-redraw:"
probe get in a/feel 'redraw
test2: make object! [
counter: 0
counter-text: to-string counter
fix-text: func [thingie] [
thingie/text: copy counter-text ;better copy..
show thingie
]
the-head: the-text:
the-vhead: the-vtext:
the-field: the-info:
the-button: the-label:
the-recount: the-close: none
uiSpec: [
the-head: h3 counter-text 50x20
the-text: text counter-text 50x20
the-vhead: vh3 counter-text 50x20
the-vtext: vtext counter-text 50x20
the-field: field counter-text
the-info: info counter-text
the-button: button counter-text "pressed"
the-label: label counter-text 50x20
the-recount: button "Recount" [
counter-text: to-string counter: 1 + counter
fix-text the-head
fix-text the-text
fix-text the-vhead
fix-text the-vtext
fix-text the-field
fix-text the-info
;fix-text the-button
the-button/texts/1: counter-text show the-button
fix-text the-label
]
the-close: button "Close" [unview]
]
ui: layout uiSpec
run: function [][][
view center-face ui
]
]
test2/run
]