Recent

Author Topic: TFloatSpinEdit and possibility to enter more than one decimal point  (Read 3766 times)

M[a]nny

  • Full Member
  • ***
  • Posts: 130
  • Dreamer
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.
Bad news: Time flies.
Good news: You are the pilot.

Don't try to be perfect, just be unique.

Bart

  • Hero Member
  • *****
  • Posts: 4815
    • Bart en Mariska's Webstek
Re: TFloatSpinEdit and possibility to enter more than one decimal point
« Reply #1 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