Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display of records with equal width 4

Status
Not open for further replies.

foxwizard

Programmer
Aug 23, 2001
81
0
6
PH
From: Foxwizard

Does anybody know how can i display several records in the listbox with
equal widths but different field types? For example, one is field type of character and the other is numeric.

Thanks...
 
You will have to convert them all to character, using STR.
 
fluteplr,

I already tried that before but it looks like a zigzag to me when it appears in the listbox. By the way i am using foxpro for windows v2.6.......

foxwizard.
 
May try ALLTRIM(STR(number)) ...to left,
STR(number,width)...to right alignement, or
PADL(),PADR(),PADC() if you want use other character
to fill same width than space, e.g.
PADC(number,width,"*").
 
.....every line of records is a combination of two fieldnames with field types of character and numeric, e.g :

William K. Jones 125.00
Martin Louise Young 1,250.00
James Cameron 45,120.00

the output in the listbox should be :

William K. Jones 125.00
Martin Louise Young 1,250.00
James Cameron 45,120.00


Thanks....
 
Hi,

Expression:

field1+TRANSFORM(field2, '999,999,999.99')

Roni.
 
Foxwizard,
In addition, in order to get them to line up exactly, you will need to select a monospace font, like courier. Then, use something to build your selection like:

SELECT LEFT(CUSTNAME+SPACE(20),20) + ' ' +ALLTRIM(STR(AMOUNT,10,2)) INTO ARRAY LISTARRAY

M.DROPDOWN = LISTARRAY(1)
SHOW GETS

This code assumes you are using an array to display the items in your dropdown box, and that the fields can be retreived from a single table, with the field names "Customer Name", and "Amount". A slightly more realistic customer name build would look like:

SELECT LEFT(ALLTRIM(FNAME)+' '+ALLTRIM(LNAME)+SPACE(20),20) + ' ' + ALLTRIM(STR(AMOUNT,10,2)) INTO ARRAY LISTARRAY

The purpose of the SPACE(20) is to add 20 spaces to the end of your name, and the LEFT(<field>,20) takes the left 20 characters, so you always end up with the same number of spaces for your name. If you First & Last names are larger than 20, than you'll need to make the SPACE and LEFT values larger. (Play with that, and see what works.)

Please let me know if this helps,
-Scott
 
thank guys for all your help......it helps me alright....

foxwizard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top