[REBOL] Re: Text width in VID
From: carl::cybercraft::co::nz at: 24-Dec-2003 22:50
On 06-Dec-03, Henrik Mikael Kristensen wrote:
> I'm also toying with size adaptable buttons, which size themselves
> to the text, so it doesn't wrap, and allow for resizing the main
> window with the buttons without screwing up the text and for
> resizing the column in a listview and make sure, text is never
In later versions of View, but (instead of button) produces a rounded
button sized to the text unless you over-ride it's size (I think).
> I can't use automatic calculations for the button size, because I
> need to be able to resize the button from the minimum size of the
> text width and up.
> I've come up with making an image of a layout with the text string
> and then determining its width from image/size/x and it works well.
> But it seems a little cumbersome, but is (not yet) performance
> critical for my application.
> Still, are there easier ways?
>> ? size-text
Returns the size of the text in a face.
SIZE-TEXT is a native value.
face -- (Type: object)
>> layout [t: text "hello"]
>> size-text t
And I've a vague feeling you can create faces directly without needing
layout, which would simplify things further, but I can't remember how
it was done - if it actually can be... :)