FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour PICTURE IN XBROWSE
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
PICTURE IN XBROWSE
Posted: Sun Jul 24, 2011 08:00 PM
Hi,

I want to use a Picture:

Code (fw): Select all Collapse
  @ 0,72 XBROWSE oVMenuBrowse SIZE -10,-21 PIXEL OF oDlg ;
   ALIAS "CUST" AUTOCOLS ;
    PICTURES nil, nil, nil, nil, nil, nil, nil, nil, nil, mypicture( FIELD->SALARY)




Code (fw): Select all Collapse
FUNCTION MYPICTURE( cV )

 LOCAL pDECIMALS := 3
 LOCAL cRetorn


 if pDECIMALS = 1
    cRetorn := Transform( cV, "@E 999,999,999,999,999.9" )
 elseif pDECIMALS = 2
    cRetorn := Transform( cV, "@E 999,999,999,999,999.99" )
 elseif pDECIMALS = 3
    cRetorn := Transform( cV, "@E 999,999,999,999,999.999" )
 elseif pDECIMALS = 4
    cRetorn := Transform( cV, "@E 999,999,999,999,999.9999" )
 elseif pDECIMALS = 5
    cRetorn := Transform( cV, "@E 999,999,999,999,999.99999" )
 elseif pDECIMALS = 6
    cRetorn := Transform( cV, "@E 999,999,999,999,999.999999" )
 elseif pDECIMALS = 7
    cRetorn := Transform( cV, "@E 999,999,999,999,999.9999999" )
 else  // default 2
    cRetorn := Transform( cV, "@E 999,999.999.999.999.99" )
 endif






RETURN ( cRetorn   )
// -------------------------------------------------------------------------



But always take the first value in salary for all records.

What I do wrong?.

Thank you.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: PICTURE IN XBROWSE
Posted: Mon Jul 25, 2011 12:15 AM
Your function is returning the transformed value of Salary.
For example, if the salary in the first row is 500, your function returns "500.00". The function should return "@E 999,999,999.999".

Incidentally, you do not have to write your own function numeric pictures.
If you want European format and use commas, use this function at the beginning of your program:

Code (fw): Select all Collapse
XBrNumFormat( "E", .t. ) // E for European.  .t. for using thousand separators
or 
FWNumFormat( "E", .t. ) // latest FWH


XBrowse will automatically use a number format depending on the length and number of decimals in the field,
In the case of Salary field in customer database, the format xbrowse automatically uses is : "@E 99,999,999.99", because the field's length is 9 and decimals are 2. XBrowse adds 2 to the length to accommodate totals.

If you want to derive a picture you can use FWH function
NUMPICT( nLen, nDec, nil, lComma, lDisplayZeros )
Regards



G. N. Rao.

Hyderabad, India
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: PICTURE IN XBROWSE
Posted: Mon Jul 25, 2011 09:03 AM

Thank you very much.

FWH 11.11, Harbour 3.1 and Borland C++ 5.82

Continue the discussion