I tried to improve the Tip Calculator example a bit, so that "Total: " doesn't disappear when you hit enter on the tip field:
REBOL [title: "Tip Calculator"]
view [
f: field "49.99"
hpanel [
t: field "20" on-action [
set-face x rejoin ["Total: " round/to to money! ((to-decimal get-face f) * ((to-decimal get-face t) * .01 + 1)) $.01 ]
]
title "%"
]
x: title "Total: " facets [ auto-size true ]
]
However, the auto-size
doesn't seem to help the fact that x
stays too skinny after calculation. This works:
x: title "Total: " 150x20
...as does this:
x: title "Total: "
...but how can I get it to resize automatically?
As title seems to descend from text, which is defined as auto-size: false, it would be the most easy solution to replace title with a style defined with auto-size: true e.g info
x: info "Total: "
Otherwise you would have to redefine your own title style descending from a autosizing style.