CCheckListBox and CListBoxImpl
-
Hi All, I was wondering if anyone has done any development in WTL with the CCheckListBox? I have a ListBox but want to give the functionality (and feedback to user) that they have selected multiple items. I have tried using the macro's described in MSDN but have had no luck.
ListView_SetExtendedListViewStyle(this->m_ipCheckList.m_hWnd, LVS_EX_CHECKBOXES);
When I mean no luck, I mean that the above call has no effect on my ListBox (no check box appears next to it). Any thoughts on what I would have to do to get something like the above going? thanks Bryce -
Hi All, I was wondering if anyone has done any development in WTL with the CCheckListBox? I have a ListBox but want to give the functionality (and feedback to user) that they have selected multiple items. I have tried using the macro's described in MSDN but have had no luck.
ListView_SetExtendedListViewStyle(this->m_ipCheckList.m_hWnd, LVS_EX_CHECKBOXES);
When I mean no luck, I mean that the above call has no effect on my ListBox (no check box appears next to it). Any thoughts on what I would have to do to get something like the above going? thanks BryceA listbox and listview are two different controls. Your code will work for a list view as long as its in report mode but will not for a listbox. This works in some code I'm currently using for a ListView. ClistViewControl m_listView m_listView.Attach( GetDlgItem( IDC_LIST_STATION_DATA) ); m_listView.SetExtendedListViewStyle( LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); Correct me if I am wrong but the CCheckListBox is a mfc construct not wtl. The following url explains how to use it http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/\_mfc\_cchecklistbox.asp Hope this helps
-
A listbox and listview are two different controls. Your code will work for a list view as long as its in report mode but will not for a listbox. This works in some code I'm currently using for a ListView. ClistViewControl m_listView m_listView.Attach( GetDlgItem( IDC_LIST_STATION_DATA) ); m_listView.SetExtendedListViewStyle( LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); Correct me if I am wrong but the CCheckListBox is a mfc construct not wtl. The following url explains how to use it http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/\_mfc\_cchecklistbox.asp Hope this helps
Hi, Thanks for your reply. I thought there may have been another version of the CheckListBox for WTL... oh well... How have you defined what your ClistViewControl object is? The supplied code will not compile as there is no definition of ClistViewControl. I tried to convert it to CListViewControlImpl m_ListView; with below in stdafx.h
class CListViewControlImpl : public CWindowImpl { DECLARE_EMPTY_MSG_MAP(); };
Can you please supply your definition on your ClistViewControl. Thanks Bryce -
Hi, Thanks for your reply. I thought there may have been another version of the CheckListBox for WTL... oh well... How have you defined what your ClistViewControl object is? The supplied code will not compile as there is no definition of ClistViewControl. I tried to convert it to CListViewControlImpl m_ListView; with below in stdafx.h
class CListViewControlImpl : public CWindowImpl { DECLARE_EMPTY_MSG_MAP(); };
Can you please supply your definition on your ClistViewControl. Thanks BryceHi, Im using WTL version 7. In order to use the control wrapper just add #include to your stdafx.h. then you can declare CListViewCtrl m_listView; and use it accordingly If your still having problems i can send you a sample app. Hope this helps:) edit: whoops the <> were lost in html.
-
Hi, Im using WTL version 7. In order to use the control wrapper just add #include to your stdafx.h. then you can declare CListViewCtrl m_listView; and use it accordingly If your still having problems i can send you a sample app. Hope this helps:) edit: whoops the <> were lost in html.
Thanks for your help. I can get it to compile now! I did change it a little bit so that DDX can work. in stdafx.h define like below
class CListViewCtrlImpl : public CWindowImpl<CListViewCtrlImpl, CListViewCtrl> { DECLARE_EMPTY_MSG_MAP(); };
then in your class you use CListViewCtrlImpl instead of CListViewCtrl. What method did you use to add elements to the List? I simple demo app would be handy. please send thanks cheers Bryce -
Hi All, I was wondering if anyone has done any development in WTL with the CCheckListBox? I have a ListBox but want to give the functionality (and feedback to user) that they have selected multiple items. I have tried using the macro's described in MSDN but have had no luck.
ListView_SetExtendedListViewStyle(this->m_ipCheckList.m_hWnd, LVS_EX_CHECKBOXES);
When I mean no luck, I mean that the above call has no effect on my ListBox (no check box appears next to it). Any thoughts on what I would have to do to get something like the above going? thanks BryceA list box and list view control are different things. The list view has checkbox support built-in. If you want checks in a list box, you'll need to write it yourself (
CCheckListBox
is an MFC class, I suppose you could take that code and port it to WTL). WTL hasCCheckListViewCtrl
that wraps a list view with checkboxes. Look in atlctrlx.h for its definition. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true. -
Thanks for your help. I can get it to compile now! I did change it a little bit so that DDX can work. in stdafx.h define like below
class CListViewCtrlImpl : public CWindowImpl<CListViewCtrlImpl, CListViewCtrl> { DECLARE_EMPTY_MSG_MAP(); };
then in your class you use CListViewCtrlImpl instead of CListViewCtrl. What method did you use to add elements to the List? I simple demo app would be handy. please send thanks cheers Bryce