Forum Discussion
angela
4 months agoCatalyst II
It´s indeed a good candidate!
This was my very very first test with an "onKeyDown" Form Method. This one is only a simple test. In the end we will need a codetree solution or something similar that loads with overall Innovator (CUI init event on main header?).
const tabsObj = aras.getMainWindow().arasTabs;
const selectedTab = tabsObj.selectedTab;
const currentIndex = tabsObj.tabs.indexOf(selectedTab);
if (currentIndex === -1) return;
let newIndex;
if (event.key === "ArrowRight") {
newIndex = (currentIndex + 1) % tabsObj.tabs.length;
}
else if (event.key === "ArrowLeft") {
newIndex = (currentIndex - 1 + tabsObj.tabs.length) % tabsObj.tabs.length;
}
const newTab = tabsObj.tabs[newIndex];
tabsObj.selectTab(newTab,true);But this sample works well do demonstrate obstacles:
- When mouse focus is away from the tabbar, it will not work anymore. So we need a function to set the focus to the main tabbar again.
- Arrow keys are also used inside regular form text elements to move the cursor. So we definitely need a keyboard combination.
- The shown sample would never support Ctrl keys. Ctrl keys work different that regular letters. They can be "hold" for some time. That´s why they never worked in my first test. They were only triggered once.