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. List control view and button MFC vc++

List control view and button MFC vc++

Scheduled Pinned Locked Moved C / C++ / MFC
c++
5 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.
  • M Offline
    M Offline
    Member_14575556
    wrote on last edited by
    #1

    Initially I put my button as GetDlgItem(IDC_MYBUTTON)->ShowWindow(FALSE). What I wanted to do is when I select one of the rows in the list view control, I wanted to make my button display on the dialog or visible. What will be the best way to achieve this. I would like to receive some guidance. Thank you.

    V 1 Reply Last reply
    0
    • M Member_14575556

      Initially I put my button as GetDlgItem(IDC_MYBUTTON)->ShowWindow(FALSE). What I wanted to do is when I select one of the rows in the list view control, I wanted to make my button display on the dialog or visible. What will be the best way to achieve this. I would like to receive some guidance. Thank you.

      V Offline
      V Offline
      Victor Nijegorodov
      wrote on last edited by
      #2

      You could handle TVN_SELCHANGED message from your list control, check whether some item in list control is selected and if it is then show your button, otherwise hide it

      M 1 Reply Last reply
      0
      • V Victor Nijegorodov

        You could handle TVN_SELCHANGED message from your list control, check whether some item in list control is selected and if it is then show your button, otherwise hide it

        M Offline
        M Offline
        Member_14575556
        wrote on last edited by
        #3

        Could you give one example as an explanation. Thanks.

        V 1 Reply Last reply
        0
        • M Member_14575556

          Could you give one example as an explanation. Thanks.

          V Offline
          V Offline
          Victor Nijegorodov
          wrote on last edited by
          #4

          I am awfully sorry! it is [LVN_ITEMCHANGED notification code - Windows applications | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/controls/lvn-itemchanged) you should handle! (f..g autocomplete!) Just use MFC class wizard to implement this notification. Then it its message handler write something like:

          GetDlgItem(IDC_MYBUTTON)->ShowWindow(GetDlgItem()->GetSelectedCount() > 0);

          M 1 Reply Last reply
          0
          • V Victor Nijegorodov

            I am awfully sorry! it is [LVN_ITEMCHANGED notification code - Windows applications | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/controls/lvn-itemchanged) you should handle! (f..g autocomplete!) Just use MFC class wizard to implement this notification. Then it its message handler write something like:

            GetDlgItem(IDC_MYBUTTON)->ShowWindow(GetDlgItem()->GetSelectedCount() > 0);

            M Offline
            M Offline
            Member_14575556
            wrote on last edited by
            #5

            Thank you so much for the example :)

            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