[REBOL] Re: binding object content to layout items ...
From: gjones05:mail:orion at: 24-May-2001 10:05
From: "Petr Krenzelok"
> Is there also any easy way of how to auto-layout object to window?
> >
GSJ> > I am sorry, Petr, I am not sure what you mean by this. Can you
explain
GSJ> > it in different words?
> >
>
> Well, I had it almost done one day during some earlier beta View
stage. I
> mean - you take object (pairs of word-name + word-value) and will
create
> layout in such way, that word-name will serve you as description for
field,
> and word-value will be put into field ...
>
> e.g.:
>
> obj: context [
> Name: "Petr Krenzelok"
> Email: [petr--krenzelok--trz--cz]
> ]
>
> should result in:
>
> lo: layout [
> across
> text "Name:" name: field obj/name
> text "Email:" email: field obj/email
> ]
>
> ... or something like that ..
Hi, again, Petr,
Here is a very generic layout method. It generates labels, fields and
data from a data object:
obj: context [
Name: "Petr Krenzelok"
Email: to-string [petr--krenzelok--trz--cz]
]
lo-data: copy []
for idx 2 length? first obj 1 [
fn: pick first obj idx
fv: pick second obj idx
append lo-data reduce [
'text rejoin [fn ":"]
to-set-word fn 'field fv
]
]
view layout lo-data
Hope this is close to what you are looking for, or at least adaptable.
--Scott Jones