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. Move Up and Move Down functionality to CListCtrl

Move Up and Move Down functionality to CListCtrl

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

    HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.

    CPalliniC U K M D 5 Replies Last reply
    0
    • R Royaltvk

      HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      Royaltvk wrote:

      How to Add Move Up and Move Down functionality to My CListCtrl

      What do you mean with that? Do you want to change the order of the items? :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      R 1 Reply Last reply
      0
      • R Royaltvk

        HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.

        U Offline
        U Offline
        Uwe Keim
        wrote on last edited by
        #3

        Implement custom sort.

        • My personal 24/7 webcam • Zeta Test - Intuitive, competitive Test Management environment for Test Plans and Test Cases. Download now! • Zeta Producer Desktop CMS - Intuitive, very easy to use. Download now!

        M 1 Reply Last reply
        0
        • R Royaltvk

          HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.

          K Offline
          K Offline
          KarstenK
          wrote on last edited by
          #4

          You can delete and refill the whole content or the changed items. Or: they should originally be sorted and than change the index. This leads to costum sort

          Press F1 for help or google it. Greetings from Germany

          1 Reply Last reply
          0
          • R Royaltvk

            HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.

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

            Maybe you mean drag and drop? Click an item, drag to a new position, and drop? If that's the case, there are several articles about it on CodeProject, as well as a mountain of examples and tutorials elsewhere on the net.

            There are three kinds of people in the world - those who can count and those who can't...

            1 Reply Last reply
            0
            • CPalliniC CPallini

              Royaltvk wrote:

              How to Add Move Up and Move Down functionality to My CListCtrl

              What do you mean with that? Do you want to change the order of the items? :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              R Offline
              R Offline
              Royaltvk
              wrote on last edited by
              #6

              ya , i want to change the order. Thanks for concern

              1 Reply Last reply
              0
              • U Uwe Keim

                Implement custom sort.

                • My personal 24/7 webcam • Zeta Test - Intuitive, competitive Test Management environment for Test Plans and Test Cases. Download now! • Zeta Producer Desktop CMS - Intuitive, very easy to use. Download now!

                M Offline
                M Offline
                Maximilien
                wrote on last edited by
                #7

                isn't this a bit overkill ? or maybe I'm mis-understand you point, Me think it's easier to just swap items in the "data source" and refresh the list (if in "virtual mode" than it should not be any problem performance wise.

                This signature was proudly tested on animals.

                1 Reply Last reply
                0
                • R Royaltvk

                  HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  To move an item up: Call GetNextItem(-1, LVNI_SELECTED) to get the item's index. Call GetItemText() to get the item's text. Call InsertItem(nIndex - 1, text) to insert the item in the previous position. Call DeleteItem(nIndex + 1) to delete the old item You'll obviously need to massage this a bit to get it to work (e.g., make sure that you don't try and move item 0 up). Moving an item down is almost identical.

                  "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  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