ttk::scale how does one implement the old -resolution - TCL

This is a discussion on ttk::scale how does one implement the old -resolution - TCL ; I'm looking at the differences in ttk widgets and the standard ones. In scale, there is only a -from and a -to, no resolution. This value affects how much the thumb jumps when you click inside the the slider's trough ...

+ Reply to Thread
Results 1 to 2 of 2

ttk::scale how does one implement the old -resolution

  1. Default ttk::scale how does one implement the old -resolution

    I'm looking at the differences in ttk widgets and the standard ones.

    In scale, there is only a -from and a -to, no resolution. This value
    affects how much the thumb jumps when you click inside the
    the slider's trough in the old widget.

    I tried using a -command with an expr to compute an integral
    value and then set the scales value to a new value. However,
    this results in an infinite recursion loop.

    Is there a way to implement the old behavior with the new
    ttk::scale?



  2. Default Re: ttk::scale how does one implement the old -resolution

    Hi, I have implemented it this way:

    package require tile

    #First create a resolution proc:
    proc resolution {res t var val} {
    set factor [expr 1 / $res]
    set val [expr int($val * $factor) / $factor]
    set $var $val
    return $val
    }

    #Then in the ttk::scale command call the resolution proc like this:

    ttk::scale .myscale -from 1 -to 100 -variable ::myval -command "resolution 1 -variable ::myval"

    ttk::entry .myentry -textvariable ::myval
    pack .myscale -side left -expand true -fill x
    pack .myentry -side left

    #now test the scale

    .myscale configure -command "resolution 0.1 -variable ::myval"

    #test it again and see the resolution change

+ Reply to Thread