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.
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,"*".
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:
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.)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.