Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. CCheckListBox and CListBoxImpl

CCheckListBox and CListBoxImpl

Scheduled Pinned Locked Moved ATL / WTL / STL
c++beta-testingquestiondiscussioncode-review
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bryces
    wrote on last edited by
    #1

    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

    C M 2 Replies Last reply
    0
    • B bryces

      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

      C Offline
      C Offline
      coge
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • C coge

        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

        B Offline
        B Offline
        bryces
        wrote on last edited by
        #3

        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

        C 1 Reply Last reply
        0
        • B bryces

          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

          C Offline
          C Offline
          coge
          wrote on last edited by
          #4

          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.

          B 1 Reply Last reply
          0
          • C coge

            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.

            B Offline
            B Offline
            bryces
            wrote on last edited by
            #5

            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

            C 1 Reply Last reply
            0
            • B bryces

              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

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              A 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 has CCheckListViewCtrl 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.

              1 Reply Last reply
              0
              • B bryces

                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

                C Offline
                C Offline
                coge
                wrote on last edited by
                #7

                I sent you a sample app with adding of elements. Let me know if this is what you needed. Thanks, Clay

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups