| partytime4321 (28) | |||
|
Hi all, I am working on a simple application using windows.h, my first. I have a structure with some data on various games, read from a file. With that data, I would like to create some sort of table each row is a game, and each column has atributes about it such as title, year, cost, developer, etc. (6 columns in total). I was able to create this list box with a call to CreateWindow(), but now I have no idea how to go about adding text to it. I tried putting the text in the 2nd parameter, as usual, but it still just comes out as blank. Here is the code where the box is created:
I would very much appreciate it if someone could tell me how to put data into this list box. I dont need it to have any associated option, just the ability to refresh the display. Here is a link to the full program (in the form of a .cpp file)... Sorry it did not fit in the message. The listbox is created on like 216. https://dl.dropbox.com/u/20145259/main.cpp Thanks very much, Ryan | |||
|
Last edited on
|
|||
| andywestken (1964) | |
|
How to Create a Simple List Box (Windows) http://msdn.microsoft.com/en-gb/library/windows/desktop/hh298365%28v=vs.85%29.aspx (the first hit when I Googled for "Add text to a list box c++") | |
|
|
|
| partytime4321 (28) | |
|
Thank you, I looked at that one... I found it quite confusing because I couldnt figure out where they actually created the list box, and as you know i am very bad at using the win32 api :). I got it working, my mistake was forgetting to typecast. If I could ask one more quick question, that would be great: You know the option to create a multi-column list box right? (LBS_MULTICOLUMN)... If I were to do that, how would windows know how many columns I want, and where to insert each string? Thanks very much for your help, Ryan | |
|
|
|
| andywestken (1964) | |
|
I don't think LBS_MULTICOLUMN is what you're looking for. That's a list box with a single row which scrolls horizontally (and not vertically). What you prob. need is a list-view control with LVS_REPORT style List-View Control Overviews (Windows) http://msdn.microsoft.com/en-us/library/windows/desktop/ff485972%28v=vs.85%29.aspx How to Add List-View Columns (Windows) http://msdn.microsoft.com/en-us/library/windows/desktop/hh298344%28v=vs.85%29.aspx How to Add List-View Items and Subitems (Windows) http://msdn.microsoft.com/en-us/library/windows/desktop/hh298346%28v=vs.85%29.aspx Etc. | |
|
|
|
| partytime4321 (28) | |
| Thanks very much, I will look into implementing that | |
|
|
|