Baffled as usual!
[1/2] from: rgaither::triad::rr::com at: 10-Oct-2000 19:31
Hi All,
I managed to work through a little example to put up on my REBOL/View site back when
the
new View panel was first introduced. Since then some change in the product has broken
my
little script and I'm having trouble figuring it out.
I'm sure it is something simple but I figured now is a good time for some help as well
as some
peer review! :-)
Here it is - also to be found under the ModernLore REBSite.
REBOL [
Title: "Show hex/binary for string characters"
Author: "Rod Gaither"
Email: [rgaither--triad--rr--com]
File: %showhexbin.r
Date: 10-October-2000
Purpose: {Show hex/binary versions of a string.}
]
show-all: func [letters [string!] /local str] [
str: ""
clear str
foreach char letters [
insert tail str reform [
char " "
find/last/any (to-hex to-integer char) "??" " "
enbase/base to-string char 2 " "
to-integer char
#"^(line)"
]
]
return str
]
view layout [
subtitle "String to Hex/Binary"
across
text "String:" value: field button "Go" [result/text: show-all value/text show result]
return
text "Results:" result: area with [size: 300x120 font: [name: font-fixed]] return
]
TIA, Rod.
p.s. When is that REBOL for Dummies book shipping? :-)
Rod Gaither
[rgaither--triad--rr--com]
Oak Ridge, NC
[2/2] from: jkinraid:clear at: 10-Oct-2000 21:03
Hello,
> view layout [
> subtitle "String to Hex/Binary"
> across
> text "String:" value: field button "Go" [result/text: show-all value/text show
result] return
> text "Results:" result: area with [size: 300x120 font: [name: font-fixed]] return
> ]
The problem is that your using a variable called 'value, which is also a
variable inside the button object. The code that gets run when you
press the button is stored inside the button object, and when it runs
the code, it doesn't use the global 'value variable. Like this -
>> value: 100
== 100
>>
>> button: make object! [ value: none do-this: does [print value]]
>> button/do-this
none
>>
Julian