TExplorerBar

Source: source/classes/texplbar.prg

Inherits from: TControl

TExplorerBar is an Outlook-style vertical task panel with collapsible sections and gradient headers. Each section is represented by a TTaskPanel child object that can be expanded or collapsed by clicking its title bar. The panel supports vertical scrolling when content exceeds the visible area, making it suitable for navigation menus, task lists, and property groups.

Command Syntax

@ nRow, nCol EXPLORERBAR oBar OF oWnd SIZE nW, nH

Key DATA Members

DATATypeDescription
aPanelsArrayArray of TTaskPanel objects added to the bar
nTopColorNumericTop gradient color for the bar background (default RGB(122,161,230))
nBottomColorNumericBottom gradient color for the bar background (default RGB(99,117,214))
oVScrollObjectVertical scrollbar control for scrolling panel content
nVPosNumericCurrent vertical scroll position
nVirtualHeightNumericTotal virtual height of all panels combined
nVirtualTopNumericCurrent scroll offset from the top
lSBVisibleLogicalScrollbar visibility flag
aGradientArrayCustom gradient definition for panel headers
bClrGradBlockCode block returning custom gradient colors

TTaskPanel Class (Child of TExplorerBar)

DATATypeDescription
cTitleCharacterPanel section title displayed in the header
nTitleHeightNumericHeight of the clickable title bar (default 25)
nBodyHeightNumericHeight of the body area when expanded (default 50)
lCollapsedLogicalWhether the panel is currently collapsed
aLinksArrayArray of TUrlLink controls added via AddLink()
aGradientArrayGradient colors for the title bar
nRoundNumericCorner rounding radius for the panel (default 6)
bOnCollapseBlockCode block executed when the panel is collapsed/expanded

Methods

MethodDescription
New( nTop, nLeft, nWidth, nHeight, oWnd, nClrFore, nClrBack, oBrush, l2007, l2010, l2013, l2015 )Create a new TExplorerBar control
Redefine( nId, oDlg )Redefine from dialog resource
AddPanel( cName, cBmpName, nBodyHeight, nTitleH, nRound, aGrad, oFnt, nClrT, nClrP )Add a new TTaskPanel section. Returns the panel object.
CloseAll( nExcept )Collapse all panels except the one at index nExcept (default 1)
CheckScroll()Recalculate scrollbar range based on panel heights
VScrollSetPos( nPos )Set the vertical scroll position and update panel positions
VScrollSkip( nSkip )Scroll vertically by nSkip pixels

TTaskPanel Methods

MethodDescription
AddLink( cPrompt, bAction, cBitmap, oFnt, nClrT, nClrP, nClrO, cMsg, cTooltip )Add a clickable link to the panel body. Returns the TUrlLink object.
LoadBitmaps( nType, cnBitmap )Load expand/collapse arrow bitmaps or a custom panel bitmap

Example: Explorer Bar with Two Panels

#include "FiveWin.ch"

function Main()

   local oWnd, oBar, oPanel

   DEFINE WINDOW oWnd TITLE "Explorer Bar Demo" SIZE 300, 500

   @ 0, 0 EXPLORERBAR oBar OF oWnd SIZE 300, 500

   // "Documents" panel with 2 links
   oPanel = oBar:AddPanel( "Documents",, 60, 25 )
   oPanel:AddLink( "Open Recent", { || MsgInfo( "Recent docs" ) }, "fileopen.bmp" )
   oPanel:AddLink( "Browse Folders", { || MsgInfo( "Browse" ) }, "folders.bmp" )

   // "Tools" panel with 2 links
   oPanel = oBar:AddPanel( "Tools",, 60, 25 )
   oPanel:AddLink( "Settings", { || MsgInfo( "Settings" ) }, "settings.bmp" )
   oPanel:AddLink( "Help", { || MsgInfo( "Help" ) }, "help.bmp" )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also