* * *

Author Topic: Newbie question over TEdit  (Read 418 times)

jcaser1948

  • New member
  • *
  • Posts: 25
Newbie question over TEdit
« on: January 08, 2018, 08:16:17 am »
Dear all
A happy new year to everyone
I use OPensuseLinux Leap 42.3 and Lazarus 1.8
I need some help in understanding the Logic of TEdit
I have a programm with a bunch of variables .I will show them in a cople of
tEdits, modify their values  and store them  again in the variables
I use the On Change event of T edit
Hiere the example  code

procedure TForm1.EPabKWChange(Sender: TObject);
 
begin
    pabkw:=1;
   try
     EPabKW.text:= FloatToStrF(pabkw,ffFixed,7,2);
     pabkw:=strtofloat(EPabKW.text);
     {here I change the value manually in T Edit and send it again to the
variable to be processed}
     EPabKW.text:=FloatToStrF(pabkw,ffFixed,7,2);
   except

     EPabKW.clear;
   end; //try

end; // EPabKW.text Change
I can see in the Tedit display the value 1, but when I try to change the value
nothing happens 
Wha do I do wrong?
Is th On change event the most appropriate?
Thanks

GetMem

  • Hero Member
  • *****
  • Posts: 2618
Re: Newbie question over TEdit
« Reply #1 on: January 08, 2018, 08:47:30 am »
Hi Jcaser1948,

Please switch to TFloatSpinEdit(Misc tab). Show the values like this:
Code: Pascal  [Select]
  1. var
  2.   d: double;
  3. begin
  4.   d := 13.35;
  5.   FloatSpinEdit1.Value:= d;
  6. end;
                 
then use the OnEditingDone event to validate/store the values again.

jcaser1948

  • New member
  • *
  • Posts: 25
Re: Newbie question over TEdit
« Reply #2 on: January 08, 2018, 01:14:12 pm »
Thanks, it works

Bart

  • Hero Member
  • *****
  • Posts: 2796
    • Bart en Mariska's Webstek
Re: Newbie question over TEdit
« Reply #3 on: January 08, 2018, 05:36:37 pm »
On every change you set the Text to '1' ...

Bart

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus