bartabs, bar of tabs

It's all about a bar of tabs. Or a tab bar if you like it more.

The tab bars are widely used in various editors, e.g. in TKE , Geany , Kate , Pluma , all very good for Tcl/Tk programming, btw.

If you need a Tcl/Tk widget similar to the tab bars of those editors, you might try bartabs .

The bartabs is a tab bar widget with a lot of options. It can be used as an independent widget or along with apave package as bts widget.

The latter use case is presented by its demo (5 min., 21 Mb) , while its code (test2_pave.tcl) presents a good example of bartabs usage.

The bartabs package provides Tcl/Tk widget containing tabs that are

  • scrollable
  • markable
  • moveable
  • closeable
  • disabled and enabled
  • static and changeable
  • selectable and multi-selectable
  • configureable
  • enhanceable with popup menu

A common appearance of bartabs is below:

bartabs-1

Here the details are:

  • the current file is test2_pave.tcl
    • its full name is displayed by a caller of bartabs
  • currently hovered file is test_pavedialog.tcl
    • its name is displayed short, due to the -lablen 16 option
  • so, its real name is displayed by bartabs in the tooltip
  • its tab has Close button at the right
  • Scroll left and Scroll right buttons are at both edges of bartabs
  • Scroll right button is disabled, as there are no tabs beyond the right edge

A bit customized versions of bartabs may look like the following.

bartabs-2

Here the details are:

  • a color scheme is changed
  • the hovered tab has no tooltip, as its label isn't shortened
  • Scroll right button is enabled, as two tabs were scrolled to the right

bartabs-3

Here the details are:

  • tabs have no border due to -bd 0 option
  • bartabs got -static yes option, so the hovered tab has not Close button

bartabs-4

Here the details are:

  • bartabs is made -static no -bd 1 again
  • currently edited file is underlined instead of blue background, due to -fgsel {} option
  • some tabs are marked with magenta foreground, meaning "modified" or similar

bartabs-5

Here the details are:

  • bartabs got -imagemark option, so the tabs are marked with an image
  • if not marked or hovered, the tabs can show its own images

bartabs-6

Here the details are:

  • tabs can be multi-selected with Ctrl+Click
  • thus, the caller of bartabs can handle the batch of tabs

bartabs-7

Here the details are:

  • handlers can be called using hot keys or a popup menu bound to bartabs
  • by default, the menu actions include: 1) choosing a tab 2) moving a tab 3) closing tab(s)
  • the list of tabs contains three separated tab lists: the invisible at left, the visible, the invisible at right
  • a tab can be moved with drag-and-drop or with "... behind" menu action
  • static (-static yes) bartabs has no actions except for choosing a tab
  • even for static bartabs, its caller can provide additional menu actions and submenus

Further details:

Download link:

Demo video link: