Move Up and Move Down functionality to CListCtrl
-
HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.
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] -
HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.
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!
-
HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.
-
HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.
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...
-
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] -
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!
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.
-
HI Experts, How to Add Move Up and Move Down functionality to My CListCtrl. Thanks, Krishna.
To move an item up: Call
GetNextItem(-1, LVNI_SELECTED)
to get the item's index. CallGetItemText()
to get the item's text. CallInsertItem(nIndex - 1, text)
to insert the item in the previous position. CallDeleteItem(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 item0
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