Re: Owner Data ListView Ctrl failing to insert column in Vista
"arasakumaran" <arasakumaran-/[email protected]>
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <[email protected]> |
Thank you for the suggestion. I have spent hours trying varying combinations. Started with the simplest list control (which shows columns in Vista as well as XP) and slowly added styles (no headers, owner data etc. ) to see when it fails. It certainly appears to be a bug and is consistent when I try and create the control (though I confirm that after the 'create' the requested styles are the same both in XP and Vista) Worked around this finally - have a dialog as the view for the mainframe and the control in the dialog where styles are set in the resource. This means extra work in terms of routing some messages from the mainframe but both Vista and XP show column style listview control If I knew how to write this as a bug /support request - I would. --- In [email protected], "domehead100" <domehead100@...> wrote: > > Sounds like a bug in the common controls on Vista. You might want to make sure that the service pack is current. > > Just a wild guess, but you might try NOT setting LVS_NOCOLUMNHEADER at create time, calling SetColumns(), and then doing your ModifyStyle(0, LVS_NOCOLUMNHEADER, TRUE) after the columns have been set. > > I can imagine someone at MS writing code assuming that the header existed and was visible that would fail if it was not. > > --- In [email protected], "arasakumaran" <arasakumaran@> wrote: > > > > I am having a problem with a listview control. It works fine in XP (the development machine), but fails in a Vista machine (where I do not have the development environment). > > > > It is a report style listview control and is Owner data. It is an SDI application where the Main window creates the listview. The step to insert column fails in the vista computer. I have included the code where the styles etc. is defined (omitted rest of the class). Any help is appreciated. > > .. > > > > typedef CWinTraits< > > WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |LVS_OWNERDATA| > > LVS_REPORT | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER,WS_EX_CLIENTEDGE| > > LVS_EX_DOUBLEBUFFER|LVS_EX_FLATSB|LVS_EX_FULLROWSELECT> CMyListViewWinTraits; > > > > template< class T, class TBase = CListViewCtrl, class TWinTraits = CMyListViewWinTraits > > > class CMyListCtrlT : public CWindowImpl<T, TBase,TWinTraits> > > { > > public: > > DECLARE_WND_SUPERCLASS(NULL, TBase::GetWndClassName()) > > typedef CWindowImpl<T, TBase,TWinTraits> baseClass; > > typedef CMyListCtrlT<T, TBase,TWinTraits> thisClass; > > > > CMyListCtrlT(): m_bMiniVersion(false) > > { > > } > > void _Init(bool bMini = false) > > { > > T* pT = static_cast<T*>(this); > > m_bMiniVersion = bMini; > > _ASSERTE(pT->GetWindowLong(GWL_STYLE) & LVS_REPORT); > > _ASSERTE(pT->GetWindowLong(GWL_STYLE) & LVS_OWNERDATA); > > _ASSERTE(pT->GetWindowLong(GWL_STYLE) & LVS_NOCOLUMNHEADER); > > pT->SetExtendedListViewStyle(GetExtendedListViewStyle()| LVS_EX_FLATSB | LVS_EX_FULLROWSELECT ); > > pT->ModifyStyle(0,LVS_NOCOLUMNHEADER,TRUE); > > SetColumns(); > > ATLTRACE(_T("After CNotesListCtrlT::_Init \n")); > > } > > BOOL SubclassWindow(HWND hWnd) > > { > > ATLASSERT(m_hWnd==NULL); > > ATLASSERT(::IsWindow(hWnd)); > > #ifdef _DEBUG > > // Check class > > TCHAR szBuffer[32] = { 0 }; > > if( ::GetClassName(hWnd, szBuffer, (sizeof(szBuffer)/sizeof(TCHAR))-1) ) { > > ATLASSERT(::lstrcmpi(szBuffer, CListViewCtrl::GetWndClassName()) == 0); > > } > > #endif // _DEBUG > > BOOL bRet = baseClass::SubclassWindow(hWnd); > > if( bRet ) _Init(); > > return bRet; > > } > > bool SetColumns() /// InsertColumn fails in Vista > > { > > T* pT = static_cast<T*>(this); > > if (pT->InsertColumn(0,_T("ID"),LVCFMT_LEFT,20) == -1) return false; > > if (pT->InsertColumn(1,_T("Title"),LVCFMT_LEFT,220) == -1) return false; > > return true; > > } > > }; > > class CMyListView : public CMyListCtrlT<CMyListView> > > { > > public: > > DECLARE_WND_SUPERCLASS(_T("MyListView"), CListViewCtrl::GetWndClassName()) > > typedef CMyListCtrlT<CMyListView> baseClass; > > > > BOOL PreTranslateMessage(MSG* pMsg); > > > > BEGIN_MSG_MAP(CMyListView) > > CHAIN_MSG_MAP(baseClass) > > END_MSG_MAP() > > > > > > protected: > > CFilterPanelDlg m_panel; > > > > public: > > > > }; > > > ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/wtl/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/wtl/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/