2011-02-11 34 views
0

默认Rebol VID风格让人眼花缭乱,直言不讳。我开始做我自己的默认,但遇到了一个障碍。也就是说,如何为元素的子元素指定样式?如何设置文本列表和其他元素的风格?

good-looking: stylize [ 
    field: field 
    edge [size: 1x1] 
    colors [255.255.255 255.255.255] 
    area: area 
    edge [size: 1x1] 
    colors [255.255.255 255.255.255] 
    text-list: text-list 
    ;text-list/sub-area/edge [size: 1x1] 
] 

我希望所有字段都有一个薄边框,包括文本列表等。但我不知道如何在文本列表定义中包含该规则。

另外,如何减少样式的重复,就像颜色一样?

+0

这个问题也被提出和回答(或者至少讨论)在上rebolforum:http://www.rebolforum.com/index.cgi?f=printtopic&topicnumber=45 – Sunanda 2011-02-13 14:47:30

回答

0

所以,首先:

layout [X: field] 
type? X/edge 
type? X/colors 

对象应该得到重新制作,以避免对共享那些意想不到的副作用。

good-looking: stylize [ 
    field: field with [ 
    edge: make edge [size: 1x1] 
    colors: copy [255.255.255 255.255.255] 
    ] 
    area: area with [ 
    edge: make edge [size: 1x1] 
    colors: copy [255.255.255 255.255.255] 
    ] 
    text-list: text-list with [ 
    sub-area: make sub-area [ 
     edge: make edge [size: 1x1] 
    ] 
    ] 
] 
1

我可以部分回答你的第一个问题。在REBOL康寿,试试这个...

>> lo: layout [t: text-list]

两个创建了一个布局,并允许文本列表对象(T)使用探头检查...

>> probe first t 
== [self type offset size span pane text color image effect data edge font para feel saved-area rate show? options parent-face old-offset old-size line-list changes face-flags action state access style alt-action facets related words colors texts images file var keycode reset styles init multi blinker pane-size dirty? help user-data flags doc xy sz iter sub-area sld sn lc picked cnt act slf lines text-pane update resize]

通知的SUB -AREA在那里。这是文本列表中的列表区域。作者:成,你会得到...

>> probe first t/sub-area/edge 
== [self color image effect size] 
>> probe first t/sub-area/edge/size 
== 2

所以,改变大小那里查看我们做了布局...现在

>> t/sub-area/edge/size: 1x1 
== 1x1 
>> view lo

文本列表的边缘应该是薄。我不确定你是如何实现这种使用风格的,但希望这会让你走上正轨。

相关问题