[REBOL] Re: Stylize/deep
From: ammonjohnson:yah:oo at: 25-Dec-2001 21:11
I see where you are coming from, sld happens to be a slider, but it is not
defined until init happens so... One thing you might like to try at the
console is,
>>probe get-style 'text-list
That will return the actually text-list style, which may give you awonderful
insight. Something that you will notice is that 'sld is defined in the 'init
function so you will need to redefine it something like:
my-styles: stylize [
txt-lst: text-list with [sld: edge [color: 0.0.0]
init: [
if all [not flag-face? self as-is string? text] [trim/lines
text]
if none? text [text: copy ""]
change font/colors font/color
if :action [feel: svvf/hot saved-area: true]
data: size
if any [none? size size/x < 0 size/y < 0] [
state: max 1x1 pane-size * 9 / 10 - offset - para/margin
if none? size [size: state]
if size/x < 0 [size/x: state/x]
if size/y < 0 [size/y: state/y]
size: size-text self
all [
para para/origin size: size + para/origin
para/margin size: size + para/margin
]
]
if all [data data/y < 0] [size/x: data/x]
data: none
sz: size
sn: 0
slf: :self
act: :action
if none? data [data: texts]
if none? data [data: copy []]
lines: data
picked: copy []
iter: make-face/size 'txt sz * 1x0 + -16x20
iter/para: make self/para [origin: 2x0]
iter/font: make self/font []
lc: to-integer sz/y / iter/size/y: second size-text iter
iter/feel: make iter/feel [
redraw: func [f a i] [
f/color: either find picked f/text [svvc/field-select]
[slf/color]
]
engage: func [f a e] [
if a = 'down [
if cnt > length? head lines [exit]
if not e/control [f/state: cnt clear picked]
alter picked f/text
do :act slf f/text
]
if a = 'up [f/state: none]
show pane
]
]
pane: layout/size [
origin 0 space 0
sub-area: box slf/color sz - 16x0 ibevel with [pane:
:text-pane]
at sz * 1x0 - 16x0
sld: slider edge [color: 0.0.255] sz * 0x1 + 16x0 [
value: to-integer value * ((1 + length? head lines) -
lc)
if sn <> value [sn: value]
show sub-area
]
] size
sld/redrag lc / max 1 length? head lines
pane/offset: 0x0
]
]
]
view layout [
styles my-styles
txt-lst
]
Enjoy!!
Ammon
PS in the init function it declares the pane...