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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alignment in listboxes.. 1

Status
Not open for further replies.

Brezhnev

Programmer
Sep 25, 2002
53
CA
I am using class-container that contains listbox.Populating listbox with 7 columns. and would like to align some of them to the left and some to the right. can’t find the appropriate property ..what am I blind ?

Thanks for any help..
 
Hi Brezhnev,

I would go with a grid and would be much easier to control. Cant you think of a small constructed grid in the place of the list box ?

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
yeah i know... but i have to use listbox for this project ( for the sake of consistency , damn it :) )...

thanx anyway
 
Brezhnev (Programmer):
Populating listbox with 7 columns. and would like to align some of them to the left and some to the right. can’t find the appropriate property ..what am I blind ?

No, you are not blind: there ain't no such thing as Alignment property in regular VFP ListBox control.

You may want to consider either using Grid control instead, or finding some custom ListBox control that does have this property. (I, personally, would rather go with Grid.)

Note also that ListBox has the limit: no more than 64000 line items. Grid doesn't have this limitation.

I hope this would help.

Regards,

Ilya

P.S. Off the record: any relation to late Leonid Brezhnev?
 
Hi Brezhnev,

All you've got to do is to set the ColumnWidths property.

Say the listbox is 300 pixels wide. You might set the Columnwidths to "50,100,20,30,50,25,25" for example. That way, the columns will line up nicely.

Mike
Mike Lewis
Edinburgh, Scotland
 
Hi,

1. MikeLewis is correct. If you have similar data in the list box, by adjusting its width, you can make a nice presentation.

2. ANother way.. is to make the Grid look like a listbox.
Here is how,..

WITH myGrid
.DeleteMark = .f.
.GridLines = 0
.HeaderHeight = 0
.RecordMark = .f.
ENDWITH

Now you have much better way to handle the presentation also.

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
thanks to everybody... probably will try to go with grid...

to Ilya -- no relation ..just "nostalgia" for "old good times" :)

to Mike Lewis -- well , in my opinion , wouldn’t do a thing for me ... non-proportional fonts (!)
 
Brezhnev,

wouldn’t do a thing for me ... non-proportional fonts (!)


Makes no difference. My solution will work with all fonts. Give it a quick try. It will take less than 30 seconds.

Mike
Mike Lewis
Edinburgh, Scotland
 
Brezhnev,

As you say, non-proportional font is a solution for using Listbox with alignment. If you insist to use Listbox, I think this could be the only way.

Use Courier New font
Format all list items (right alignment) by using transform or str command. I think you could have what you expected. of course, columnwidths is required.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top