Link to home
Start Free TrialLog in
Avatar of muma0016
muma0016

asked on

Multicolumn CListBox

Hello,

I want create a CListBox with 4 columns and I want to use the proportional font "MS Sans Serif".

I'm a little bit confused how to manage this.

I know of LBS_MULTICOLUMN and SetColumnWidth, LBS_USETABSTOPS and SetTabSTops but I need
an example to create the ListBox and fill with data.

I give 200 points for you and hope to get a GOOD example
that is running !!!

Thanks for any help.
ASKER CERTIFIED SOLUTION
Avatar of rhgaracci
rhgaracci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rhgaracci
rhgaracci

To do the tabbed listbox, set the "Use Tabstops" property for the listbox in the dialog editor properties box. then add this code to the OnInitDialog():

// array of tab stops in dialog units
//
int iTabs[] = {40, 80, 120};

// set the tab stops
//
m_listBox.SetTabStops(sizeof(iTabs)/sizeof(int), iTabs);

// add strings, tab separated
//
m_listBox.AddString("Column1\tColumn2\tColumn3\tColumn4");
m_listBox.AddString("X\tX\tX\tX");

Voila, columns!!!