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. CListCtrl & theCtrl = GetListCtrl

CListCtrl & theCtrl = GetListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
12 Posts 2 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.
  • C Offline
    C Offline
    cy163 hotmail com
    wrote on last edited by
    #1

    I saw these lines in an example code. I am not clear about it.

    CListVieiw::OnInitialUpdate();
    CListCtrl & theCtrl = GetListCtrl();

    My questions are (1) Is GetListCtrl()( on the second line) a member function;Which class does it belong to? (2) what does the '&' mean at the left hand side?

    D 1 Reply Last reply
    0
    • C cy163 hotmail com

      I saw these lines in an example code. I am not clear about it.

      CListVieiw::OnInitialUpdate();
      CListCtrl & theCtrl = GetListCtrl();

      My questions are (1) Is GetListCtrl()( on the second line) a member function;Which class does it belong to? (2) what does the '&' mean at the left hand side?

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      cy163@hotmail.com wrote:

      (1) Is GetListCtrl()( on the second line) a member function;Which class does it belong to?

      See here.

      cy163@hotmail.com wrote:

      (2) what does the '&' mean at the left hand side?

      See here.

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Man who follows car will be exhausted." - Confucius

      C 1 Reply Last reply
      0
      • D David Crow

        cy163@hotmail.com wrote:

        (1) Is GetListCtrl()( on the second line) a member function;Which class does it belong to?

        See here.

        cy163@hotmail.com wrote:

        (2) what does the '&' mean at the left hand side?

        See here.

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Man who follows car will be exhausted." - Confucius

        C Offline
        C Offline
        cy163 hotmail com
        wrote on last edited by
        #3

        Thank you DavidCrow for your reply. I wonder what exactly is the role of GetListCtrl(); generate a instance of ListCtrl? or sth else?

        D 1 Reply Last reply
        0
        • C cy163 hotmail com

          Thank you DavidCrow for your reply. I wonder what exactly is the role of GetListCtrl(); generate a instance of ListCtrl? or sth else?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          cy163@hotmail.com wrote:

          I wonder what exactly is the role of GetListCtrl(); generate a instance of ListCtrl? or sth else?

          To get a reference to the list control associated with the view.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          C 1 Reply Last reply
          0
          • D David Crow

            cy163@hotmail.com wrote:

            I wonder what exactly is the role of GetListCtrl(); generate a instance of ListCtrl? or sth else?

            To get a reference to the list control associated with the view.

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "Man who follows car will be exhausted." - Confucius

            C Offline
            C Offline
            cy163 hotmail com
            wrote on last edited by
            #5

            Thanks again. However, what if there are more than one list controls associated with the view.

            D 1 Reply Last reply
            0
            • C cy163 hotmail com

              Thanks again. However, what if there are more than one list controls associated with the view.

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              cy163@hotmail.com wrote:

              However, what if there are more than one list controls associated with the view.

              Then you'd have more than one view.

              "One man's wage rise is another man's price increase." - Harold Wilson

              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

              "Man who follows car will be exhausted." - Confucius

              C 1 Reply Last reply
              0
              • D David Crow

                cy163@hotmail.com wrote:

                However, what if there are more than one list controls associated with the view.

                Then you'd have more than one view.

                "One man's wage rise is another man's price increase." - Harold Wilson

                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                "Man who follows car will be exhausted." - Confucius

                C Offline
                C Offline
                cy163 hotmail com
                wrote on last edited by
                #7

                You mean ONLY one ListCtrl can be associated with one view? If so, Why there may be more than one ListCtrl in a dialog Or, I misunderstand the view concept. I think a dialog essentially is a view.

                D 1 Reply Last reply
                0
                • C cy163 hotmail com

                  You mean ONLY one ListCtrl can be associated with one view? If so, Why there may be more than one ListCtrl in a dialog Or, I misunderstand the view concept. I think a dialog essentially is a view.

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  cy163@hotmail.com wrote:

                  You mean ONLY one ListCtrl can be associated with one view?

                  Yes, unless the view is a CFormView.

                  cy163@hotmail.com wrote:

                  If so, Why there may be more than one ListCtrl in a dialog

                  Because a dialog is not a view.

                  cy163@hotmail.com wrote:

                  Or, I misunderstand the view concept.

                  Perhaps. But, have no fear, there's plenty of online documentation/examples to help you out.

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  "Man who follows car will be exhausted." - Confucius

                  C 1 Reply Last reply
                  0
                  • D David Crow

                    cy163@hotmail.com wrote:

                    You mean ONLY one ListCtrl can be associated with one view?

                    Yes, unless the view is a CFormView.

                    cy163@hotmail.com wrote:

                    If so, Why there may be more than one ListCtrl in a dialog

                    Because a dialog is not a view.

                    cy163@hotmail.com wrote:

                    Or, I misunderstand the view concept.

                    Perhaps. But, have no fear, there's plenty of online documentation/examples to help you out.

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "Man who follows car will be exhausted." - Confucius

                    C Offline
                    C Offline
                    cy163 hotmail com
                    wrote on last edited by
                    #9

                    If a view is drived from CFormView. How to distinguish between ListCtrls associated with it.

                    D 1 Reply Last reply
                    0
                    • C cy163 hotmail com

                      If a view is drived from CFormView. How to distinguish between ListCtrls associated with it.

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      They each have a unique control ID, and thus a separate instance of CListCtrl.

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      "Man who follows car will be exhausted." - Confucius

                      C 1 Reply Last reply
                      0
                      • D David Crow

                        They each have a unique control ID, and thus a separate instance of CListCtrl.

                        "One man's wage rise is another man's price increase." - Harold Wilson

                        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                        "Man who follows car will be exhausted." - Confucius

                        C Offline
                        C Offline
                        cy163 hotmail com
                        wrote on last edited by
                        #11

                        So, for a view derived from a non CFormView, GetListCtrl is used to get the reference of the ListCtrl associated with it. for a view derived from a CFormView, how to get the references of ListCtrls associated with it. What command should be used.

                        D 1 Reply Last reply
                        0
                        • C cy163 hotmail com

                          So, for a view derived from a non CFormView, GetListCtrl is used to get the reference of the ListCtrl associated with it. for a view derived from a CFormView, how to get the references of ListCtrls associated with it. What command should be used.

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          cy163@hotmail.com wrote:

                          So, for a view derived from a non CFormView...

                          Specifically, a CListView.

                          cy163@hotmail.com wrote:

                          for a view derived from a CFormView, how to get the references of ListCtrls associated with it.

                          Like a dialog, each control has a unique ID and its own control variable (e.g., CListCtrl).

                          "One man's wage rise is another man's price increase." - Harold Wilson

                          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                          "Man who follows car will be exhausted." - Confucius

                          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