Virtual List View
-
Each list view is associated with a list control which we can access by calling GetListCtrl(). How to set this list control to use LVS_OWNERDATA style ? I've tried to put these in OnCreate or OnInitialUpdate but it didn't work. The list is still not of OWNERDATA style. CListCtrl &ctlTmp = this->GetListCtrl(); ctlTmp.ModifyStyle(NULL, LVS_REPORT | LVS_OWNERDATA); how could I do this ?
-
Each list view is associated with a list control which we can access by calling GetListCtrl(). How to set this list control to use LVS_OWNERDATA style ? I've tried to put these in OnCreate or OnInitialUpdate but it didn't work. The list is still not of OWNERDATA style. CListCtrl &ctlTmp = this->GetListCtrl(); ctlTmp.ModifyStyle(NULL, LVS_REPORT | LVS_OWNERDATA); how could I do this ?
You can't dynamically set this style - it has to be set when the control is created. You can pass it with the dwStyle parameter to Create()/CreateEx() or set it in the resource editor properties if it's a control on a dialog resource. Mark
"Go that way, really fast. If something gets in your way, turn."
-
You can't dynamically set this style - it has to be set when the control is created. You can pass it with the dwStyle parameter to Create()/CreateEx() or set it in the resource editor properties if it's a control on a dialog resource. Mark
"Go that way, really fast. If something gets in your way, turn."
Mark Salsbery wrote:
You can pass it with the dwStyle parameter to Create()/CreateEx() or set it in the resource editor properties if it's a control on a dialog resource.
yeah, if it was a list control in a normal dialog then it would be easy. But for a list view and its associated list control, I dont' know where and when the list control is created to set its style. GP
-
Mark Salsbery wrote:
You can pass it with the dwStyle parameter to Create()/CreateEx() or set it in the resource editor properties if it's a control on a dialog resource.
yeah, if it was a list control in a normal dialog then it would be easy. But for a list view and its associated list control, I dont' know where and when the list control is created to set its style. GP
In a CListView derived class, override PreCreateWindow()...
BOOL CMyListView::PreCreateWindow(CREATESTRUCT& cs)
{
if (CListView::PreCreateWindow(cs))
{
cs.style |= LVS_OWNERDATA;
return TRUE;
}return FALSE;
}"Go that way, really fast. If something gets in your way, turn."
-
In a CListView derived class, override PreCreateWindow()...
BOOL CMyListView::PreCreateWindow(CREATESTRUCT& cs)
{
if (CListView::PreCreateWindow(cs))
{
cs.style |= LVS_OWNERDATA;
return TRUE;
}return FALSE;
}"Go that way, really fast. If something gets in your way, turn."
Thanks Mark, it works so charming now :-D I give u a 5-star vote :-D