Author Topic: Map a key for switching window  (Read 9401 times)

yhlove

  • Community Member
  • Posts: 8
  • Hero Points: 0
Map a key for switching window
« on: November 13, 2007, 09:23:14 AM »
Hi

I would like to know if there's a key shortcut for switching between the internal window\frames in slickedit.
For example: To switch between the source code frame and the and the "search Result" frame or "Projects" frame.
(I'm not sure if "frame" is the exact word but I hope you'll understand me)

Thanks
Yhlove

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Map a key for switching window
« Reply #1 on: November 13, 2007, 10:10:13 AM »
The other 'frames' are implemented as (dockable) toolbars and there is number of 'activate-*' commands which need to be bound to appr. keys.
Note that you can use 'direct' shortcuts as e.g. 'Ctrl-Shift-s' bound to 'activate-search' or 'Alt-Shift-p' bound to 'activate-project-files'. But you can also use a sequence of a common lead-in or prefix shortcut and additional keys. This could save a lot direct shortcuts which are a rare resource ;)
See an example here http://community.slickedit.com/index.php?topic=1284.msg5433#msg5433.
When using the GUI keybindings dialog you need to press and release the lead-in key combination and press the desired (one or more) additional key(s) afterwards. ESCape brings you back to the edit window.

HS2

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Map a key for switching window
« Reply #2 on: November 13, 2007, 10:29:20 AM »
One more maybe useful hint:
You could also use the 'activate-project-toolbar' resp. 'activate-output-toolbar' commands to activate just the corresponding toolbar containers. After that you can use (Shift-)Ctrl-TAB to switch the active tab.
HS2

yhlove

  • Community Member
  • Posts: 8
  • Hero Points: 0
Re: Map a key for switching window
« Reply #3 on: November 13, 2007, 11:23:01 AM »
Hi

I used the 'activate-output-toolbar', 'activate-project-toolbar' and it works fine.

I want to write a small script that will toggle between these toolbars.
1.How can I know which toolbar is currently activated ?
2.Which command is used to activate source code 'frame' ?
3.Is there any example for similar macro ?

Thanks
Yhlove

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Map a key for switching window
« Reply #4 on: November 13, 2007, 11:55:39 AM »
See an example here http://community.slickedit.com/index.php?topic=1284.msg5433#msg5433.
When using the GUI keybindings dialog you need to press and release the lead-in key combination and press the desired (one or more) additional key(s) afterwards. ESCape brings you back to the edit window.
I like this idea -- a couple of problems,however.
-- When I activate the Build window, ESCape does not return me to the editor window.  ESC does not return to the editor window after activating Search Results, either.  Is there another 'activate-' command to get back to the most recent editor window?
-- I have 'Alt-ty' bound to 'activate-symbol', but when I press 'Alt-ty', the Preview window is activated.  Even after hiding the Preview window, Alt-ty restores it.  (Seems like a bug.)  Fortunately, 'Alt-S' (Search menu) 'y' (Find Symbol) works.
CB
« Last Edit: November 13, 2007, 12:01:06 PM by Wanderer »

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Map a key for switching window
« Reply #5 on: November 13, 2007, 12:36:34 PM »
@yhlove:
As usual this is not as easy as it might seem ...
I'm using this scenario:
Quote
2 distinct shortcuts for activation of project and output toolbar
From edit win:
C-S-ENTER -> activate-project-toolbar
A-S-ENTER -> activate-output-toolbar
go back to edit win from any toolbar:
C-S-ENTER or A-S-ENTER -> edit win
To achieve this (everything else is more difficult) you need some macro support.
See attached a macro module I've extracted from my customization stuff.
Detach it -> in SE: Macro>Load Module ... (and restart SE - seems to be required in this case).
Hope it works for you too... (of course you can modify the shortcuts acc. to YOUR needs)
I'd recommend to backup your config folder first (Where is it ? -> Help>About).
HS2

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Map a key for switching window
« Reply #6 on: November 13, 2007, 12:42:35 PM »
@Wanderer:
Due to historical reasons: 'activate-symbol' == 'activate-preview' == 'activate-tagwin'.
You need to use 'activate-find-symbol' for 'Find Symbols TB'.

Quote
ESC does not return to the editor window
That's strange and should work .. where is the focus when ESCaping e.g. the build win ?

Edit: Perhaps the SE cmdline is activated. Try to hit ESCape until the edit win gets the focus.

HS2
« Last Edit: November 13, 2007, 12:45:50 PM by hs2 »

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: Map a key for switching window
« Reply #7 on: November 13, 2007, 01:09:12 PM »
HS2:  Thanks, activate-find-symbol is what I was looking for.

As for ESC, I suspect it has to do with using the VIM emu, and that you can type in the Search Results and Build windows.  When I activate the Search Results (Alt-ts), then press Esc, I get the message 'already in command mode' in the status bar.  That's not true, though -- typing any key enters it into the window, w/o having to do anything to get in to Insert mode.  As for the Build window, Esc does nothing, and any key typed is entered in to the window.

It gets better:  sometimes the Alt-t prefix works (Build, Search Res.), but sometimes it doesn't (Preview, Find Symbol).  Is the difference in behavior due to a difference in 'kind' in the windows -- some take input, while others don't?

CB

 

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Map a key for switching window
« Reply #8 on: November 13, 2007, 01:28:42 PM »
Hmm - works for me (Brief keymap). Dunno if it's related to VI mode in conjunction with the editor controls in Search Results/Build/etc. ... I'm afraid that's a question to the real experts - sorry :(
HS2

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Map a key for switching window
« Reply #9 on: May 01, 2008, 09:33:31 AM »
Hi, I've attached a minor bug fix for 'act_tb_keys.e'.
The toggle back to the main editor window wasn't working for undocked tool windows with an editor control (build,output,search,preview,refs) and if this editor control is focused.
@Ben: I've added 2 example bindings (commented) to activate the build and the editor window directly along with an 'activate-edit' command.

Have fun,
HS2

Edit: Using global defines for keybinding definition so they can be changed easily.
« Last Edit: December 21, 2010, 11:47:21 AM by hs2 »