kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #34308
Re: A fix for our TEXT_CTRL_EVAL class.
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( const void* 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 <jeff@xxxxxxxxx> 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.charras@xxxxxxxxxx <mailto:jp.charras@xxxxxxxxxx>> 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/~kicad-developers>
>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>> Unsubscribe : https://launchpad.net/~kicad-developers <https://launchpad.net/~kicad-developers>
>> More help : https://help.launchpad.net/ListHelp <https://help.launchpad.net/ListHelp>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
Follow ups
References