Hey, does anyone know where I can find a tutorial on multiple item list boxes. Like some programs have a list box and at the top are buttons and when you click on them it arranges the list box alphabetically for that item.
Hey, does anyone know where I can find a tutorial on multiple item list boxes. Like some programs have a list box and at the top are buttons and when you click on them it arranges the list box alphabetically for that item.
The class CListbox stores its data in a data structure. You can use a temporary C++ data struct such as a vector, list, stack, or queue to arrange the data in any way you want. All you do is update the data in the listbox.
For example:
-----
CListbox cBox;
int i = cBox.AddString("Two");
cBox.SetItemData(i, 2);
i = cBox.AddString("Three");
cBox.SetItemData(i, 3);
i = cBox.AddString("One");
cBox.SetItemData(i, 1);
-----
The cBox lists the information as:
Two
Three
One
If you want it to output,
One
Two
Three
then you can copy those data into another data structure and rearrange the data. Update cBox once you are done.
ResetContent() clears the listbox. Use that and then reinsert the data.
As for the button on top of the list, that is just a standard button. Add a button and map an on-click message.
Kuphryn
What you are describing sounds like a list view common control. Novacain has provided some code to configure one specifically as you have described (win32) here:
http://www.cprogramming.com/cboard/s...threadid=14594
The equivalent class object in mfc is a CListView.