« Tips » : différence entre les versions

De GENIUS
Aller à la navigation Aller à la recherche
Page créée avec « To avoid possible non compatibility when you want to change the label of an entry widget, it is fully recommended to use the <font color=#4169E1>setNameInConfigurationFile()</font> method. For example : <syntaxhighlight lang="java"> real = new GEntryReal("Real:", 0.); </syntaxhighlight> ... will correspond int he XML saved file to the following line : <syntaxhighlight lang="xml"> <R</syntaxhighlight> </syntaxhighlight> So, if you decide to change the label i... »
 
 
(3 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
== 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 <font color=#4169E1>setNameInConfigurationFile()</font> method. For example :
To avoid possible non compatibility when you want to change the label of an entry widget, it is fully recommended to use the <font color=#4169E1>setNameInConfigurationFile()</font> method. For example :


Ligne 5 : Ligne 8 :
</syntaxhighlight>
</syntaxhighlight>


... will correspond int he XML saved file to the following line :
... will correspond inside the <font color=#FF8C00 title="Extensible Markup Language">XML</font> saved file to the following line :


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<R</syntaxhighlight>
<Real name="Real:">0.0E0</Real>
</syntaxhighlight>
</syntaxhighlight>


Ligne 17 : Ligne 20 :
</syntaxhighlight>
</syntaxhighlight>


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


On the contrary, if your code is the following one:
On the contrary, if your code is the following one:
Ligne 31 : Ligne 34 :
<!--Real:-->
<!--Real:-->
<Real name="value">0.0E0</Real>
<Real name="value">0.0E0</Real>
</syntaxhighlight>
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 :
<syntaxhighlight lang="java">
final GEntryReal widReal  = new GEntryReal("Real:", 0.);
real.setNameInConfigFile("value");
final double real = widReal.getValue;
</syntaxhighlight>
</syntaxhighlight>

Dernière version du 25 mars 2026 à 13:24

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;