How to create different context in View?
[1/9] from: ale870::gmail::com at: 24-Jul-2007 7:35
Hello,
I have a problem (my friends say that I have a lot of problems... :-( ).
Can I create a Rebol/View form, separating the contexts inside?
What I want to do, is something like this:
view layout [
context1 [ f: field ]
context2 [ f: field ]
button [
alert context1/f/text
alert context2/f/text
]
]
Is it feasible? I need to refer the same variable name, insulating it.
Obviously, in the previous case, the system renders either context1 or
context2. Final output, when program starts, could be something like:
|==== field in context1 =====|
|==== field in context2 =====|
|== button ==|
Thank you!
--
--Alessandro
[2/9] from: christian::ensel::gmx::de at: 24-Jul-2007 21:58
Hi Alessandro,
> Can I create a Rebol/View form, separating the contexts inside?
>
Yes, you can do so, although it's somewhat cumbersome:
------------------------------------------------------------------------
rebol []
foo: context [field: none]
bar: context [field: none]
output: does [print ["foo/field:" foo/field/text tab "bar/field:"
bar/field/text]]
view layout probe compose [
across
label "foo/field:"
(bind [field:] in foo 'self) field [output]
return
label "bar/field:"
(bind [field:] in bar 'self) field [output]
]
------------------------------------------------------------------------
HTH,
Christian
[3/9] from: btiffin:rogers at: 24-Jul-2007 17:02
Hi,
Anton Rolls came up with this for a RebGUI question I had
oneset: context [field: none]
twoset: context [field: none]
; Anton's magic to set-word! trick
view layout compose [
=C2=A0 =C2=A0 (to set-word! in oneset 'field) field
=C2=A0 =C2=A0 (to set-word! in twoset 'field) field
=C2=A0 =C2=A0 btn "Show the fields" [alert oneset/field/text =C2=A0alert twoset/field/text]
]
On Tuesday 24 July 2007 15:58, Christian Ensel wrote:
[4/9] from: moliad:g:mail at: 24-Jul-2007 21:15
hi,
my god... why is everyone trying to do strange tricks! even composing a
block to get to your ends!!!
has everyone forgotten why the do word is defined within VID's dialect?
this is THE real solution ;-)
rebol []
view layout [
fld: field
do [fld_a: context [value: fld]]
fld: field
do [fld_b: context [value: fld]]
button [
print fld_a/value/text
print fld_b/value/text
]
]
-MAx
On 7/24/07, Alessandro Manotti <ale870-gmail.com> wrote:
[5/9] from: btiffin::rogers::com at: 24-Jul-2007 22:34
Maxim; I like your sequence (and thanks for that), but I'm sticking with the
trick Anton clued me into. :)
It allows for creation of RebGUI and View apps with ONE exposed global name, a
master object. Make it an un set-word'ed context and a gui app with full
cross field checks and balances, linked scrollers et al, can be made that
exposes ZERO namespace entries. The (to set-word! in object 'member) is
staying in my bag of tricks. It allows for some pretty powerful object based
gui building with the added bonus of not littering.
Christian; I like your solution too. A nice exercise in bindology. I
learned something by reading it.
Cheers,
Brian
On Tuesday 24 July 2007 21:15, Maxim Olivier-Adlhoch wrote:
[6/9] from: ale870::gmail::com at: 25-Jul-2007 16:56
Hello,
first of all: thank you for everybody.
I learned a lot of tips & tricks!!!!!
I created a "final " solution for my needs (I will use it).
This is the (working) code:
t: make object! [
myValue: "Z"
getValue: does [ myValue ]
t1: none
f: bind [ t1: button "Show value" [t1/text: getValue show t1] ] 'self
]
l: layout [
do [
a: make t [myValue: "A"]
]
do [
b: make t [myValue: "B"]
]
button "Alert <A>" [prin "Valore A: " a/myValue: input]
button "Alert <B>" [prin "Valore B: " b/myValue: input]
pa: box 300x100
pb: box 300x100
]
pa/pane: layout a/f
pb/pane: layout b/f
view l
I hope this could help someone.
Thank you!
On 7/25/07, Brian Tiffin <btiffin-rogers.com> wrote:
> Maxim; I like your sequence (and thanks for that), but I'm sticking with
> the
<<quoted lines omitted: 82>>
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
--
--Alessandro
[7/9] from: ale870:gm:ail at: 25-Jul-2007 18:26
Hello,
based on the following code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rebol []
t: make object! [
myValue: "Z"
getValue: does [ myValue ]
t1: none
f: bind [ t1: button "Show value" [t1/text: getValue show t1] ] 'self
]
a: make t [myValue: "A"]
b: make t [myValue: "B"]
l: layout [
button "Alert <A>" [prin "Valore A: " a/myValue: input]
button "Alert <B>" [prin "Valore B: " b/myValue: input]
pa: box 300x100
pb: box 300x100
]
pa/pane: layout a/f
pb/pane: layout b/f
view l
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Is there any way to dynamically create in context variables (t1) based on
the contents of f?
Why final target is creating vars like t1 with a function, so the final user
does not need to make them one by one.
(as soon as I finished, I will post my final project, almost completed,
called "Laccio". It is a toolkit to create a system to make "components"
reusable, standardized, and based on MVC modelling).
Thank you!
On 7/25/07, Alessandro Manotti <ale870-gmail.com> wrote:
> Hello,
> first of all: thank you for everybody.
<<quoted lines omitted: 128>>
> --
> --Alessandro
--
--Alessandro
[8/9] from: sant4::wanadoo::fr at: 25-Jul-2007 20:03
I will do like this:
make-panel: func [a /local obj][
obj: construct append cp [panel: none] a
obj/panel: bind/copy a in obj 'self
obj
]
a: make-panel [t1: field 100 [print t1/text]]
b: make-panel [t1: field 100 [print t1/text]]
view layout [
panel a/panel
panel b/panel
btn "a" [print a/t1/text]
btn "b" [print b/t1/text]
]
[9/9] from: moliad::gmail::com at: 26-Jul-2007 12:05
hehe,
after 7-8 years of doing rebol, I learn there is a panel style in VID !
just funny how some little things slip past our conscience. :-)
-MAx
On 7/25/07, Steeve ANTOINE <sant4-wanadoo.fr> wrote:
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted