开发者

catching change in spinbox - rtcltk

开发者 https://www.devze.com 2023-03-16 04:01 出处:网络
I\'m creating a spinbox in R using rtcltk with: from <- tkwidget(leftFrame, type=\"spinbox\", from=0, to=0.1,

I'm creating a spinbox in R using rtcltk with:

from <- tkwidget(leftFrame, type="spinbox", from=0, to=0.1, 
                         inc=0.001, textvariable=freqFrom,
                         command = function(){updatePlot()})

This works as intended (updatePlot is called) when I use the arrows of the spinbox, but does not work if I just type somethin开发者_如何学运维g in manually.

How do I catch the "value changed" event?


By default it does not change in this case in case you type in an illegle value (like deleting the last digit), or if the update is time consuming then you would not want it to update between every keystroke when typing in a 3 or 4 digit number.

You can add an update button than calls updatePlot when clicked so that the user would type in the number and when they know they are finished would click the button.

If you really want the update to occur with every keystroke then you can use the tkbind function to call updatePlot (something like tkbind(*spinbox*, "<Key>", updatePlot) where spinbox is the variable pointing to the spinbox).

0

精彩评论

暂无评论...
验证码 换一张
取 消