TTabs
Fonte: source/classes/tabs.prg
Inherits from: TControl
TTabs is a custom-drawn tab bar control that displays a row or column of selectable tabs. Unlike TFolder, TTabs only renders the tab strip itself without an integrated page container. It supports horizontal (top/bottom) and vertical (left/right) orientations, bitmap labels, and keyboard navigation.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
aPrompts | Array | Array of tab label strings |
nOption | Numeric | Index of the currently selected tab (1-based) |
nOrientation | Numeric | Tab orientation: OR_TOP, OR_BOTTOM, OR_LEFT, OR_RIGHT |
acBitmaps | Array | Array of bitmap handles or filenames for each tab |
Methods
| Method | Description |
|---|---|
New( nTop, nLeft, aPrompts, bAction, oWnd, nOption ) | Create a new tab bar control |
SetOption( n ) | Select the tab at index n |
AddItem( cPrompt ) | Add a new tab with the given prompt text |
DelItem( nIndex ) | Remove the tab at the specified index |
SetTabs( aTabs ) | Replace all tab definitions at once |
GoTop() | Select the first tab |
GoLeft() | Select the tab to the left |
GoBottom() | Select the last tab |
GoRight() | Select the tab to the right |
Example: 3-Tab Bar
#include "FiveWin.ch"
function Main()
local oWnd, oTabs, nOpt := 1
DEFINE WINDOW oWnd TITLE "TTabs Demo" SIZE 500, 300
@ 10, 10 TAB oTabs PROMPTS "Files", "Edit", "View" ;
SIZE 460, 30 OF oWnd ACTION oWnd:Refresh()
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- TTabs is a standalone tab strip. Pair it with TPages or a dialog-switching mechanism to build a full tabbed interface.
- Orientation constants are
OR_TOP(default),OR_BOTTOM,OR_LEFT, andOR_RIGHT. - Use
acBitmapsto assign bitmap images to individual tabs. Bitmaps can be specified as file names or resource handles. - The
bActioncode block is evaluated each time a different tab is selected.