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

dynamically set labels and choices in view

 [1/2] from: mgh520::yahoo::com at: 6-Sep-2001 21:49


I have a layout contained within an object, like this: REBOL[] context-spec: [ name: "Edna Crabapple" page-layout: layout [ 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 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.

 [2/2] 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
<<quoted lines omitted: 11>>
> ; 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
<<quoted lines omitted: 28>>
> for those things are set in stone once REBOL evaluates > the layout block.
-- Carl Read

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted