Lazarus

Free Pascal => Beginners => Topic started by: jcaser1948 on January 08, 2018, 08:16:17 am

Title: Newbie question over TEdit
Post by: jcaser1948 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
Title: Re: Newbie question over TEdit
Post by: balazsszekely 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.
Title: Re: Newbie question over TEdit
Post by: jcaser1948 on January 08, 2018, 01:14:12 pm
Thanks, it works
Title: Re: Newbie question over TEdit
Post by: Bart on January 08, 2018, 05:36:37 pm
On every change you set the Text to '1' ...

Bart
TinyPortal © 2005-2018