← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1232392-tabbing into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1232392-tabbing into lp:widelands.

Commit message:
Brought back keyboard navigation with Tab key in login box and editor map options. Tabbing order in map options is still off.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1232392-tabbing/+merge/302220

The editboxes are the only UI elements so far that allow focussing with the Tab-Key. We should have more of those (e.g. buttons), but that's for Build 20.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1232392-tabbing into lp:widelands.
=== modified file 'src/editor/ui_menus/main_menu_map_options.cc'
--- src/editor/ui_menus/main_menu_map_options.cc	2016-08-04 15:49:05 +0000
+++ src/editor/ui_menus/main_menu_map_options.cc	2016-08-07 10:14:09 +0000
@@ -161,6 +161,7 @@
 	cancel_.sigclicked.connect(boost::bind(&MainMenuMapOptions::clicked_cancel, boost::ref(*this)));
 
 	update();
+	name_.focus();
 	center_to_parent();
 	move_to_top();
 }

=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc	2016-08-04 15:49:05 +0000
+++ src/ui_basic/editbox.cc	2016-08-07 10:14:09 +0000
@@ -199,7 +199,7 @@
 
 		case SDLK_TAB:
 			// Let the panel handle the tab key
-			return false;
+			return get_parent()->handle_key(true, code);
 
 		case SDLK_KP_ENTER:
 		case SDLK_RETURN:

=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc	2016-08-04 15:49:05 +0000
+++ src/ui_basic/multilineeditbox.cc	2016-08-07 10:14:09 +0000
@@ -231,6 +231,9 @@
 bool MultilineEditbox::handle_key(bool const down, SDL_Keysym const code) {
 	if (down) {
 		switch (code.sym) {
+		case SDLK_TAB:
+			// Let the panel handle the tab key
+			return get_parent()->handle_key(true, code);
 		case SDLK_KP_PERIOD:
 			if (code.mod & KMOD_NUM)
 				break;

=== modified file 'src/wui/login_box.cc'
--- src/wui/login_box.cc	2016-08-04 15:49:05 +0000
+++ src/wui/login_box.cc	2016-08-07 10:14:09 +0000
@@ -32,10 +32,9 @@
 	int32_t margin = 10;
 
 	ta_nickname = new UI::Textarea(this, margin, margin, _("Nickname:"));
+	ta_password = new UI::Textarea(this, margin, 40, _("Password:"));
 	eb_nickname = new UI::EditBox(
 	   this, 150, margin, 330, 20, 2, g_gr->images().get("images/ui_basic/but2.png"));
-
-	ta_password = new UI::Textarea(this, margin, 40, _("Password:"));
 	eb_password =
 	   new UI::EditBox(this, 150, 40, 330, 20, 2, g_gr->images().get("images/ui_basic/but2.png"));
 
@@ -45,7 +44,6 @@
 
 	cb_register = new UI::Checkbox(this, Point(margin, 110), _("Log in to a registered account"), "",
 	                               get_inner_w() - 2 * margin);
-
 	cb_auto_log = new UI::Checkbox(this, Point(margin, 135),
 	                               _("Automatically use this login information from now on."), "",
 	                               get_inner_w() - 2 * margin);
@@ -68,6 +66,7 @@
 	eb_nickname->set_text(s.get_string("nickname", _("nobody")));
 	eb_password->set_text(s.get_string("password", ""));
 	cb_register->set_state(s.get_bool("registered", false));
+	eb_nickname->focus();
 }
 
 /// called, if "login" is pressed


Follow ups