The original idea was to have one evaluator object per dialog so that
several text entries could access a common set of variables.
Now that there is one evaluator object per entry field I think there is
no reason to retain the (single) input text in clear().
If there is ever to be support for variables the class could be extended
to support a shared object with a map of variables. This could be useful
in the footprint editor.
On 25.02.2018 12:37, Jeff Young wrote:
Hmmm, pObj isn’t stored. Since we use an instance of NumericEvaluator
for each control, we don’t actually need the storage to be a map
(there’s only ever one key in it). For now, probably easiest to just do:
NumericEvaluator::clear(constvoid*pObj)
{
free(clToken.token);
clToken.token=nullptr;
clToken.input=nullptr;
bClError=true;
+
+if(bClTextInputStorage)
+clObjMap.clear();
}
On 25 Feb 2018, at 11:26, Jeff Young <j...@rokeby.ie
<mailto:j...@rokeby.ie>> wrote:
Hi JP,
Rather than calling evaluate() in the new TEXT_CTRL_EVAL::SetValue(),
I’d call clear(), and add these two lines to NumericEvaluator::clear():
void
NumericEvaluator::clear()
{
free(clToken.token);
clToken.token=nullptr;
clToken.input=nullptr;
bClError=true;
+
+if(bClTextInputStorage)
+clObjMap[pObj]=nullptr;
}
That will zero out the stored text.
Cheers,
Jeff.
On 25 Feb 2018, at 10:17, jp charras <jp.char...@wanadoo.fr
<mailto:jp.char...@wanadoo.fr>> wrote:
Hi Orson,
Could you have a look into this small patch.
I am not sure I used the better way to fix an issue.
It fixes an issue when using SetValue() to change the value shown by
this widget.
The issue was due to the fact TEXT_CTRL_EVAL stores internally the
last entered value in a buffer.
So when calling SetValue() after a value was already entered, and if
we try to modify
the displayed value by calling SetValue(), as soon as the widget has
the focus, the previous value
replaces the new value.
This is easy to see in Move Exactly dialog:
- enter a value
- reset the value by the Reset button
- move the cursor to the corresponding text control widgets and
click on it to give it the focus.
--
Jean-Pierre CHARRAS
<fix_text_ctrl_eval_SetValue.patch>_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
<https://launchpad.net/%7Ekicad-developers>
Post to : kicad-developers@lists.launchpad.net
<mailto:kicad-developers@lists.launchpad.net>
Unsubscribe : https://launchpad.net/~kicad-developers
<https://launchpad.net/%7Ekicad-developers>
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
<https://launchpad.net/%7Ekicad-developers>
Post to : kicad-developers@lists.launchpad.net
<mailto:kicad-developers@lists.launchpad.net>
Unsubscribe : https://launchpad.net/~kicad-developers
<https://launchpad.net/%7Ekicad-developers>
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp