TFolderEx
Source: source/classes/tfoldex.prg
Inherits from: TControl
TFolderEx is an extended tabbed folder control that supports multiple tab layouts (top, left, bottom, right), gradient rendering, bitmaps per tab, animation, drag-reordering, per-tab enable/disable/hide, and multi-line tabs. It is the primary tab control used in modern FWH applications, offering a rich alternative to the standard TFolder.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
aDialogs | Array | Array of child dialog objects for each tab page |
aPrompts | Array | Array of tab caption strings |
aEnable | Array | Array of logical values: enabled state per tab |
aBitmaps | Array | Array of bitmap handles for each tab icon |
aAlign | Array | Per-tab text alignment: AL_LEFT, AL_RIGHT, AL_CENTER |
nLayOut | Numeric | Tab position: TOP (1), LEFT (2), BOTTOM (3), RIGHT (4) |
nOption | Numeric | Currently selected tab index (1-based) |
nOver | Numeric | Tab index that the mouse is currently hovering over |
nSeparator | Numeric | Pixel gap between adjacent tabs |
nRound | Numeric | Corner radius for tab backgrounds |
aGradSel | Array | Gradient for the selected tab |
aGradUnsel | Array | Gradient for unselected tabs |
aGradOver | Array | Gradient for the hovered tab |
aGradDis | Array | Gradient for disabled tabs |
lAnimation | Logical | Enable animated transition when switching tabs |
lMultiLine | Logical | Allow tabs to wrap to multiple rows |
lStretch | Logical | Stretch tabs to fill the available width |
Methods
| Method | Description |
|---|---|
New( nRow, nCol, nW, nH, oWnd, aBitmaps, lPixel, lDesign, aPrompts, nFolH, nLayOut, ... ) | Create an extended folder with prompts, bitmaps, layout direction and gradients |
SetOption( nOption ) | Activate a tab by its 1-based index |
AddItem( cPrompt, cBmp, oDlg ) | Add a new tab with prompt, optional bitmap and dialog page |
DelItem( nOption ) | Remove a tab and its associated dialog page |
MoveTab( nNewPos ) | Move a tab to a new position (drag reorder support) |
DisableTab( nOption ) | Disable a specific tab |
EnableTab( nOption ) | Enable a previously disabled tab |
HideTab( nOption ) | Hide a specific tab |
ShowTab( nOption ) | Show a previously hidden tab |
AnimateOpt( nOption, nOldOption ) | Play the animated transition between old and new tab |
ChangeOrder() | Apply the current order array (aOrder) to rearrange tabs |
SetBitmap( cBmp, nOption ) | Change the bitmap for a specific tab |
SetLayOut( nLayOut, ... ) | Change the tab layout direction (TOP/LEFT/BOTTOM/RIGHT) and update gradients |
SetDefColors( aGradSel, aGradUnsel, aGradOver, aGradDis ) | Set default gradient arrays for all tab states |
Example: 3-Tab Folder with Icons
#include "FiveWin.ch"
function Main()
local oWnd, oFolder, oDlg1, oDlg2, oDlg3
DEFINE WINDOW oWnd TITLE "TFolderEx Demo" SIZE 600, 400
oDlg1 := TDlg():New( 0, 0, 300, 200, "General", , , , , , , oWnd )
oDlg2 := TDlg():New( 0, 0, 300, 200, "Options", , , , , , , oWnd )
oDlg3 := TDlg():New( 0, 0, 300, 200, "About", , , , , , , oWnd )
@ 20, 20 FOLDEREX oFolder ;
PROMPTS "General", "Options", "About" ;
DIALOGS oDlg1, oDlg2, oDlg3 ;
SIZE 560, 360 OF oWnd ;
LAYOUT TOP
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- TFolderEx supports four tab layouts via
nLayOut: TOP (1), LEFT (2), BOTTOM (3), RIGHT (4). The tab strip is drawn accordingly and child dialogs are positioned to fill the remaining area. - Per-tab state arrays (
aEnable,aVisible,aAlign,aBitmaps) are maintained in parallel withaPrompts. - When
lAnimationis true, tab switching triggers a slide transition controlled bynSpeed. - The tab rendering is split into two internal methods:
PaintLR()for left/right layouts andPaintTB()for top/bottom layouts. - Right-click on a tab fires
bPopupif assigned, allowing context menus per tab. - Tab reordering is supported via
aOrder— set the array to the desired tab index sequence and callChangeOrder().