TExplorerList / TItemListbar

Source: source/classes/texplist.prg

TExplorerList inherits from: TControl. TItemListbar is an internal collaboration class for individual items.

TExplorerList is a vertical navigation list control with expandable/collapsible items, similar to the Windows Explorer folder tree or Outlook bar. Each item can display a bitmap, text, and optional child items with indentation. The control supports keyboard navigation, mouse hover effects, gradient selection highlighting, and vertical scrolling for overflow content.

Key DATA Members (TExplorerList)

DATATypeDescription
aItemsArrayArray of TItemListbar objects
bChangeBlockCode block executed when the selected item changes
oItemSelectedObjectCurrently selected TItemListbar item
oVScrollObjectVertical scroll bar control
nSeparationNumericVertical spacing between top-level items (default 15)
nVirtualHeightNumericTotal virtual height of all items
nVirtualTopNumericCurrent scroll offset in virtual pixels
nFadeNumericAlpha level for fade animation (0-255)

Methods

MethodDescription
New( nTop, nLeft, oWnd, lPixel, lDesign, nWidth, nHeight, nSeparation )Create the explorer list control
AddItem( cText, cBitmap, aGradSel, aGradOver, aGradOverSel, nClrInSel, nClrOutSel, nClrInOverSel, nClrOutOverSel, nClrInOver, nClrOutOver, nClrText, bAction )Add a new item with text, bitmap, and gradient/hover colors
DelItem( uVal )Delete an item by position or object reference
GetItem( nPos )Return the item at the given position
SetOption( n )Select an item by index
GoDown( nSkip ) / GoUp( nSkip )Navigate to the next/previous visible item
CheckScroll()Recalculate scroll range based on item positions

TItemListbar (Item Objects)

DATATypeDescription
cTextCharacterDisplay text
hBitmapHandleItem bitmap handle
lSelectedLogicalIs this item currently selected
lOverLogicalIs the mouse hovering over this item
lOpenedLogicalAre child items expanded
lParentLogicalDoes this item have children
nLevelNumericHierarchy depth (0 = top-level)
bActionBlockCode block executed when item is clicked

TItemListbar supports AddItem() to create child items, OpenClose() to expand/collapse children, and Click() to trigger actions.

Example: Navigation List with Groups

#include "FiveWin.ch"

function Main()

   local oWnd, oList, oInbox, oSent

   DEFINE WINDOW oWnd TITLE "TExplorerList Demo" SIZE 300, 400

   @ 10, 10 EXPLORERLIST oList SIZE 280, 380 OF oWnd

   oInbox := oList:AddItem( "Inbox", "inbox.bmp" )
   oInbox:AddItem( "Today", "mail.bmp" )
   oInbox:AddItem( "Yesterday", "mail.bmp" )

   oSent := oList:AddItem( "Sent Items", "sent.bmp" )
   oSent:AddItem( "This Week", "mail.bmp" )

   oList:AddItem( "Deleted Items", "trash.bmp" )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also