TTabs

Source: 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

DATATypeDescription
aPromptsArrayArray of tab label strings
nOptionNumericIndex of the currently selected tab (1-based)
nOrientationNumericTab orientation: OR_TOP, OR_BOTTOM, OR_LEFT, OR_RIGHT
acBitmapsArrayArray of bitmap handles or filenames for each tab

Methods

MethodDescription
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

See Also