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. need help in CListCtrl

need help in CListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
8 Posts 3 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.
  • F Offline
    F Offline
    firebolt77
    wrote on last edited by
    #1

    hi all..I'm making a program using CListCtrl that has a find feature(so if I enter a string in edit box and click the find button, it search the CListCtrl attributes with the same string, and then set the selection mark into the attributes). What function that I should use?(I already try SetSelectionMark,but it doesn't work) pls help... thx

    C 1 Reply Last reply
    0
    • F firebolt77

      hi all..I'm making a program using CListCtrl that has a find feature(so if I enter a string in edit box and click the find button, it search the CListCtrl attributes with the same string, and then set the selection mark into the attributes). What function that I should use?(I already try SetSelectionMark,but it doesn't work) pls help... thx

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      According to MSDN[^], I think SetItem is what you want. Christian Graus - Microsoft MVP - C++

      F 1 Reply Last reply
      0
      • C Christian Graus

        According to MSDN[^], I think SetItem is what you want. Christian Graus - Microsoft MVP - C++

        F Offline
        F Offline
        firebolt77
        wrote on last edited by
        #3

        thx..but how to make the previous item is not selected(because when I try to use the find function twice or more, the previous selected item is still highlighted/selected) thx...

        C 1 Reply Last reply
        0
        • F firebolt77

          thx..but how to make the previous item is not selected(because when I try to use the find function twice or more, the previous selected item is still highlighted/selected) thx...

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          You need to call the same method to clear the selected state, just the flag you pass in changes. I don't see any other way of doing it on MSDN. Christian Graus - Microsoft MVP - C++

          F 1 Reply Last reply
          0
          • C Christian Graus

            You need to call the same method to clear the selected state, just the flag you pass in changes. I don't see any other way of doing it on MSDN. Christian Graus - Microsoft MVP - C++

            F Offline
            F Offline
            firebolt77
            wrote on last edited by
            #5

            what flag that I should use, because I didn't find any suitable flag? Pls help thx..

            T 1 Reply Last reply
            0
            • F firebolt77

              what flag that I should use, because I didn't find any suitable flag? Pls help thx..

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              firebolt77 wrote: what flag that I should use, because I didn't find any suitable flag? Pls help Here is What MSDN State for your problem :- stateMask Value specifying which bits of the state member will be retrieved or modified. For example, setting this member to LVIS_SELECTED will cause only the item's selection state to be retrieved. This member allows you to modify one or more item states without having to retrieve all of the item states first. For example, setting this member to LVIS_SELECTED and state to zero will cause the item's selection state to be cleared, but none of the other states will be affected. To retrieve or modify all of the states, set this member to (UINT)-1. You can use the macro ListView_SetItemState both to set and to clear bits. -----------End MSDN Specific data----------------------------- I have marked statement your required with BOLD

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV

              F 1 Reply Last reply
              0
              • T ThatsAlok

                firebolt77 wrote: what flag that I should use, because I didn't find any suitable flag? Pls help Here is What MSDN State for your problem :- stateMask Value specifying which bits of the state member will be retrieved or modified. For example, setting this member to LVIS_SELECTED will cause only the item's selection state to be retrieved. This member allows you to modify one or more item states without having to retrieve all of the item states first. For example, setting this member to LVIS_SELECTED and state to zero will cause the item's selection state to be cleared, but none of the other states will be affected. To retrieve or modify all of the states, set this member to (UINT)-1. You can use the macro ListView_SetItemState both to set and to clear bits. -----------End MSDN Specific data----------------------------- I have marked statement your required with BOLD

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta VC Forum Q&A :- I/ IV

                F Offline
                F Offline
                firebolt77
                wrote on last edited by
                #7

                thx...it's work now...but why the view of ClistCtrl didn't scroll automatically to the attributes(for example the ClistCtrl only preview 10 attributes,but the attributes that I want is in index 20. When I try to run the find function, although the selection mark is in index 20,but the view still previewing 1-10). How to handle this problem? thx...

                T 1 Reply Last reply
                0
                • F firebolt77

                  thx...it's work now...but why the view of ClistCtrl didn't scroll automatically to the attributes(for example the ClistCtrl only preview 10 attributes,but the attributes that I want is in index 20. When I try to run the find function, although the selection mark is in index 20,but the view still previewing 1-10). How to handle this problem? thx...

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #8

                  firebolt77 wrote: although the selection mark is in index 20,but the view still previewing 1-10). How to handle this problem? use CListCtrl::Scroll(...) or CListCtrl::SetSelectionMark(...) Function

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  cheers, Alok Gupta VC Forum Q&A :- I/ IV

                  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