TDockPnel
Source: source/internal/tdockpnel.prg
Inherits from: TControl
TDockPnel is a dockable panel control that provides a floating/tool window with a title bar and an inner content area. It supports multiple content modes (nMode: 1=TPanel, 2=TScrollPanel, 9=TDialog) and various control types (nType: 1=ButtonBar, 2=TTitle, 3=TRibbonBar, 4=TFolderEx, 5=TXBrowse). The panel can be docked to any edge and supports splitter-based resizing.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
nMode | Numeric | Content mode: 1=TPanel, 2=TScrollPanel, 9=TDialog |
oPnelP / oPnelH | Object | Panel body and header controls |
nHTit | Numeric | Title bar height |
nType | Numeric | Control type: 1=ButtonBar, 2=TTitle, 3=TRibbonBar, 4=TFolderEx, 5=TXBrowse |
nClrPane / nClrText | Numeric | Panel area colors |
nClrPaneH / nClrTextH | Numeric | Header area colors |
lBottom | Logical | .T. to dock at the bottom edge |
lSplitV | Logical | .T. for a vertical splitter handle |
Methods
| Method | Description |
|---|---|
New( oWnd, nT, nL, nB, nR, cT, nBord, nClrT, nClrP, lClient ) | Create a dockable panel with position, caption, border, and colors |
Activate() | Show and activate the panel window |
SetCaption( c ) | Set the title bar caption text |
SetPosTitle( l ) | Set the title position (logical flag) |
SetBorderSize( n ) | Set the border width in pixels |
SetColors( nT, nP, nTH, nPH ) | Set text and pane colors for body and header |
SetTypeCtrl( n ) | Set the control type (1-5) |
SetCtrlsPnel( u ) | Attach a control or array of controls to the panel |
SetImgsFiles( aBtns ) | Set button images from file paths |
SetImgsResources( aBtns ) | Set button images from resource names |
SetSplitV( nPos, lLeft, nW, nClrS ) | Configure a vertical splitter at position nPos |
SetStyle( n ) | Set visual style (1-52 predefined styles) |
Example: Dock Panel with XBrowse
#include "FiveWin.ch"
function Main()
local oWnd, oDock, oBrw
DEFINE WINDOW oWnd TITLE "Dock Panel Demo" SIZE 800, 600
// Create a dock panel with XBrowse content
oDock := TDockPnel():New( oWnd, 30, 10, 400, 600, "Data Browser", ;
1, CLR_BLACK, RGB(240,240,255), .F. )
oDock:nType := 5 // TXBrowse content
// Configure XBrowse columns
oBrw := TXBrowse():New( oDock:oPnelP )
oBrw:AddCol( "Name" )
oBrw:AddCol( "Value" )
oBrw:lRecordSelector := .F.
oDock:SetCtrlsPnel( oBrw )
oDock:SetColors( CLR_BLACK, RGB(240,240,255), CLR_WHITE, RGB(50,100,200) )
oDock:Activate()
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
Notes
- The
nModeproperty determines the type of inner container created for hosting controls. Mode 1 (TPanel) is the default for simple layouts; mode 9 (TDialog) enables dialog-style behavior with OK/Cancel buttons. - The
nTypeproperty selects which built-in control type is rendered inside the panel. Type 5 (TXBrowse) is commonly used for data grids. - Use
SetSplitV()to add a draggable vertical splitter. The splitter allows users to resize the panel at runtime. - The 52 predefined styles accessible via
SetStyle()control visual appearance including gradients, borders, and font rendering.