ATTabs is a tab-control component for Delphi and Lazarus. It's not replacement for standard tab control, but is alternative one, it has different API. It paints tabs OS-indenendant, using custom drawing on canvas.
Author: Alexey Torgashin
- Lazarus: 1.8+.
- Tested on: Windows, Linux GTK2/Qt, macOS.
How to use it like TPageControl
Make some new panel, which will be like TPageControl. Place ATTabs on it, make Align=alTop. Now you create several Forms or Frames onto this panel (they have Parent:=Panel1; Align:=alClient;). How to switch these frames on changing tabs?
- Add tabs OnChange event handler.
- In this event handler: a) hide all frames, b) show frame, which is assigned to current TabIndex.
When you create a new tab, you can set its TabObject property. Set TabObject to a frame. When OnChange is called, get TabIndex, call GetTabData() for this index, and read TabObject for this tab. Show the frame, which is stored in this TabObject, hide all others.
var d: TATTabData; begin d:= t.GetTabData(t.TabIndex); if Assigned(d) then (d.TabObject as TMyFrame).Show; end;
License: MPL 2.0. Also you can use it under LGPL.
ATTabs is merged into ATFlatControls repo: https://github.com/Alexey-T/ATFlatControls/ . Some wiki documentation is in the "wiki" subfolder of that repo.