2010-05-26 51 views
0

我想用3个参数为以下徽标徽章创建向导。我可以使标题动态,但对于图像和渐变,它是硬编码的,因为我看不出如何使它们变为动态。图片后的代码如下:如何为此徽标创建向导创建动态面板布局?

alt text http://reboltutorial.com/bugs/wizard1.png

alt text http://reboltutorial.com/bugs/wizard2.png

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 
+0

我还没有使用绘制方言,所以我对自己在这里会做些什么感到困惑。有一些使用* compose *和绘制方言来构建规范的示例,但没有一个在构建规范后对其进行了修改。也许是在AltME上提出的一个问题。 – HostileFork 2010-05-27 18:27:05

回答

1

使该块用于第二布局的模板。

把你想要有变量,并与()

渲染时,做一个拷贝/深做一个模板拷贝,然后撰写/深,以取代从参数屏幕所采取的变量,创建环绕从您的模板副本中进行布局,并将窗格设置为新布局。