FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Reading from INI-file, DECIMALS are ignored ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Reading from INI-file, DECIMALS are ignored ?
Posted: Sat Jun 09, 2012 01:16 PM
Hello,

I noticed a Problem, reading DECIMALS from a INI-file.
Just a INTEGER-value is returned ( but saved as Decimal ).

Only got it working saving Values as String and reading like :
...
...
GET cGPosW SECTION "Skins" ENTRY "Grad-PosW" OF oIni
GET cGPosD SECTION "Skins" ENTRY "Grad-PosD" OF oIni
...
nGPosW := VAL( cGPosW )
nGPosD := VAL( cGPosD )

Decimals must be converted ?



Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Reading from INI-file, DECIMALS are ignored ?
Posted: Sat Jun 09, 2012 03:37 PM

ukoenig, you are right.
Many years ago, I coded a function with a get to 4 decimal places and I've always done it this way:

Function TcUSpVenta()
local nTasausPVta:=Val(GetPvProfString("config","TasaPVta","0.0000",cIniFile))

if MiGet4Dec("TCambio US$ para Ventas","","Introduzca el Tipo de Cambio US$",@nTasausPVta,"config",.t.) //4 decimals get
WritePProString("config","TasaPVta", alltrim(str(nTasausPVta)), cIniFile)
endif
Return nil

Then in another part of the code

nTcambio := val(GetPvProfString( "Config", "TasaPvta" , "1", cInifile ) )

//---------------------------------------------------------------------------
Function MiGet4Dec( cTitDlg, cTexto, aTitGet, aGet, cBmp,lDecim)
local lOK:=.F., oDlg, oBtn1, oBtn2, oBmp, oBmpF, oBrush,cBrush:=".\wall.bmp"
local oTitGet1, oTitGet2, oTitGet3, oTitGet4, oTitGet5, oSayText
local oGet1, oGet2, oGet3, oGet4, oGet5
local uTemp:=aGet

DEFAULT lDecim:=.f.

if !Empty(cBrush) .and. file(cBrush)
DEFINE BRUSH oBrush FILENAME cBrush
endif

DEFINE DIALOG oDlg RESOURCE "BUSCADOR1" TITLE cTitDlg FONT oWnd:oFont BRUSH oBrush Transparent

REDEFINE SAY oTitGet1 PROMPT aTitGet ID 101 OF oDLG
REDEFINE GET oGet1 VAR uTemp ID 201 OF oDLG PICTURE "999,999.9999"
if ! Empty( cBmp )
REDEFINE BITMAP oBmp RESOURCE cBmp ID 400 OF oDlg
endif

REDEFINE BUTTONBMP oBtn1 ID 312 OF oDLG ACTION ( lOK:=.t., oDlg:End() ) BITMAP "ACEPTAR" TEXTRIGHT
REDEFINE BUTTONBMP oBtn2 ID 313 OF oDLG ACTION ( lOK:=.f., oDlg:End() ) CANCEL BITMAP "CANCELAR" TEXTRIGHT

ACTIVATE DIALOG oDlg CENTERED

if lOK
aGet:=uTemp
endif

oBrush:End()
Return lOK

Regards.

Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql

Continue the discussion