← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2708: handle text-box ctrl+A with an accelerator

 

------------------------------------------------------------
revno: 2708
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2011-12-08 19:33:21 +0100
message:
  handle text-box ctrl+A with an accelerator
modified:
  changelog.txt
  dwt/include/dwt/widgets/TextBox.h
  dwt/src/widgets/TextBox.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 'changelog.txt'
--- changelog.txt	2011-12-03 21:53:57 +0000
+++ changelog.txt	2011-12-08 18:33:21 +0000
@@ -52,6 +52,7 @@
 * [L#729684] Fix the /userlist chat command (poy)
 * Revamp style settings (poy)
 * Add user matching settings (poy)
+* [L#887021] No beep on ctrl+A in some text-boxes (poy)
 
 -- 0.782 2011-03-05 --
 * Prevent a remote crash triggered via malformed user commands (poy)

=== modified file 'dwt/include/dwt/widgets/TextBox.h'
--- dwt/include/dwt/widgets/TextBox.h	2011-11-20 18:04:00 +0000
+++ dwt/include/dwt/widgets/TextBox.h	2011-12-08 18:33:21 +0000
@@ -303,8 +303,6 @@
 	friend class ChainingDispatcher;
 	static const TCHAR windowClass[];
 
-	bool handleKeyDown(int c);
-
 	// aspects::Scrollable
 	int scrollOffsetImpl() const {
 		return 1;

=== modified file 'dwt/src/widgets/TextBox.cpp'
--- dwt/src/widgets/TextBox.cpp	2011-11-20 18:04:00 +0000
+++ dwt/src/widgets/TextBox.cpp	2011-12-08 18:33:21 +0000
@@ -72,12 +72,11 @@
 }
 
 void TextBox::create(const Seed& cs) {
+	// some text-boxes don't handle ctrl + A so we have do it ourselves...
+	addAccel(FCONTROL, 'A', [this] { setSelection(); });
+
 	BaseType::create(cs);
 	setFont(cs.font);
-
-	// multiline text-boxes don't handle ctrl + A so we have do it ourselves...
-	if((cs.style & ES_MULTILINE) == ES_MULTILINE)
-		onKeyDown([this](int c) { return handleKeyDown(c); });
 }
 
 void TextBox::setText(const tstring& txt) {
@@ -266,12 +265,4 @@
 	return false;
 }
 
-bool TextBox::handleKeyDown(int c) {
-	if(c == 'A' && isControlPressed() && !isAltPressed()) {
-		setSelection();
-		return true;
-	}
-	return false;
-}
-
 }