Recent

Author Topic: TFloatFormat  (Read 2711 times)

tarounen

  • New Member
  • *
  • Posts: 17
TFloatFormat
« on: December 06, 2012, 02:09:29 pm »
hi, i am getting some problem with my code. i want to display a floating number with only 4 decimal palces. i tried this code, but i the debugger is reporting an error:

Code: [Select]
type
  TFloatFormat = (ffGeneral);

//there is a place in a procedure with this code:     
 msg:=FloatToStrF(A, ffGeneral, 5, 4);   

But there is an error message:
 Got "NORMAL.TFloatFormat", expected "SYSUTILS.TFloatFormat"

can anyone help me

thanks.

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: TFloatFormat
« Reply #1 on: December 06, 2012, 02:23:39 pm »
This makes no sense to me.
Code: [Select]
type
  TFloatFormat = (ffGeneral);
You redeclared enumeration which is already declared in sysutils. You don't need to do it. Or you have some special reason ?

To display 4 decimal places, try ffFixed:
Code: [Select]
msg:=FloatToStrF(A, ffFixed, 5, 4); 
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

tarounen

  • New Member
  • *
  • Posts: 17
Re: TFloatFormat
« Reply #2 on: December 06, 2012, 02:33:43 pm »
it worked!!! actually i got this code from a delphi tutorial, i thought it was same for lazarus!! i removed the
Code: [Select]
type
  TFloatFormat = (ffGeneral);
and it worked!!!

thanks!!!:)

 

TinyPortal © 2005-2018