PICTURE IN XBROWSE

PICTURE IN XBROWSE

Postby ukservice » Sun Jul 24, 2011 8:00 pm

Hi,

I want to use a Picture:

Code: Select all  Expand view
 @ 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: Select all  Expand view
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
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: PICTURE IN XBROWSE

Postby nageswaragunupudi » 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: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: PICTURE IN XBROWSE

Postby ukservice » Mon Jul 25, 2011 9:03 am

Thank you very much.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 30 guests