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. Selection is gray in a CListCtrl

Selection is gray in a CListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
28 Posts 4 Posters 3 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.
  • J Joel Lucsy

    Just to be safe, does explorer highlight in blue when you select a file? Its possible to have your "scheme" have the highlight color set to gray. As another thought, is your ListView (or ListCtrl) derived from anything, meaning did you use a class from an outside source? Just wondering if perhaps you or that class might be using NM_CUSTOMDRAW to override painting. Also, what styles are being used on the view, single selection, full-row selection, show selection always, owner data, owner draw? Personally I've never seen a basic ListCtrl ever paint incorrectly without some kind of interference from code.

    R Offline
    R Offline
    RoyceF
    wrote on last edited by
    #19

    Yes, Explorer highlights in blue, as it always has. Also, a TreeCtrl in my app which is a sibling of my ListCtrl selects correctly with a blue highlight.

    J 1 Reply Last reply
    0
    • R RoyceF

      Yes, Explorer highlights in blue, as it always has. Also, a TreeCtrl in my app which is a sibling of my ListCtrl selects correctly with a blue highlight.

      J Offline
      J Offline
      Joel Lucsy
      wrote on last edited by
      #20

      Oh, um, are you using a manifest under VC6? I know when you use manifests (to get the XP style look), imagelists behave differently. I think, but not certain by any means, that the newer compilers handle this without problems, but I'm fairly sure VC6 won't. I've found CImageList won't work quite right, I had to use the macros like ImageList_Create for it to work right.

      R 1 Reply Last reply
      0
      • J Joel Lucsy

        Oh, um, are you using a manifest under VC6? I know when you use manifests (to get the XP style look), imagelists behave differently. I think, but not certain by any means, that the newer compilers handle this without problems, but I'm fairly sure VC6 won't. I've found CImageList won't work quite right, I had to use the macros like ImageList_Create for it to work right.

        R Offline
        R Offline
        RoyceF
        wrote on last edited by
        #21

        No, I am using VC7 unmanaged code.

        J 1 Reply Last reply
        0
        • R RoyceF

          No, I am using VC7 unmanaged code.

          J Offline
          J Offline
          Joel Lucsy
          wrote on last edited by
          #22

          VC7 has an option during project creation for including a manifest for C++ apps that defaults to "ON". Check your project or project/res directory for a .manifest file. If you have one, then its probably being used. Try turning it off.

          R 1 Reply Last reply
          0
          • J Joel Lucsy

            VC7 has an option during project creation for including a manifest for C++ apps that defaults to "ON". Check your project or project/res directory for a .manifest file. If you have one, then its probably being used. Try turning it off.

            R Offline
            R Offline
            RoyceF
            wrote on last edited by
            #23

            How do I do that? My test app project has a manifest file, but my real project does not. With both projects exhibiting the same behavior, one has a manifest and the other does not, I can't believe that is the problem. Anyway, I can't find a setting in the project configuration for turning it on or off. I also searched the vcproj file for a hidden setting.

            J 1 Reply Last reply
            0
            • R RoyceF

              How do I do that? My test app project has a manifest file, but my real project does not. With both projects exhibiting the same behavior, one has a manifest and the other does not, I can't believe that is the problem. Anyway, I can't find a setting in the project configuration for turning it on or off. I also searched the vcproj file for a hidden setting.

              J Offline
              J Offline
              Joel Lucsy
              wrote on last edited by
              #24

              Ah, sorry, too many different compilers/languages on my system. It'll be in the resources of the project, you'd have to delete it from there.

              R 1 Reply Last reply
              0
              • J Joel Lucsy

                Ah, sorry, too many different compilers/languages on my system. It'll be in the resources of the project, you'd have to delete it from there.

                R Offline
                R Offline
                RoyceF
                wrote on last edited by
                #25

                I deleted the manifest file and rebuilt my project. No change in behavior.

                J 1 Reply Last reply
                0
                • R RoyceF

                  I deleted the manifest file and rebuilt my project. No change in behavior.

                  J Offline
                  J Offline
                  Joel Lucsy
                  wrote on last edited by
                  #26

                  Bummer. I'm fresh out of ideas. I'm sorry I couldn't figure it out for you. Hope something clicks and it works out.

                  R 1 Reply Last reply
                  0
                  • J Joel Lucsy

                    Bummer. I'm fresh out of ideas. I'm sorry I couldn't figure it out for you. Hope something clicks and it works out.

                    R Offline
                    R Offline
                    RoyceF
                    wrote on last edited by
                    #27

                    Thanks, I appreciate your efforts on my behalf. When I get a fix, I will post it here. I have asked Microsoft for help on this one. Royce

                    R 1 Reply Last reply
                    0
                    • R RoyceF

                      Thanks, I appreciate your efforts on my behalf. When I get a fix, I will post it here. I have asked Microsoft for help on this one. Royce

                      R Offline
                      R Offline
                      RoyceF
                      wrote on last edited by
                      #28

                      I have found a fix for this problem, but I can't as yet explain why it works the way that it does. I am now creating my ListCtrl like so: DWORD dwStyle = WS_CHILD | WS_TABSTOP; dwStyle |= LVS_ALIGNTOP | LVS_AUTOARRANGE | LVS_ICON | LVS_SHOWSELALWAYS | LVS_SINGLESEL; if ( bVisible ) dwStyle |= WS_VISIBLE; HWND hWnd = ::CreateWindow( "SysListView32", NULL, dwStyle, rcTree.left, rcTree.top, rcTree.Width(), rcTree.Height(), m_hWnd, NULL, AfxGetInstanceHandle(), NULL ); m_ctlComponents.Attach( hWnd ); Problem is fixed.

                      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