- Clicking on rows does not tick/untick the checkboxes, you need to click on the checkbox itself
The style of row selection also isn't the one i'd like, I'd really like row highlighting like in vlc > preferences > hotkeys, e.g.:
Upon adding the LVS_EX_AUTOCHECKSELECT style:
The checkbox in header now appears, HDS_CHECKBOXES had no effect.
Clicking on a row ticks the checkbox - good
However, problems:
- Clicking again on a row does not untick a checkbox. Should I forget this style and hard code it myself by detecting click events...?
- ****BIG PROBLEM**** The check boxes have all disappeared. They reappear for a single row when hovering over that row. If you tick a checkbox, and move away from the row, the checkbox disappears, moving back it reappears, but unticked. If you select a row, the ticked checkbox remains visible and ticked, until you select another row.
I could really do with some pointers on how to fix this, there are too many variables from my point of view :(
class LinkPeopleWindow
{
public:
static TCHAR* tmp[];
private:
HWND hListViews[1]; // array of listviews
protected:
static TCHAR* colHeaders[]; // List View column headings (NOTE, can NOT be const, incompatable type for LVCOLUMN pszText!)
};
TCHAR* LinkPeopleWindow::colHeaders[] = { _T("ID"), _T("Name") }; //NOTE, can NOT be const, incompatable type for LVCOLUMN pszText!
TCHAR* LinkPeopleWindow::tmp[] = { _T("a"), _T("1"), _T("Example Example Example Example") };
case WM_NOTIFY:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId)
{
case ID_CTRL_LNKPPL_LV:
switch (((LPNMHDR) lParam)->code)
{
case LVN_GETDISPINFO:
NMLVDISPINFO* plvdi = (NMLVDISPINFO*)lParam;
switch (plvdi->item.iSubItem)
{
case 0:
//plvdi->item.pszText = LinkPeopleWindow::tmp[0];
break;
case 1:
plvdi->item.pszText = LinkPeopleWindow::tmp[1];
break;
case 2:
plvdi->item.pszText = LinkPeopleWindow::tmp[2];
break;
default:
break;
}
return 0;
}
break;
default:
break;
}
break;
#include <commctrl.h> is present in stdafx.h
InitCommonControls(); in _tWinMain()
ComCtl32.Lib dragged and dropped into project from C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib
Question
+theblazingangel MVC
I'm having some problems getting a listview to behave properly
Using the following styles I get the following:
LVS_EX_CHECKBOXES | HDS_CHECKBOXES | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP
Problems:
- No checkbox in header
- Clicking on rows does not tick/untick the checkboxes, you need to click on the checkbox itself
The style of row selection also isn't the one i'd like, I'd really like row highlighting like in vlc > preferences > hotkeys, e.g.:
Upon adding the LVS_EX_AUTOCHECKSELECT style:
The checkbox in header now appears, HDS_CHECKBOXES had no effect.
Clicking on a row ticks the checkbox - good
However, problems:
- Clicking again on a row does not untick a checkbox. Should I forget this style and hard code it myself by detecting click events...?
- ****BIG PROBLEM**** The check boxes have all disappeared. They reappear for a single row when hovering over that row. If you tick a checkbox, and move away from the row, the checkbox disappears, moving back it reappears, but unticked. If you select a row, the ticked checkbox remains visible and ticked, until you select another row.
I could really do with some pointers on how to fix this, there are too many variables from my point of view :(
Some code:
#include <commctrl.h> is present in stdafx.h
InitCommonControls(); in _tWinMain()
ComCtl32.Lib dragged and dropped into project from C:\Program Files\Microsoft SDKs\Windows\v7.0\Lib
Win 7 x64 RTM; VC9 express edition; windows sdk v7 rtm; C++; win32; 32-bit application (currently)
Link to comment
https://www.neowin.net/forum/topic/819824-c-listview/Share on other sites
4 answers to this question
Recommended Posts