The action callback is called during value modification, so if you consult
the attribute during the callback it will return the old value. The new
value is passed as a parameter in the callback. So you should change your
code to:

    function txtC:action(c, new_value)
       if new_value and tonumber(new_value) then
          local nNum = tonumber(new_value)
          txtF.value = nNum * (9/5) + 32
       end
    end

    function txtF:action(c, new_value)
       if new_value and tonumber(new_value) then
          local nNum = tonumber(new_value)
          txtC.value = nNum * (9/5) + 32
       end
    end

Best,
Scuri


2018-01-17 5:05 GMT-02:00 Pete Lomax via Iup-users <
iup-users@lists.sourceforge.net>:

> Hi there Hernan,
> You might want to visit https://bitbucket.org/petelomax/phix/src and then
> click on demo, rosetta, 7guis
>
> Although written in a different language, all 7 entries are completed.
>
> The temperature converter is named Converter.exw, and I used the
> valuechanged callback to achieve the desired effect.
>
> Regards,
> Pete
>
> --------------------------------------------
> On Wed, 17/1/18, Hernan Cano <jhernanca...@gmail.com> wrote:
>
>  Subject: [Iup-users] About using IUP.Text:action in Lua
>  To: "IUP discussion list." <iup-users@lists.sourceforge.net>
>  Date: Wednesday, 17 January, 2018, 5:06
>
>  Hi,
>  Antonio and friends.In
>  the attached file, I show an example of a form in Lua
>  language using the IUP gui.The
>  needing is that with every key pressed in the first textbox
>  some calculations be made and the result must be shown in
>  the second textbox.The
>  problem that I found is that it the answer is showed
>  lately... this means...A
>  digit is pressed... but the result is not shown.A
>  second digit is pressed.... the result that is shown is as
>  if in first textbox was only the first digit.A
>  third digit is pressed.... the result that is shown is as if
>  in first textbox were the first two digits.And
>  so on.Can
>  You say me where is my inconsistency with the code?My
>  goal is to develop the seven GUIs proposed in 7GUIs: https://github.com/
> eugenkiss/7guisBut
>  I need to resolve some points as this.Thanks..HERNAN.
>  ------------------------------------------------------------
> ------------------
>  Check out the vibrant tech community on one of the world's
>  most
>  engaging tech sites, Slashdot.org! http://sdm.link/slashdot______
> _________________________________________
>  Iup-users mailing list
>  Iup-users@lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/iup-users
>
>  -----Inline Attachment Follows-----
>
>
>  -----Inline Attachment Follows-----
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to