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?

CListCtrl?

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 4 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    How can I get a CListCrtl Item into, say, a CString when it is clicked? Thanks. Richard

    R B 2 Replies Last reply
    0
    • L Lost User

      How can I get a CListCrtl Item into, say, a CString when it is clicked? Thanks. Richard

      R Offline
      R Offline
      Reid
      wrote on last edited by
      #2

      When you assign the CListCtrl a variable in the Class Wizard, make sure you assign a variable to the control, and the value...Cumon, you know what im talking about... when you assign the CListCtrl's control ID a variable, it asks for a name: m_????? then a catagory (in a combo box): Control <----select VALUE here then for a type (in a combo box): CListCtrl (or whatever)<---select CString here :eek: ;P -Reid the C++/C# programmer (Caution: I am a teenager, and that means that I think I know everything...but probably don't...) Maybe this will help you understand: CPerson Reid = "Teenager"; CPerson All_C_Programmers[9999999999]; int i; int num_Programmers_That_Are_Teenagers = 0; for (i=0;i<9999999999;i++) { if (All_C_Programmers[i]=="Teenager") { num_Programmers_That_Are_Teenagers++; } } cout << num_Programmers_That_Are_Teenagers; ------------- 1 <------

      M L 2 Replies Last reply
      0
      • L Lost User

        How can I get a CListCrtl Item into, say, a CString when it is clicked? Thanks. Richard

        B Offline
        B Offline
        Ben Burnett
        wrote on last edited by
        #3

        You can either handle the WM_LBUTTONDOWN message in the List-View and use the folowing to get the item's text; int nItem = GetNextItem ( -1, LVNI_SELECTED | LVNI_FOCUSED ); CString sItemText = GetItemText ( nItem, 0 ); // or use GetItem to get more info Or you can handle the List-View's NM_CLICK notification and grab the text as above, using the index given in the NMITEMACTIVATE structure. -Ben --------- On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ;)

        1 Reply Last reply
        0
        • R Reid

          When you assign the CListCtrl a variable in the Class Wizard, make sure you assign a variable to the control, and the value...Cumon, you know what im talking about... when you assign the CListCtrl's control ID a variable, it asks for a name: m_????? then a catagory (in a combo box): Control <----select VALUE here then for a type (in a combo box): CListCtrl (or whatever)<---select CString here :eek: ;P -Reid the C++/C# programmer (Caution: I am a teenager, and that means that I think I know everything...but probably don't...) Maybe this will help you understand: CPerson Reid = "Teenager"; CPerson All_C_Programmers[9999999999]; int i; int num_Programmers_That_Are_Teenagers = 0; for (i=0;i<9999999999;i++) { if (All_C_Programmers[i]=="Teenager") { num_Programmers_That_Are_Teenagers++; } } cout << num_Programmers_That_Are_Teenagers; ------------- 1 <------

          M Offline
          M Offline
          Matt Newman
          wrote on last edited by
          #4

          Not true. I am a teenager too. -Matt Newman :suss:

          1 Reply Last reply
          0
          • R Reid

            When you assign the CListCtrl a variable in the Class Wizard, make sure you assign a variable to the control, and the value...Cumon, you know what im talking about... when you assign the CListCtrl's control ID a variable, it asks for a name: m_????? then a catagory (in a combo box): Control <----select VALUE here then for a type (in a combo box): CListCtrl (or whatever)<---select CString here :eek: ;P -Reid the C++/C# programmer (Caution: I am a teenager, and that means that I think I know everything...but probably don't...) Maybe this will help you understand: CPerson Reid = "Teenager"; CPerson All_C_Programmers[9999999999]; int i; int num_Programmers_That_Are_Teenagers = 0; for (i=0;i<9999999999;i++) { if (All_C_Programmers[i]=="Teenager") { num_Programmers_That_Are_Teenagers++; } } cout << num_Programmers_That_Are_Teenagers; ------------- 1 <------

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

            The fool who considers himself wise is a fool indeed.

            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