[R] set tkscale by tkentry

Greg Snow 538280 at gmail.com
Thu May 24 17:05:23 CEST 2012


I believe that what is happening is that when you try to edit the
entry widget any intermediate values get sent to the slider widget
which then checks to see if they are in the allowable range and if it
is not then it sets the value to either the minimum and maximum and
sends that back to the entry widget while you are still trying to edit
it.  Even if you highlight a single digit and try to replace it with a
different digit it first deletes the highlighted digit resulting in a
number smaller than the minimum of the slider which then updates the
entry widget to the minimum before the new digit can go in, then
adding the new digit makes it larger than the slider maximum.

There may be a way to slow down the updates or validations so that you
can edit the entry before the slider tries to validate and change the
value.  Or you can just include 0 as the minimum of the slider so that
the intermediate values in the entry widget are in the allowable
range.

On Thu, May 24, 2012 at 2:20 AM, Alexander <juschitz_alexander at yahoo.de> wrote:
> Hi, I am working under Windows and I am using R2.11
> I want to use tkscale in my GUI. As the interval is quite big, I can't set
> the scale to a certain specific value. Therefore I want to add tkentry to
> allow the user to set tkscale to a certain value.
>
> Here is the code
>
> library(tcltk)
>
> tt<-tktoplevel()
> tkpack(m1<-tkscale(tt,from=306870.00, to=3026741, label="alpha",
> variable="varalpha",showvalue=TRUE, resolution=1,
> orient="horiz"),side="bottom")
> tkpack(tkentry(tt,width="10",textvariable="varalpha",validate="key",validatecommand="string
> is double %P"),side="bottom")
>
> As you can see, varalpha is a global variable (I think in tcl, not in R),
> and if you change the parameter by the scale, the value in tkentry is
> updated. If I want to set now the value of varalpha by tkentry, it bugs.
> Does anyone have an idea, why? I already tried the interval from 0 to any
> number, which works fine...
>
> library(tcltk)
>
> tt<-tktoplevel()
> tkpack(m1<-tkscale(tt,from=0.00, to=1000, label="alpha",
> variable="varalpha",showvalue=TRUE, resolution=1,
> orient="horiz"),side="bottom")
> tkpack(tkentry(tt,width="10",textvariable="varalpha",validate="key",validatecommand="string
> is double %P"),side="bottom")
>
> Thanks in advance,
> Alexander
>
> --
> View this message in context: http://r.789695.n4.nabble.com/set-tkscale-by-tkentry-tp4631174.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com



More information about the R-help mailing list