[rkward-devel] Show element depending on spinbox value

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Jul 30 18:03:21 UTC 2013


Hi!

On Tuesday 30 July 2013 16:45:21 Birk Diedenhofen wrote:
> I ran into the following issue with my rkward plugin. I'm trying to show
> and hide GUI elements depending on the value of a spinbox. If the
> spinbox value is zero, the text element stating "spinbox value is zero"
> should be shown on the following wizard page (see code example below).
> If the spinbox value is not zero, the text element stating "spinbox
> value is not zero" should be shown. However, irrespective of the spinbox
> value, I always get "spinbox value is not zero".

It's a rounding / floating point precision issue. One of the zeros is not 
quite the same as the other, for some reason. For the moment, the best 
workaround will be to use 

  value.is.zero.convert <- 
  rk.XML.convert(sources=list(real=spinbox.value),
  mode=c(min=-0.0000001, max=0.0000001),
  id.name="value_is_zero_convert")

Probably for real-mode equality comparisons something along these lines should 
be done automatically, internally.

BTW: No need to define complementary converts. Simply use

  rk.XML.connect(governor=value.is.zero.convert, not=TRUE,
  client=spinbox.value.is.not.zero, set="visible")

(For those not using rkwarddev: This uses the ".not" sub-property of the 
governor.)

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20130730/c88f58d6/attachment.sig>


More information about the Rkward-devel mailing list