Difference between revisions of "TECTabCtrl"

From Lazarus wiki
Jump to navigationJump to search
Line 33: Line 33:
 
Left-click on a tab activates it.
 
Left-click on a tab activates it.
  
Left-click on arrow or right-click on a tab opens drop-down menu.
+
Left-click on arrow area or right-click anywhere on the tab opens drop-down menu.
  
 
==== Dragging ====
 
==== Dragging ====
Line 43: Line 43:
 
Dragging + CTRL key folds a tab.
 
Dragging + CTRL key folds a tab.
  
Setting etcoFoldingPriority causes opposote behaviour.
+
Setting etcoFoldingPriority causes opposite behaviour.
  
 
Notes:
 
Notes:
Line 61: Line 61:
  
 
  procedure ActivateTab(AIndex: Integer);
 
  procedure ActivateTab(AIndex: Integer);
 +
Activates tab AIndex. If tab is folded, folder and tab AIndex are switched.
 
  function AddTab(APosition: TECTabAdding; AActivate: Boolean): TECTab;
 
  function AddTab(APosition: TECTabAdding; AActivate: Boolean): TECTab;
procedure BeginUpdate;
 
 
  procedure CloseAllFoldedTabs(AFolder: Integer);
 
  procedure CloseAllFoldedTabs(AFolder: Integer);
 
  procedure DeleteTab(AIndex: Integer);
 
  procedure DeleteTab(AIndex: Integer);
 
  procedure DragDrop(Source: TObject; X, Y: Integer); override;
 
  procedure DragDrop(Source: TObject; X, Y: Integer); override;
procedure EndUpdate;
 
 
  function FindFolderOfTab(AIndex: Integer): Integer;
 
  function FindFolderOfTab(AIndex: Integer): Integer;
 
  procedure FoldTab(AIndex, AFolder: Integer);
 
  procedure FoldTab(AIndex, AFolder: Integer);
Line 73: Line 72:
 
  procedure MakeTabAvailable(AIndex: Integer; AActivate: Boolean);
 
  procedure MakeTabAvailable(AIndex: Integer; AActivate: Boolean);
 
  procedure MoveTab(AFrom, ATo: Integer);
 
  procedure MoveTab(AFrom, ATo: Integer);
procedure SelectNext;
 
procedure SelectPrevious;
 
procedure SelectRowDown;
 
procedure SelectRowUp;
 
 
  procedure UnfoldTab(AID: Integer; AFolder: Integer=-1);             
 
  procedure UnfoldTab(AID: Integer; AFolder: Integer=-1);             
  

Revision as of 23:45, 26 February 2016

Overview

About

TECTabCtrl is part of Eye Candy Controls (shortly ECControls or EC-Controls), see http://wiki.freepascal.org/Eye-Candy_Controls, set of visual controls written for Lazarus. Its design is based on Themes, therefore its look is very native everywhere, no matter what widgetset you use.

Each release is announced on Lazarus Forum in section Third Party Announcements.

There are always attached files README.txt (list of all known issues) and CHANGELOG.txt (list of all changes from previous release).

License

GNU Lesser General Public License 2.0 with linking exception (a.k.a. Modified LGPL). File ectabctrl.pas contains license header. Also, files COPYING.modifiedLGPL.txt and COPYING.LGPL.txt are bundled to each archive.

Author

This component is written by Blaazen. Copyright notice and real name is mentioned in the header of the unit. You can contact author on Lazarus Forum (nickname: Blaazen) in any thread about EC-Controls. If you are logged in to forum, you can get author's e-mail or send him private message.

Download and Install

See http://wiki.freepascal.org/Eye-Candy_Controls#Install

Component

TECTabCtrl is installed to the tab EC-C on the Lazarus component palette.

tectabctrl.png

This component is advanced alternative TTabControl. It allows tab stacking, tabs in multiple rows, top/bottom/left/right orientation, reversed and right-to-left bi-directional mode, dragging tabs to move or fold them and many others.

Mouse

Left-click on a tab activates it.

Left-click on arrow area or right-click anywhere on the tab opens drop-down menu.

Dragging

When etcoFoldingPriority is NOT set:

Dragging moves a tab.

Dragging + CTRL key folds a tab.

Setting etcoFoldingPriority causes opposite behaviour.

Notes:

  • etcoFixedPosition: tabs cannot be moved
  • etoCanBeFolded: tab can be folded into another tab
  • etoCanFold: tab can fold another tabs

Keyboard

Arrow keys change tab (only when focused).

Enter or Space opens drop-down menu of selected tab (only when focused).

Acceleration keys (Alt + Key) change tab (doesn't need to be focused).

Code

procedure ActivateTab(AIndex: Integer);

Activates tab AIndex. If tab is folded, folder and tab AIndex are switched.

function AddTab(APosition: TECTabAdding; AActivate: Boolean): TECTab;
procedure CloseAllFoldedTabs(AFolder: Integer);
procedure DeleteTab(AIndex: Integer);
procedure DragDrop(Source: TObject; X, Y: Integer); override;
function FindFolderOfTab(AIndex: Integer): Integer;
procedure FoldTab(AIndex, AFolder: Integer);
function IndexOfTabAt(X, Y: Integer): Integer;
function IsTabVisible(AIndex: Integer): Boolean;
procedure MakeTabAvailable(AIndex: Integer; AActivate: Boolean);
procedure MoveTab(AFrom, ATo: Integer);
procedure UnfoldTab(AID: Integer; AFolder: Integer=-1);             

Examples

Example 1

Basic layout.

top 1row.png

Example 2

Tabs are in one row, their size exceeds width of component. Left-right buttons and optional Add button appear.

top 1row btns.png

Example 3

Tabs are in two rows, their size exceeds width of component. Left-right buttons and optional Add button appear.

top 2row btns.png

Example 4

Component is in reversed mode. Tabs are in three rows, their size exceeds width of component. Left-right buttons and optional Add button appear. Note that buttons are aligned differently when component has one/two/three or more rows.

top 3row btns rev.png

Example 5

Tab position is tpLeft. Tabs are in two rows. Close button on each tab is displayed.

left 2row close.png

Example 6

Tab position is tpBottom. Tabs are in two rows. Close button on each tab is displayed. Drop-down menu is opened (Tab5, Tab12 and Tab13 are folded to Tab1).

bttm 2row close fold.png

Example 7

Tab position is tpRight. Tabs are in two rows. Close button on each tab is displayed. Drop-down menu is opened (Tab5 is folded to Tab1).

right 2row close fold.png

Example 8

Tabs are in two rows. Close button tab is displayed on the active tab only. Tabs are enlarges so they fulfil the width of component. Desktop theme is Breeze.

top 2row r2l breeze enlarge.png