← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3320: the Del key removes items from the test tabletree

 

------------------------------------------------------------
revno: 3320
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2013-07-05 22:32:46 +0200
message:
  the Del key removes items from the test tabletree
modified:
  dwt/test/TableTreeTest.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/test/TableTreeTest.cpp'
--- dwt/test/TableTreeTest.cpp	2013-06-16 15:23:16 +0000
+++ dwt/test/TableTreeTest.cpp	2013-07-05 20:32:46 +0000
@@ -58,6 +58,17 @@
 	});
 	table->setSort(0, dwt::Table::SORT_CALLBACK);
 
+	table->onKeyDown([table](int c) -> bool {
+		if(c == VK_DELETE) {
+			int i = -1;
+			while((i = table->getNext(-1, LVNI_SELECTED)) != -1) {
+				table->erase(i);
+			}
+			return true;
+		}
+		return false;
+	});
+
 	dwt::ImageListPtr images(new dwt::ImageList(dwt::Point(IMAGE_SIZE, IMAGE_SIZE)));
 	images->add(dwt::Icon(::LoadIcon(nullptr, IDI_INFORMATION), false));
 	table->setSmallImageList(images);