[ALLY] Re: object to layout?
[1/3] from: larry:ecotope at: 30-Apr-2001 15:47
Hi Ingo
Fun question. Here's my cut.
Third OBJECT turns the object back to a block of setword value pairs. Using
your example:
>> third a
== [t1: "Text1" t2: "Text2"]
Then it is easy to manipulate:
>> b: copy []
== []
>> foreach [setword string] third a [
append b compose [
text (form :setword) (:setword) field (string) tab]]
== [text "t1" t1: field "Text1" tab text "t2" t2: field "Text2" tab]
This is close to what you want.
Perhaps others see a more elegant solution.
-Larry
[2/3] from: ingo::2b1::de at: 30-Apr-2001 23:23
Hi Rebols,
has anyone an idea how best to create a layout from an object! ?
assume I have:
a: make object! [t1: "Text1" t2: "Text2"]
I want to create a layout like this:
[ text "t1" tab t1: field return text "t2" tab t2: field ]
with the fields set to the respective strings from the object!
I am halfway there, but my solution seems much to complicated ...
thanks in advance,
Ingo
[3/3] from: ingo:2b1 at: 1-May-2001 6:36
Thanks Larry,
we were nearly there, the following is what I wanted (this
way changes in the fields are reflected in the object) ...
>> data: make object! [ test1: "The first test" test2: "the next test" ]
>> lay: copy [across tabs 60]
== [across tabs 60]
>> foreach elem next first data [
[ append lay compose [text (to-string :elem) tab
[ (to-set-word :elem) field (to-path reduce ['data :elem]) return]
[ ]
== [across tabs 60 text "test1" tab test1: field data/test1 return text "test2" tab test2:
field data/test2 return]
>> view layout lay
thanks again ...
Once upon a time Larry Palmiter spoketh thus:
> Hi Ingo
> Fun question. Here's my cut.
<<quoted lines omitted: 42>>
> [ally-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
do http://www.2b1.de/
_ . _
ingo@)|_ /| _| _ <We ARE all ONE www._|_o _ _ ._ _
www./_|_) |o(_|(/_ We ARE all FREE> ingo@| |(_|o(_)| (_|
._| ._|
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted