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

[REBOL] Re: dynamically set labels and choices in view

From: carl:cybercraft at: 7-Sep-2001 18:28

On 07-Sep-01, Mike wrote:
> I have a layout contained within an object, like this: > REBOL[] > context-spec: [ > name: "Edna Crabapple" > page-layout: layout [
Remove 'layout (just the word) from the above and...
> size 640x480 > below > h2 "Test" > return > label name > button "Print Value" [print ["name in > button action:" > name]] > ] > ] > myview: make object! context-spec > myview/name: "Homer Simpson" > print myview/name > ; will always show "Edna Crabapple" in the label > view myview/page-layout
...place it after the 'view above. I think that should work. (My understanding of context is pretty limited.) As you had it, your layout would've been built when the myview object was made and so 'name in the layout would've been pointing to "Edna Crabapple". (Well, I think that's what would've been happening...) Hope this helps - is right. (:
> My original problem was with the action of the button > always printing "Edna Crabapple", but that was > resolved (thanks to help from this list) by creating a > context-spec to make the object from. > But now the problem is the label. The label will > always get displayed as "Edna Crabapple" because the > value is determined the first time the layout block is > evaluated and then never again. So even though I > change the name variable, I can't get that name to > display the first time I "view myview/page-layout". > What I want is to have labels and the options of a > choice field populated from the "outside" of myview > rather than hard coded in there. Any ideas or > suggestions would be appreciated. > mike > p.s. extra detail: > what I really have here is a layout with many choice > fields, each with a label and several options. So I > retrieve xml from a server, where the xml contains > something like: > <Fields> > <Field name="firstName" labelText="First Name"/> > <Field name="state" labelText="State"> > <Option text="Alabama"/> > <Option text="Arkansas"/> > ... > </Field> > </Fields> > Then this xml will be used to set the labels and > options for the layout. But my problem is the values > for those things are set in stone once REBOL evaluates > the layout block.
-- Carl Read