Page 1 of 1

switch tab with keyboard

Posted: Fri Aug 03, 2018 9:16 pm
by Timo
Hello,

Is there a keyboard shortcut to switch between tabs? Like ctrl + left would move to the next tab on an edit screen and ctrl + right to the previous one.

Re: switch tab with keyboard

Posted: Mon Aug 06, 2018 11:07 am
by toms
Hi,

Ctrl-left-arrow and Ctrl-right-arrow are already used to skip to the next or previous word. Therefore I'd rather use the ctrl+shift+left-arrow and ctrl+shift+right-arrow combinations.

Add this Javascript code in the Header under Home ► Setup

Code: Select all

function initNextTabShortcuts() {

//  Ctrl + Left | Ctrl + Right Keypress -> Move to previous/next tab
document.onkeydown = function(e) {
  e = e || window.event;
  var keyCode = e.keyCode || e.which,
      arrow = {left: 37, right: 39};

  if(nuFormType() == 'edit'){
  if (e.ctrlKey && e.shiftKey) {
    switch (keyCode) {
      case arrow.left:
        selectNextTab(-1);
        break;
      case arrow.right:
        selectNextTab(1);
        break;
    }
  }
  }
}

function selectNextPrevTab(i) {
	var selectedTab = $('.nuTabSelected')[0].id.substring(5);
	var nextTab = parseInt(selectedTab) + i;
	var e = document.getElementById('nuTab' + nextTab);
	if(e != null) {
		nuSelectTab(e);
	}
}

function nuOnLoad() {
	initNextPrevTabShortcuts();
}

Re: switch tab with keyboard

Posted: Thu Aug 09, 2018 3:41 pm
by Timo
Thanks mate!

Re: switch tab with keyboard

Posted: Fri Aug 10, 2018 8:02 pm
by admin
.