Tips

De GENIUS
Aller à la navigation Aller à la recherche

Use the setNameInConfigurationFile() method

To avoid possible non compatibility when you want to change the label of an entry widget, it is fully recommended to use the setNameInConfigurationFile() method. For example :

real  = new GEntryReal("Real:", 0.);

... will correspond inside the XML saved file to the following line :

<Real name="Real:">0.0E0</Real>

So, if you decide to change the label in "Double" rather than "Real", the content of the XML file will be now :

<Real name="Double:">0.0E0</Real>

... and the previous saved files will be no more readable!

On the contrary, if your code is the following one:

real  = new GEntryReal("Real:", 0.);
real.setNameInConfigFile("value");

... the content of the file will be :

<!--Real:-->
<Real name="value">0.0E0</Real>

Even if you change the label (for example from "Real:" to "Double:", the previous XML file will be always readable ...

Name your widgets wid...

To avoid to confuse a widget with an actual variable as a double, it is recommended to start the widget names by something as wid. For example :

final GEntryReal widReal  = new GEntryReal("Real:", 0.);
real.setNameInConfigFile("value");
final double real = widReal.getValue;