tags:

views:

29

answers:

1

I want to create a wizard for the logo badge below with 3 parameters. I can make the title dynamic but for image and gradient it's hardcoded because I can't see how to make them dynamic. Code follows after pictures:

alt text

alt text

custom-styles: stylize [
  lab: label  60x20 right bold middle font-size 11
  btn: button 64x20 font-size 11 edge [size: 1x1]
  fld: field  200x20 font-size 11 middle edge [size: 1x1]
  inf: info   font-size 11 middle edge [size: 1x1]
  ari: field wrap font-size 11 edge [size: 1x1] with [flags: [field tabbed]]
]

panel1: layout/size [

    origin 0 space 2x2 across
        styles custom-styles
    h3 "Parameters" font-size 14 return 
    lab "Title" fld_title: fld "EXPERIMENT" return 
    lab "Logo" fld_logo: fld "http://www.rebol.com/graphics/reb-logo.gif" return 
    lab "Gradient" fld_gradient: fld "5 55 5 10 10 71.0.6 30.10.10 71.0.6"
] 278x170

panel2: layout/size [
    ;layout (window client area) size is 278x170 at the end of the spec block
    at 0x0 ;put the banner on the top left corner
    box 278x170 effect [ ; default box face size is 100x100
      draw [
        anti-alias on
        line-width 2.5 ; number of pixels in width of the border
        pen black      ; color of the edge of the next draw element

        fill-pen radial 100x50 5 55 5 10 10 71.0.6 30.10.10 71.0.6

        ; the draw element
        box     ; another box drawn as an effect
          15     ; size of rounding in pixels
          0x0 ; upper left corner
          278x170 ; lower right corner
      ]
    ]
    pad 30x-150
    Text fld_title/text font [name: "Impact" size: 24 color: white]
    image http://www.rebol.com/graphics/reb-logo.gif
] 278x170

main: layout [
    vh2 "Logo Badge Wizard"
    guide
    pad 20
    button "Parameters" [panels/pane: panel1  show panels ]
    button "Rendering" [show panel2 panels/pane: panel2  show panels]
    button "Quit" [Unview]
    return
    box 2x170 maroon
    return
    panels: box 278x170
]

panel1/offset: 0x0
panel2/offset: 0x0

panels/pane: panel1

view main
+1  A: 

Make the block for the 2nd layout a template.

Put the variables you want there and surround with ( )

When rendering, do a copy/deep to make a template copy, then compose/deep to replace the variables as taken from the parameters screen, create the layout from your copy of the template and set the pane to the new layout.

Graham Chiu