Author Topic: Focus and Using Ctrl + Tab in the Tool Bars  (Read 2340 times)

tinker123

  • Community Member
  • Posts: 93
  • Hero Points: 3
Focus and Using Ctrl + Tab in the Tool Bars
« on: October 11, 2011, 03:13:23 pm »
I'm using VSE 16 on Windows XP.

Inside of the Project Tool Bar or the Search/Output tool bar there are multiple tabbed panes.  The VSE user only has to remember one keybinding for navigating those tabbed panes:

Ctrl + Tab

Unfortunately, while you can switch tabs, you don't the focus in those tabs ( if you get there via the keyboard).

Is it possible with VSE scripting to put the focus in a tool bar tab if ctrl + tab is used?

I contacted SE about this issue.  They opened up a ticket in their tracker about it, but they told me I would be on my own as they would be busy for a very long time converting the VSE interface to use the QT GUI library.

Thanks in advance for any tips


chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Focus and Using Ctrl + Tab in the Tool Bars
« Reply #1 on: October 11, 2011, 05:30:41 pm »
Here's a nudge in the right direction, at least:

You can look up the handler for Ctrl+Tab by using the "what-is" command at the SE command line.

Digging through the relevant code, you'll eventually get to whereever it's changing tab activation.  Then you can use the _set_focus() method on whichever control you want to gain focus.  Offhand I'm not sure what's a good way to dynamically figure out which control should receive focus.

tinker123

  • Community Member
  • Posts: 93
  • Hero Points: 3
Re: Focus and Using Ctrl + Tab in the Tool Bars
« Reply #2 on: October 12, 2011, 01:12:53 pm »
Thanks a ton!

Graeme

  • Senior Community Member
  • Posts: 2445
  • Hero Points: 322
Re: Focus and Using Ctrl + Tab in the Tool Bars
« Reply #3 on: October 16, 2011, 11:14:57 am »
Did you get this sorted out?

In case not, here's a couple of more suggestions.
If you search the slick macros folder for activate_editor, you'll find code like this
Code: [Select]
defeventtab _tbproctree_form;

_tbproctree_form.'F12'()
{
   if (isEclipsePlugin()) {
      eclipse_activate_editor();
   } else if (def_keys == 'eclipse-keys') {
      activate_editor();
   }
}

You can define your own handlers for keys for particular forms by placing something like the following in a macro file of your own and load it using the load module command on the macro menu.

Code: [Select]
#include "slick.sh"
defeventtab _tbproctree_form;

_tbproctree_form.'C-F12'()
{
      say("You pressed Ctrl-F12");
}

Make sure that C-F12 doesn't do something useful first though.

If you look up the "activate-whatever" commands you can see which "control" on the form gets the focus when you use that activate command.
e.g. type fp activate-open on the slick command line and you'll see

Code: [Select]
_command activate_open,activate_project_open()  name_info(','VSARG2_EDITORCTL)
{
   //activate_project_tab('Open','_openfile_list');
   return activate_toolbar('_tbopen_form','_file_name_filter');
}

The activate_open command puts the focus on the _file_name_filter control.

By searching slick macro sources for C-TAB I found this in toolbar.e
Code: [Select]
/**
 * Handles moving between tabs in a tabgroup (if we are in a tabgroup).
 */
void _toolbar_etab2.'c-tab','s-c-tab'()
{
   int wid = _tbTabGroupWidFromWid(p_active_form);
   if( wid>0 && wid.p_object==OI_SSTAB ) {
      wid.call_event(defeventtab _tabgroup_etab,last_event(),'e');
   }
   //say("yes");
}

I added the "say" command and found that using C-TAB in the project toolbar does go through this function.  If you don't mind changing slick macro source code, you could modify this code to check which "form" is active and set the focus according to which control you want to have the focus.
 If you do this
Code: [Select]
void _toolbar_etab2.'c-tab','s-c-tab'()
{
   say(p_active_form.p_name);
   int wid = _tbTabGroupWidFromWid(p_active_form);
   if( wid>0 && wid.p_object==OI_SSTAB ) {
      wid.call_event(defeventtab _tabgroup_etab,last_event(),'e');
   }
}
you'll find that the active form is set incorrectly and clicking the mouse in the toolbar after using ctrl-tab changes p_active_form.
It also looks like the following functions are also getting called when you use ctrl-tab
typeless _ainh_dlg_manager."c-tab"()
and
void _tabgroup_etab.'c-tab','s-c-tab'()

and the order they're called in is

void _toolbar_etab2.'c-tab','s-c-tab'()
typeless _ainh_dlg_manager."c-tab"()
void _tabgroup_etab.'c-tab','s-c-tab'()

and that's as much as I've got time for right now...

Graeme

by the way - I recommend backing up slick sources and your own configuration folder before you go changing anything.
« Last Edit: October 16, 2011, 11:18:41 am by Graeme »