CListCtrl and selected rows in a dialog
-
I've got a CListCtrl in a dialog that selects a row. The problem is that the selection disappears when I click on a another control in the dialog and the focus moves there. How can I make the CListCtrl continually show the selected row, without going to custom draw, etc? Thanks. Peter
-
I've got a CListCtrl in a dialog that selects a row. The problem is that the selection disappears when I click on a another control in the dialog and the focus moves there. How can I make the CListCtrl continually show the selected row, without going to custom draw, etc? Thanks. Peter
modify the List Control to use LVS_EX_SHOWSELALWAYS, eg void MyDialog::OnInitDialog () { ... m_myList.SetExtendedStyle (m_myList.GetExtendedStyle() | LVS_EX_SHOWSELALWAYS); ... } hope this is what you need nb
-
modify the List Control to use LVS_EX_SHOWSELALWAYS, eg void MyDialog::OnInitDialog () { ... m_myList.SetExtendedStyle (m_myList.GetExtendedStyle() | LVS_EX_SHOWSELALWAYS); ... } hope this is what you need nb
Thanks, that pointed me in the right direction. It doesn't quite work that way, so I need to do something like this: CMyDialog:OnInitDialog... CRect rcWin; m_ListCtrl.GetWindowRect(&rcWin); ScreenToClient(&rcWin); DWORD nStyle = m_ListCtrl.GetStyle(); UINT nID = ::GetWindowLong(m_ListCtrl.m_hWnd,GWL_ID); long nExStyle = m_ListCtrl.GetExtendedStyle(); m_ListCtrl.DestroyWindow(); m_ListCtrl.Create(nStyle | WS_BORDER | LVS_SHOWSELALWAYS, rcWin, this, nID); m_ListCtrl.SetExtendedStyle(nExStyle | WS_EX_WINDOWEDGE); Still haven't figured out how to get the standard 3-d border on the listcontrol. Tried all sorts of WS_ and WS_EX_ but it doesn't seem to go. May have to leave it that way. Peter
-
Thanks, that pointed me in the right direction. It doesn't quite work that way, so I need to do something like this: CMyDialog:OnInitDialog... CRect rcWin; m_ListCtrl.GetWindowRect(&rcWin); ScreenToClient(&rcWin); DWORD nStyle = m_ListCtrl.GetStyle(); UINT nID = ::GetWindowLong(m_ListCtrl.m_hWnd,GWL_ID); long nExStyle = m_ListCtrl.GetExtendedStyle(); m_ListCtrl.DestroyWindow(); m_ListCtrl.Create(nStyle | WS_BORDER | LVS_SHOWSELALWAYS, rcWin, this, nID); m_ListCtrl.SetExtendedStyle(nExStyle | WS_EX_WINDOWEDGE); Still haven't figured out how to get the standard 3-d border on the listcontrol. Tried all sorts of WS_ and WS_EX_ but it doesn't seem to go. May have to leave it that way. Peter
Instead of re-creating the window, select the 'show selection always' option in the list control properties in dialog editor. > Still haven't figured out how to get the standard 3-d border on > the listcontrol. Tried all sorts of WS_ and WS_EX_ but > it doesn't seem to go Are you creating your list control programatically (CListCtrl::Create), or in dialog editor? Tomasz Sowinski http://www.shooltz.com.pl
-
Instead of re-creating the window, select the 'show selection always' option in the list control properties in dialog editor. > Still haven't figured out how to get the standard 3-d border on > the listcontrol. Tried all sorts of WS_ and WS_EX_ but > it doesn't seem to go Are you creating your list control programatically (CListCtrl::Create), or in dialog editor? Tomasz Sowinski http://www.shooltz.com.pl
Yes, that's exactly what I was looking for. Thanks! Peter