[REBOL] Re: Forms with separate context
From: gscottjones:mchsi at: 15-Dec-2002 16:53
From: "Davide Gessi"
...
> After this example I understood that the context of "titolo" isn't the
> object chat, but it's the global context, and I have only one var
titolo
.
> Now my big question is: what is the best method to have a collection of
> similar form, with separate context for each of them ?
...
> But I would investigate if a better method exists.
> Hope my question is clear, my english is poor :(
...
full post:
http://www.escribe.com/internet/rebol/m28775.html
Hi, Davide,
I don't know if I can provide the *best* method, but here is one that
demonstrates several little tricks that may help:
REBOL []
chatters: copy []
chat: make object! [
nome: copy ""
frm: [
(to-set-word join 'titolo nome) h2 (join "Chatting with: " nome)
area
]
show: does [
view/new frm-chat: layout compose frm
do [
append chatters to-word join 'titolo nome
chatters: unique chatters
]
]
]
chat1: make chat [
nome: "Davide"
]
chat2: make chat [
nome: "Luca"
]
view layout [
button "Show Davide" [chat1/show]
button "Show Luca" [chat2/show]
button "Print values" [
foreach chatter chatters [
print get in do chatter 'text
]
]
]
Hope that helps.
--Scott Jones