[fxruby-users] FXTextField and number of digits after decimal point

Michèle Garoche migatine at gmail.com
Tue Nov 11 12:25:48 EST 2008


Hello,

Here's the context:

I read a number either pure integer or float with eventually up to 12  
digits after the decimal point from a YAML file.
The number is injected into a FXTextField with the following code:

@value_sel = FXDataTarget.new(@value.to_s)
     @value_value = FXTextField.new(@matrix_mem_value, 20, at value_sel,
       :opts =>TEXTFIELD_NORMAL|JUSTIFY_RIGHT, :selector =>  
FXDataTarget::ID_VALUE)

where @value is the number as read from the YAML file.

If I use a TEXTFIELD_NORMAL, I get all the digits after the decimal  
point, but then it becomes difficult to test if the user entry  
thereafter will be correct.

I I use a TEXTFIELD_INTEGER, like below, I get only three digits  
after the decimal point.

@value_sel = FXDataTarget.new(@value)
     @value_value = FXTextField.new(@matrix_mem_value, 20, at value_sel,
       :opts =>TEXTFIELD_INTEGER|JUSTIFY_RIGHT, :selector =>  
FXDataTarget::ID_VALUE)

If I use a TEXTFIELD_REAL, I get only seven digits after the decimal  
point.

My question is: Is there a way to use either a TEXTFIELD_INTEGER or a  
TEXTFIELD_REAL without losing digits after the decimal point?

Note: the number I use for testing purpose is 400.12345678.

Thanks in advance for any hint.

Cheers,
Michèle
<http://micmacfr.homeunix.org>


Cheers,
Michèle
<http://micmacfr.homeunix.org>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081111/ea9d0087/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 36C471DED4B09EEB30A0281F2608DB2FE6F9E147.gpgkey
Type: application/octet-stream
Size: 1744 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081111/ea9d0087/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081111/ea9d0087/attachment-0003.html>


More information about the fxruby-users mailing list