TBarTabs

Source: source/classes/bartabs.prg

Standalone class (not descendant of TControl)

TBarTabs combines TTabs with TBar to create a ribbon-like tabbed toolbar interface. Each tab is associated with a separate toolbar that becomes visible when the tab is selected. This provides a compact way to organize toolbar buttons into functional groups, similar to the ribbon pattern found in modern desktop applications.

Key DATA Members

DATATypeDescription
aBarsArrayArray of TBar objects, one per tab
oTabsObjectTTabs control for switching between toolbars
oPanelObjectTPanel container holding the tabs and buttons
oWndObjectParent window
nBarNumericIndex of the currently active toolbar tab

Methods

MethodDescription
New( oWnd, nBtnWidth, nBtnHeight, aPrompts, acBitmaps, nOption, l3D, l2007 )Create a new TBarTabs control with initial tabs
AddBar( cPrompt, cBitmap )Add a new tab with its associated toolbar. Returns the TBar object.

Example: Three-Tab Toolbar

#include "FiveWin.ch"

function Main()

   local oWnd, oBarTabs, oBar
   local aPrompts := { "Home", "Insert", "View" }
   local acBitmaps := {}

   DEFINE WINDOW oWnd TITLE "BarTabs Demo" SIZE 600, 200

   oBarTabs := TBarTabs():New( oWnd, 64, 32, aPrompts, acBitmaps, 1, .F., .T. )

   // Home tab buttons
   oBar := oBarTabs:aBars[ 1 ]
   DEFINE BUTTON OF oBar PROMPT "Cut"
   DEFINE BUTTON OF oBar PROMPT "Copy"
   DEFINE BUTTON OF oBar PROMPT "Paste"

   // Insert tab buttons
   oBar := oBarTabs:aBars[ 2 ]
   DEFINE BUTTON OF oBar PROMPT "Table"
   DEFINE BUTTON OF oBar PROMPT "Image"

   // View tab buttons
   oBar := oBarTabs:aBars[ 3 ]
   DEFINE BUTTON OF oBar PROMPT "Zoom In"
   DEFINE BUTTON OF oBar PROMPT "Zoom Out"

   oBarTabs:oPanel:ReSize()

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also