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. How to span columns in CListCtrl

How to span columns in CListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
c++csstutorialquestion
12 Posts 8 Posters 2 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.
  • E Eric Jacobsen

    My application scrolls data in real-time over several columns using a CListCtrl (MSVC++ 6.0). I'd like to occasionally put a user-message that takes up the entire row, spanning all the columns in the table. The MFC Grid Control doesn't seem to have this feature (hint hint). Does anyone know if this has been done? Thanks! Eric ---------------------------------------- Please reply in the forum--email is filtered

    S Offline
    S Offline
    Stephen Hewitt
    wrote on last edited by
    #3

    You could subclass the control and put code in to draw to text manually (just the "full line" text). Steve

    1 Reply Last reply
    0
    • E Eric Jacobsen

      My application scrolls data in real-time over several columns using a CListCtrl (MSVC++ 6.0). I'd like to occasionally put a user-message that takes up the entire row, spanning all the columns in the table. The MFC Grid Control doesn't seem to have this feature (hint hint). Does anyone know if this has been done? Thanks! Eric ---------------------------------------- Please reply in the forum--email is filtered

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #4

      It's not supported by the control directly, but it isn't terribly difficult. Review the various custom draw articles in the CListCtrl section here on CP - you want to intercept drawing for a specific row, and draw it yourself.

      ---- I just want you to be happy; That's my only little wish...

      E 1 Reply Last reply
      0
      • D David Crow

        Eric Jacobsen wrote:

        The MFC Grid Control doesn't seem to have this feature (hint hint).

        Which implies that a list control certainly doesn't! Can you embed an Excel sheet into the application?


        "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

        E Offline
        E Offline
        Eric Jacobsen
        wrote on last edited by
        #5

        Yes, the Excel functionality is just what I'm thinking of, but I think embedding an Excel sheet would probably be overkill

        1 Reply Last reply
        0
        • S Shog9 0

          It's not supported by the control directly, but it isn't terribly difficult. Review the various custom draw articles in the CListCtrl section here on CP - you want to intercept drawing for a specific row, and draw it yourself.

          ---- I just want you to be happy; That's my only little wish...

          E Offline
          E Offline
          Eric Jacobsen
          wrote on last edited by
          #6

          This is what I'm looking into now. I'm stumbling a little on the issue of how to derive from CListView because CListView HAS A CListCtrl, but supposedly can act as if it IS A CListCtrl. Thanks for the response...

          R 1 Reply Last reply
          0
          • E Eric Jacobsen

            This is what I'm looking into now. I'm stumbling a little on the issue of how to derive from CListView because CListView HAS A CListCtrl, but supposedly can act as if it IS A CListCtrl. Thanks for the response...

            R Offline
            R Offline
            Ryan Binns
            wrote on last edited by
            #7

            Actually, CListView IS a CListCtrl. If you look at the implementation of GetListCtrl(), it merely does

            return (*(CListCtrl*)this);

            or something similar.

            Ryan

            "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

            O 1 Reply Last reply
            0
            • R Ryan Binns

              Actually, CListView IS a CListCtrl. If you look at the implementation of GetListCtrl(), it merely does

              return (*(CListCtrl*)this);

              or something similar.

              Ryan

              "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

              O Offline
              O Offline
              Owner drawn
              wrote on last edited by
              #8

              This is news to me...Thanks.:-D

              Jesus Lives Forever - Amen:rose:

              --Owner drawn:rose: --An eye for an eye makes the whole world blind. --If you find my post helpful then do rate it. --Jesus is Lord:rose:

              1 Reply Last reply
              0
              • E Eric Jacobsen

                My application scrolls data in real-time over several columns using a CListCtrl (MSVC++ 6.0). I'd like to occasionally put a user-message that takes up the entire row, spanning all the columns in the table. The MFC Grid Control doesn't seem to have this feature (hint hint). Does anyone know if this has been done? Thanks! Eric ---------------------------------------- Please reply in the forum--email is filtered

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

                Use custom draw to draw whatever you want in your user-message rows. See: Neat Stuff to do in List Controls Using Custom Draw[^] --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                E 1 Reply Last reply
                0
                • M Michael Dunn

                  Use custom draw to draw whatever you want in your user-message rows. See: Neat Stuff to do in List Controls Using Custom Draw[^] --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

                  E Offline
                  E Offline
                  Eric Jacobsen
                  wrote on last edited by
                  #10

                  Thanks Mike, I had scanned your article and for some reason didn't think it was what I needed. It is EXACTLY what I needed, thanks. Since my derived CListView class IS A CListCtrl apparently, I'm using the ON_NOTIFY_REFLECT version. Embedding a CString pointer in the items lparam, and using DrawText to draw the string centered in the row. Returning *pResult = CDRF_SKIPDEFAULT to prevent any other drawing in these rows.

                  U 2 Replies Last reply
                  0
                  • E Eric Jacobsen

                    Thanks Mike, I had scanned your article and for some reason didn't think it was what I needed. It is EXACTLY what I needed, thanks. Since my derived CListView class IS A CListCtrl apparently, I'm using the ON_NOTIFY_REFLECT version. Embedding a CString pointer in the items lparam, and using DrawText to draw the string centered in the row. Returning *pResult = CDRF_SKIPDEFAULT to prevent any other drawing in these rows.

                    U Offline
                    U Offline
                    User 9166573
                    wrote on last edited by
                    #11

                    Hi, can you just me show the code for the same Regards Shri

                    1 Reply Last reply
                    0
                    • E Eric Jacobsen

                      Thanks Mike, I had scanned your article and for some reason didn't think it was what I needed. It is EXACTLY what I needed, thanks. Since my derived CListView class IS A CListCtrl apparently, I'm using the ON_NOTIFY_REFLECT version. Embedding a CString pointer in the items lparam, and using DrawText to draw the string centered in the row. Returning *pResult = CDRF_SKIPDEFAULT to prevent any other drawing in these rows.

                      U Offline
                      U Offline
                      User 9166573
                      wrote on last edited by
                      #12

                      Hi, can you just provide me the sample code for the same Regards Shri

                      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