|
-
Sep 4th, 2001, 04:36 PM
#1
Thread Starter
PowerPoster
Add multiple colums to a listview
Is there any example, code, tutorials that teaches you how to make multiple columns in a listview and then add the rows to it?
Thanks if you provide me some link
-
Sep 4th, 2001, 04:40 PM
#2
Monday Morning Lunatic
Would it be out of line to suggest MSDN?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 4th, 2001, 04:54 PM
#3
Thread Starter
PowerPoster
I already looked at msdn but it has the whole explorer application which is a little hard to understand. That is why I want just some code that can add even one row to a multicolumn listview
-
Sep 4th, 2001, 05:15 PM
#4
Monday Morning Lunatic
When you send the add item message, you can specify in the LV(_)ITEM structure what subitem to add it to.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 4th, 2001, 06:39 PM
#5
Send LVM_INSERTCOLUMN to insert a column and LVM_INSERTITEM to insert an item.
-
Sep 4th, 2001, 08:28 PM
#6
Thread Starter
PowerPoster
Originally posted by parksie
When you send the add item message, you can specify in the LV(_)ITEM structure what subitem to add it to.
But how do I use it? I am posting the function that I am using to create a listview with two columns and then I am trying to add two items to each column in a row. But it is actually adding the items to only the first column on two rows
PHP Code:
HWND CreateListView(HINSTANCE hinstance, HWND parenthwnd)
{
HWND lvhwnd;
INITCOMMONCONTROLSEX icex;
RECT rect;
LVCOLUMN lvc;
LVITEM lvi;
GetClientRect(parenthwnd, &rect);
// Ensure that the common control DLL is loaded.
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_LISTVIEW_CLASSES;
//Initialize the commoncontrols library
InitCommonControlsEx(&icex);
//Create the listview control
lvhwnd = CreateWindowEx(WS_EX_CLIENTEDGE,
WC_LISTVIEW,
"",
WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_EDITLABELS,
14,
65,
rect.right - 106,
rect.bottom - 155,
parenthwnd,
NULL,
hinstance,
NULL);
GetClientRect(lvhwnd, &rect);
//Add the columns the in the listview
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
lvc.pszText = "Macro";
lvc.cx = rect.right /3;
ListView_InsertColumn(lvhwnd, 0, &lvc);
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
lvc.pszText = "Macro Definition";
lvc.cx = rect.right - (rect.right /3);
ListView_InsertColumn(lvhwnd, 1, &lvc);
//Add the item in the listview
lvi.mask = LVIF_TEXT |LVIF_PARAM | LVIF_STATE;
lvi.pszText = "AAA";//LPSTR_TEXTCALLBACK; // sends an LVN_GETDISPINFO message.
lvi.iItem = 0;
lvi.state = 0;
lvi.stateMask = 0;
lvi.iSubItem = 0;
ListView_InsertItem(lvhwnd, &lvi);
lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
lvi.pszText = "AAA";//LPSTR_TEXTCALLBACK; // sends an LVN_GETDISPINFO message.
lvi.iItem = 0;
lvi.state = 0;
lvi.stateMask = 0;
lvi.iSubItem = 0;
ListView_InsertItem(lvhwnd, &lvi);
return lvhwnd;
}
-
Sep 5th, 2001, 02:57 AM
#7
Monday Morning Lunatic
Play around with this value
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|