Author Topic: questions about tabs  (Read 5558 times)

nuser

  • Community Member
  • Posts: 9
  • Hero Points: 0
questions about tabs
« on: September 09, 2006, 10:32:49 am »
Hi, all, I have 2 question about tabs.
1, Is it possible to rearrange the order of tabs?
2, can I assign a shortcut (Ctrl+W) or mouse double-clicking to 'close tab', which are general operations of some Tab-based browsers (firefox, etc.).

Ding Zhaojie

  • Senior Community Member
  • Posts: 193
  • Hero Points: 37
Re: questions about tabs
« Reply #1 on: September 09, 2006, 03:08:01 pm »
2: Just bind "close-buffer" to Ctrl+W;

Try this to get your dblclick to close tab function:

open bufftabs.e;
find the "static int mou_tabid()" function;
add these codes after the "location = _xyHitTest( new_x, new_y );" line:
Code: [Select]
   // Ding Zhaojie Start:
   if (location == SSTAB_LSCROLLBUTTON_CLICKED || location == SSTAB_RSCROLLBUTTON_CLICKED) {
      return(-2); // click @ scroll button
   }
   // Ding Zhaojie End.
add these function to the end of file:
Code: [Select]
/**
 * Handles the left mouse button dbl_click & mbutton up event.
 * Dbl/MBTN Click @ file tabs: Close clicked file buffer.
 * Dbl/MBTN Click @ the blank space of the File Tabs toolbar: Create a new empty buffer.
 * Dbl/MBTN Click @ tabs scroll button: Do nothing.
 *
 * By Ding Zhaojie
 */
void ctlsstab1.lbutton_double_click, mbutton_up()
{
   // get the current tab id
   int tabi = mou_tabid();
   if (tabi < 0) {
      clicked_tabid = -1;
      if (tabi != -2) {
         // Click @ blank space, create a new file.
         new_file();
      }
      return;
   }
   // Close clicked buffer.
   clicked_tabid = tabi;
   buff_menu_close("");
}
reload bufftabs.e
« Last Edit: September 09, 2006, 03:12:34 pm by Ding Zhaojie »

nuser

  • Community Member
  • Posts: 9
  • Hero Points: 0
Re: questions about tabs
« Reply #2 on: September 10, 2006, 03:50:47 am »
thanks a lot. Ding.
Seems a little complicated. I will try.

drisner

  • Community Member
  • Posts: 15
  • Hero Points: 2
Re: questions about tabs
« Reply #3 on: September 14, 2006, 07:58:59 pm »
Sweet!

Works beautifully.  Thank you for this little hack.

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: questions about tabs
« Reply #4 on: September 14, 2006, 08:08:39 pm »
It's a really nice solution Ding [thumb-up] !
HS2

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: questions about tabs
« Reply #5 on: September 14, 2006, 10:17:28 pm »
Remember to back up your changes to SlickEdit-provided files.  When you patch or upgrade, you'll need to re-apply your changes.
That's what makes the event handlers so powerful (but there probably isn't a hook for clicking on file tabs).