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. C / C++ / MFC
  4. SDI List Control example

SDI List Control example

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
14 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.
  • H hellogany

    Hi can anyone give me some examples or tutorial for list control in SDI FormViews I m bugged of this..

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    I'm not sure whether you are using MFC, but CListView[^] should help you.

    It's time for a new signature.

    H 1 Reply Last reply
    0
    • L Lost User

      I'm not sure whether you are using MFC, but CListView[^] should help you.

      It's time for a new signature.

      H Offline
      H Offline
      hellogany
      wrote on last edited by
      #3

      Ya i m using mFC I m tryin to use List Control in Form View. I m gettin error..Thts y..

      L C 2 Replies Last reply
      0
      • H hellogany

        Ya i m using mFC I m tryin to use List Control in Form View. I m gettin error..Thts y..

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        hellogany wrote:

        I m gettin error

        And you think maybe I can guess what that is? Try and explain your problem clearly, if necessary post some of your code and explain exactly what the error is and which line of the code it occurs on.

        It's time for a new signature.

        1 Reply Last reply
        0
        • H hellogany

          Ya i m using mFC I m tryin to use List Control in Form View. I m gettin error..Thts y..

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #5

          hellogany wrote:

          I m gettin error

          You know, we can't see your screen from here. So, if you don't provide a clear description of your problem, we won't be able to help you.

          Cédric Moonen Software developer
          Charting control [v3.0] OpenGL game tutorial in C++

          H 1 Reply Last reply
          0
          • C Cedric Moonen

            hellogany wrote:

            I m gettin error

            You know, we can't see your screen from here. So, if you don't provide a clear description of your problem, we won't be able to help you.

            Cédric Moonen Software developer
            Charting control [v3.0] OpenGL game tutorial in C++

            H Offline
            H Offline
            hellogany
            wrote on last edited by
            #6

            Hi Sorry for not explaining the problem.. Actually i m havin an application in windows explorer view. Left view contains a tree view with various items, Upon clicking an item in treeview , a form view appears in right window. In one of the form view i m using an list control .. I m trying the insert the column name in OnshowWindow or in Oncreate() windows. But both of them throws assertion error. Kindly go through the below code.. m_listctrl.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); CRect rect; m_listctrl.GetClientRect(&rect); int ctl=rect.Width()/10; m_listctrl.InsertColumn(0,"ORDERNO",LVCFMT_LEFT,ctl); m_listctrl.InsertColumn(1,"MOLDNO",LVCFMT_LEFT,ctl); m_listctrl.InsertColumn(2,"OD TYPE",LVCFMT_LEFT,ctl); m_listctrl.InsertColumn(3,"ESTAB DATE",LVCFMT_LEFT,ctl); Is ther property of the form view or the list control to be changed?? Any solutions will be highly appreciated.

            L 1 Reply Last reply
            0
            • H hellogany

              Hi Sorry for not explaining the problem.. Actually i m havin an application in windows explorer view. Left view contains a tree view with various items, Upon clicking an item in treeview , a form view appears in right window. In one of the form view i m using an list control .. I m trying the insert the column name in OnshowWindow or in Oncreate() windows. But both of them throws assertion error. Kindly go through the below code.. m_listctrl.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); CRect rect; m_listctrl.GetClientRect(&rect); int ctl=rect.Width()/10; m_listctrl.InsertColumn(0,"ORDERNO",LVCFMT_LEFT,ctl); m_listctrl.InsertColumn(1,"MOLDNO",LVCFMT_LEFT,ctl); m_listctrl.InsertColumn(2,"OD TYPE",LVCFMT_LEFT,ctl); m_listctrl.InsertColumn(3,"ESTAB DATE",LVCFMT_LEFT,ctl); Is ther property of the form view or the list control to be changed?? Any solutions will be highly appreciated.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #7

              hellogany wrote:

              But both of them throws assertion error.

              Please understand, we cannot see your screen and we cannot guess what errors you are getting.

              It's time for a new signature.

              H 1 Reply Last reply
              0
              • L Lost User

                hellogany wrote:

                But both of them throws assertion error.

                Please understand, we cannot see your screen and we cannot guess what errors you are getting.

                It's time for a new signature.

                H Offline
                H Offline
                hellogany
                wrote on last edited by
                #8

                Hi This is the error i get Debug Assertion Error f:\rtm\vctools\vc7libs\ship\atlmfc\include\afxcmn2.inl Line 113

                L 1 Reply Last reply
                0
                • H hellogany

                  Hi This is the error i get Debug Assertion Error f:\rtm\vctools\vc7libs\ship\atlmfc\include\afxcmn2.inl Line 113

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #9

                  Unfortunately I don't have this source with VC++ Express so I cannot guess what the issue is. I suggest you step through with the debugger to try and see what is causing the assertion. Check the value of variables, pointers etc when the assertion is thrown.

                  It's time for a new signature.

                  H 1 Reply Last reply
                  0
                  • L Lost User

                    Unfortunately I don't have this source with VC++ Express so I cannot guess what the issue is. I suggest you step through with the debugger to try and see what is causing the assertion. Check the value of variables, pointers etc when the assertion is thrown.

                    It's time for a new signature.

                    H Offline
                    H Offline
                    hellogany
                    wrote on last edited by
                    #10

                    When i try to debug , its gettin error on the below line in afxcmn2.dll AFXCMN_INLINE DWORD CListCtrl::SetExtendedStyle(DWORD dwNewStyle) { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM) dwNewStyle); } My Doubt is Can we drag the list control icon from the tool box and put in form view right.. Is there Any diference btwn the way of using list control in dialog box and form view?? Any Propetries Need to Be changed ?

                    L 1 Reply Last reply
                    0
                    • H hellogany

                      When i try to debug , its gettin error on the below line in afxcmn2.dll AFXCMN_INLINE DWORD CListCtrl::SetExtendedStyle(DWORD dwNewStyle) { ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM) dwNewStyle); } My Doubt is Can we drag the list control icon from the tool box and put in form view right.. Is there Any diference btwn the way of using list control in dialog box and form view?? Any Propetries Need to Be changed ?

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #11

                      From the above I would guess that your list control has not been initialised properly and does not have a valid m_hWnd property. I have not used MFC for some time so I cannot comment on the last question. However, as I suggested earlier, it may be better to use a CListView as your client window, rather than trying to use a list control inside a CFormView.

                      It's time for a new signature.

                      H 1 Reply Last reply
                      0
                      • L Lost User

                        From the above I would guess that your list control has not been initialised properly and does not have a valid m_hWnd property. I have not used MFC for some time so I cannot comment on the last question. However, as I suggested earlier, it may be better to use a CListView as your client window, rather than trying to use a list control inside a CFormView.

                        It's time for a new signature.

                        H Offline
                        H Offline
                        hellogany
                        wrote on last edited by
                        #12

                        Well i m also havinn other control such as button,combo box,date time picker etc., Thts y i m going to formview rather than listview Thanks Gany

                        L 1 Reply Last reply
                        0
                        • H hellogany

                          Well i m also havinn other control such as button,combo box,date time picker etc., Thts y i m going to formview rather than listview Thanks Gany

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #13

                          As I said before it's a long time since I have used MFC, but it may be that you should use a ListBox rather than a ListView to contain your entries. Other than that, I'm afraid I have no suggestions.

                          It's time for a new signature.

                          H 1 Reply Last reply
                          0
                          • L Lost User

                            As I said before it's a long time since I have used MFC, but it may be that you should use a ListBox rather than a ListView to contain your entries. Other than that, I'm afraid I have no suggestions.

                            It's time for a new signature.

                            H Offline
                            H Offline
                            hellogany
                            wrote on last edited by
                            #14

                            thanks for ur suggestions

                            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