How to stylize text-list and other elements?
Default Rebol VID style is eye-searing, put bluntly. I started making my own default, but ran into a snag. Namely, how do I specify styles for a sub-element of an element?
good-looking: stylize [
field: field
edge [size: 1x1]
开发者_如何学C 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]
]
I want all fields to have a thin border, including text-list and others. But I have no idea how to include that rule in the text-list definition.
Also, how to reduce repetition with styles, like with the colors?
I can partly answer your first question. At the REBOL consol, try this...
>> lo: layout [t: text-list]
That both creates a layout and allows the text-list object (t) to be examined using PROBE...
>> 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]
Notice the SUB-AREA there. That's the list area in a text-list. Probe into that and you get...
>> probe first t/sub-area/edge == [self color image effect size] >> probe first t/sub-area/edge/size == 2
So, change SIZE there and view the layout we made...
>> t/sub-area/edge/size: 1x1 == 1x1 >> view lo
The text-list's edge should be thin now. I'm not sure how you achieve that using style, but hopefully this will put you on the right track.
So, first:
layout [X: field]
type? X/edge
type? X/colors
Objects should get re-made to avoid unexpected side-effects on the shared ones.
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]
]
]
]
精彩评论