-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
The scale widget needs to be able to display it's value a bit more
flexibly. My first thought (nice and simple) was to provide a -format
option which just takes the string template for sprintf. eg:
~ ttk::scale .s -format 0x%08x -from 0 -to 65535
would have it displaying hex like 0x012345678.
However, the scale is often useful for more than numerical display. For
instance in a video display it may be desirable to display the time as
hours:minutes:seconds. Or this widget is sometimes used for selecting
coarse options like Small, Medium, Big (eg: Windows display settings for
screen size).
My thought was to provide a -displayvariable option which if set would
use the value of the variable name provided as the scale value display.
So for a video display we can use something like:
~ scale .s -from 0 -to end_of_movie -displayvariable ::dispvalue \
~ -command [list UpdateDisplay ::dispvalue]
~ proc UpdateDisplay {varname value} {
~ set $varname [DisplayTimecode $value]]
~ }
where SplitTimecode would convert a time in usec into something human
readable.
An alternative would be to have the widget use a command option instead
which would display the result of the command - however this seems
expensive to run each time we repaint widget. It would be possible to
cache the display result and invalidate it when the widget value changes
perhaps.
Another issue is what to do about handling overhang at the edges. I'm
not sure that adjusting the ends of the track according to the width of
the display value would be a good plan. It would end up making the
widget jiggle as the width of the display value changed.
Anyway - are we happy with a -displayvariable option? Or something else.
If we have such an option would we want -format as well?
Pat Thoyts
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
iQCVAwUBQzxhf2B90JXwhOSJAQhIbQP+IbHESvgGf16ZUuSa7tfDKndeURavYCss
x7ACSpNUW7MSkVX20l4bDiNlmpADbzfkEpm+Ll2ZzWGhudezM9OgJVzniBRos4C8
8VruDIvSNlO5EdH6LvthWvg5HzkmJhCuOb168D33wM3yZhtzYJhKw1b/iG+A2TlW
HfzRY+jJll4=
=DIEZ
-----END PGP SIGNATURE-----
|