Lazarus

Programming => LCL => Topic started by: M[a]nny on August 11, 2010, 09:34:19 am

Title: TFloatSpinEdit and possibility to enter more than one decimal point
Post by: M[a]nny on August 11, 2010, 09:34:19 am
Hello, just place on the form TFloatSpinEdit component and run application. You will be able to write there more than one decimal point. If you leave that component (it will loose focus), it will fix itself (= there will be only one decimal point).

It would be better to make OnKeyPress event with this code:
Code: Pascal  [Select][+][-]
  1.   if (key = #46) or (key = #44) then begin // if "," or "." is pressed
  2.     if Pos(',', FloatSpinEdit.Text) > 0 then // if there is already decimal point
  3.       key := #0; // don't allow to enter that
  4.   end;  

I know, it is made with OnEdittingDone but this is better to do it OnKeyPress. It looks much better.
Title: Re: TFloatSpinEdit and possibility to enter more than one decimal point
Post by: Bart on August 11, 2010, 10:17:49 am
Note that the used decimalseparator in a floatspinedit on windows seems to be controlled by the value of DefaultFormatSettings.DecimalSeparator, while on GTK/Linux it seems not to be.

Bart
TinyPortal © 2005-2018