Sign in Join
Wiki copytemporary

TECTabCtrl: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11**TECTabCtrl** ![](/wiki-images/b/b4/Tectabctrl.png) 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.
22
33TECTabCtrl is installed to the (non-default) [[Eye-Candy Controls|EC tab]] on the Lazarus [[Component Palette]].
44
55Image shows tab with close button and arrow-down area.
66
77![](/wiki-images/4/43/Tab_close_dd.png)
88
99TECTabCtrl is part of [[Eye-Candy Controls]] (shortly ECControls or EC-Controls), see [[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.
1010
1111Each release is announced on Lazarus Forum in section Third Party Announcements.
1212
1313There are always attached files `README.txt` (list of all known issues) and `CHANGELOG.txt` (list of all changes from previous release).
1414
1515License
1616
1717GNU 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.
1818
1919Author
2020
2121This 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.
2222
2323Download and Install
2424
2525See [[Eye-Candy Controls|Eye-Candy Controls#Install]]
2626
2727## Options
2828
2929Options (TECTabOption and TECTabCtrlOption) are shortly described (commented) in interface section of the unit `ectabctrl.pas`.
3030
3131## Using the component
3232
3333Mouse
3434
3535- Left-click on a tab activates it.
3636- Left-click on close-icon area closes tab.
3737- Left-click on arrow-down area or right-click anywhere on the tab opens drop-down menu.
3838- Middle-click closes tab (if option etcoMiddleBtnClose is set and tab is closeable).
3939
4040Dragging
4141
4242Dragging is realized by left mouse button or middle mouse button (if option etcoMiddleBtnClose is NOT set).
4343
4444When etcoFoldingPriority is NOT set:
4545
4646- Dragging moves a tab.
4747- Dragging + CTRL key (exactly ssModifier) folds a tab.
4848
4949Setting etcoFoldingPriority causes opposite behaviour.
5050
5151Notes:
5252
5353- etcoFixedPosition: tabs cannot be moved
5454- etoCanBeFolded: tab can be folded into another tab
5555- etoCanFold: tab can fold another tabs
5656
5757Drop down menu
5858
5959Allows:
6060
6161- switching folded tabs
6262- unfolding any or all folded tabs
6363- closing any or all folded tabs
6464- fold tab to any folder tab (includig its own folded tabs)
6565- moving tab
6666- closing respective tab
6767
6868Keyboard
6969
7070- Arrow keys change tab (only when focused).
7171- Arrow keys + CTRL key (exactly ssModifier) move tab (only when focused).
7272- Enter or Space opens drop-down menu of selected tab (only when focused).
7373- Acceleration keys (Alt + Key) change tab (doesn't need to be focused).
7474
7575Note to multi-row tabs: the row with active tab is always placed on the baseline. Therefore, arrow keys Up and Down may sometime look like they work oppositely (assume horizontal position and active tab is NOT at the first row). It is by design.
7676
7777## Code
7878
7979Each tab has two identificators: Index and ID.
8080
8181- ID is unique and never changes during the life of tab
8282- Index is unique but it changes as tabs are moved, folded, unfolded, added or deleted.
8383
84-`function IDToIndex(AID: Integer): Integer;`
84+``` pascal
85+function IDToIndex(AID: Integer): Integer;
86+```
8587
8688Returns index of tab AID.
8789
88-`procedure ActivateTab(AIndex: Integer);`
90+``` pascal
91+procedure ActivateTab(AIndex: Integer);
92+```
8993
9094Activates tab AIndex. If tab is folded, folder and folded tab are switched.
9195
92-`function AddTab(APosition: TECTabAdding; AActivate: Boolean): TECTab;`
96+``` pascal
97+function AddTab(APosition: TECTabAdding; AActivate: Boolean): TECTab;
98+```
9399
94100Adds a new tab. Must be specified where the tab will be positioned and whether it will be activated.
95101
96-`procedure CloseAllFoldedTabs(AFolder: Integer);`
102+``` pascal
103+procedure CloseAllFoldedTabs(AFolder: Integer);
104+```
97105
98106Closes all tabs folded to AFolder.
99107
100-`procedure DeleteTab(AIndex: Integer);`
108+``` pascal
109+procedure DeleteTab(AIndex: Integer);
110+```
101111
102112Deletes tab AIndex.
103113
104-`function FindFolderOfTab(AIndex: Integer): Integer;`
114+``` pascal
115+function FindFolderOfTab(AIndex: Integer): Integer;
116+```
105117
106118Returns index of folder which contains tab AIndex. Result is -1 when tab is not folded anywhere.
107119
108-`procedure FoldTab(AIndex, AFolder: Integer);`
120+``` pascal
121+procedure FoldTab(AIndex, AFolder: Integer);
122+```
109123
110124Folds tab AIndex to folder AFolder.
111125
112-`function IndexOfTabAt(X, Y: Integer): Integer;`
126+``` pascal
127+function IndexOfTabAt(X, Y: Integer): Integer;
128+```
113129
114130Returns index of tab at coordinates X, Y. Result is -1 when there is no tab at X, Y.
115131
116-`function IsTabVisible(AIndex: Integer): Boolean;`
132+``` pascal
133+function IsTabVisible(AIndex: Integer): Boolean;
134+```
117135
118136Returns True when tab AIndex is visible and is in visible area (i.e. is not scrolled out).
119137
120-`procedure MakeTabAvailable(AIndex: Integer; AActivate: Boolean);`
138+``` pascal
139+procedure MakeTabAvailable(AIndex: Integer; AActivate: Boolean);
140+```
121141
122142Makes tab AIndex available, i.e. moves tab to visible area (if necessary), switches it with its folder (if necessary) and activates it if AActivate is True.
123143
124-`procedure MoveTab(AFrom, ATo: Integer);`
144+``` pascal
145+procedure MoveTab(AFrom, ATo: Integer);
146+```
125147
126148Moves tab to a new position.
127149
128-`procedure UnfoldTab(AID: Integer; AFolder: Integer=-1);`
150+``` pascal
151+procedure UnfoldTab(AID: Integer; AFolder: Integer=-1);
152+```
129153
130154Unfolds tab AID. If its folder is known, caller can specify it. Otherwise, method attempts to find folder itself.
131155
132156## Examples
133157
134158Screenshots are taken from Plasma5. Desktop theme for Examples 1-7 is Plastique, Example 8 is Breeze.
135159
136160Example 1
137161
138162Basic layout.
139163
140164![](/wiki-images/4/4d/Top_1row.png)
141165
142166Example 2
143167
144168Tabs are in one row, their size exceeds width of component. Left-right buttons and optional Add button appear.
145169
146170![](/wiki-images/4/40/Top_1row_btns.png)
147171
148172Example 3
149173
150174Tabs are in two rows, their size exceeds width of component. Left-right buttons and optional Add button appear.
151175
152176![](/wiki-images/f/f6/Top_2row_btns.png)
153177
154178Example 4
155179
156180Component 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.
157181
158182![](/wiki-images/a/ab/Top_3row_btns_rev.png)
159183
160184Example 5
161185
162186Tab position is tpLeft. Tabs are in two rows. Close button on each tab is displayed.
163187
164188![](/wiki-images/d/d1/Left_2row_close.png)
165189
166190Example 6
167191
168192Tab 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).
169193
170194Close buttons cannot be enabled for the **entire** TECTabCtrl. They can be enabled per each separate tab by adding *etoClosabel* and *etoCloseBtn* to the *Options* property.
171195
172196![](/wiki-images/a/af/Bttm_2row_close_fold.png)
173197
174198Example 7
175199
176200Tab 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).
177201
178202![](/wiki-images/7/7f/Right_2row_close_fold.png)
179203
180204Example 8
181205
182206Tabs 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.
183207
184208![](/wiki-images/1/14/Top_2row_r2l_breeze_enlarge.png)
185209
186210Example 9
187211
188212Tab position is tpLeft but tabs are horizontal and reversed, i.e. from the bottom to the top (options etcoVertTabsHorizontal and etcoReversed). Close button on each tab is displayed.
189213
190214![](/wiki-images/2/2c/Left_verthor_rev_close.png)
191215
192216Example 10
193217
194218Add a new tab and set its caption
195219
196-`   ECTabCtrl1.AddTab(etaLast, True);`\
197-`   ECTabCtrl1.Tabs.Items[ECTabCtrl1.Tabs.Count-1].Text:='TabName';`
220+``` pascal
221+ ECTabCtrl1.AddTab(etaLast, True);
222+ ECTabCtrl1.Tabs.Items[ECTabCtrl1.Tabs.Count-1].Text:='TabName';
223+```
198224
199225## Issues
200226
201227Component can be visually "ugly" or "incorrect" with some desktop themes or some Style setting. (example: GTk2 and Style = eosThemedPanel). That's because unit Themes does not implement images for tabs and images for button are used instead. Some themes (Oxygen, Breeze) draws button smaller than its rectangle and the remaining area around is used for shiny effect. It may cause design issue.
202228
203229---
204230*From the Free Pascal wiki, page "TECTabCtrl", as it stood on 2018-01-21 after a change by Blaazen, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
205231Category: Components

Back to history