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)
| DATA | Type | Description |
|---|---|---|
aItems | Array | Array of TItemListbar objects |
bChange | Block | Code block executed when the selected item changes |
oItemSelected | Object | Currently selected TItemListbar item |
oVScroll | Object | Vertical scroll bar control |
nSeparation | Numeric | Vertical spacing between top-level items (default 15) |
nVirtualHeight | Numeric | Total virtual height of all items |
nVirtualTop | Numeric | Current scroll offset in virtual pixels |
nFade | Numeric | Alpha level for fade animation (0-255) |
Methods
| Method | Description |
|---|---|
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)
| DATA | Type | Description |
|---|---|---|
cText | Character | Display text |
hBitmap | Handle | Item bitmap handle |
lSelected | Logical | Is this item currently selected |
lOver | Logical | Is the mouse hovering over this item |
lOpened | Logical | Are child items expanded |
lParent | Logical | Does this item have children |
nLevel | Numeric | Hierarchy depth (0 = top-level) |
bAction | Block | Code 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
- Add child items by calling
AddItem()on a parent TItemListbar object. Child items are indented by 10 pixels per level. - Items are rendered with gradient backgrounds and rounded corners in three states: normal, hover, and selected+hover.
- Keyboard navigation: Up/Down arrows, +/- to expand/collapse, Enter to trigger action, Home/End for first/last item.
- The fade animation (
FadeOn/FadeOff) provides visual feedback on mouse enter/leave events.