Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: How to create different context in View?

From: ale870:gmai:l 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. > 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 > > 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: > > > 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: > > > > 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 > > > > > > > > > > > > -- > > > > To unsubscribe from the list, just send an email to > > > > lists at rebol.com with unsubscribe as the subject. > > -- > > To unsubscribe from the list, just send an email to > > lists at rebol.com with unsubscribe as the subject. > > > > > > -- > > --Alessandro
-- --Alessandro