TNavigator

Source: source/classes/navpanels.prg

Inherits from: TControl

TNavigator is a collapsible navigation panel with a gradient title bar, toggle button, and automatic sibling panel repositioning. When collapsed, the panel shrinks to a narrow vertical bar with a rotated title; when expanded, it reveals child controls. Multiple TNavigator instances can be linked via aRelatedNavigators so that toggling one panel repositions its siblings -- ideal for side-docking navigation bars.

Key DATA Members

DATATypeDescription
lExpandedLogicalCurrent expanded/collapsed state (default .T.)
nOriginalWidthNumericWidth when fully expanded, used on restore
nWidthClosedNumericWidth when collapsed (default 50)
cTitleCharacterTitle text displayed in the header bar
nTitleHeightNumericHeight of the gradient title bar (default 40)
aRelatedNavigatorsArrayLinked sibling panels for auto-repositioning
bToggledBlockCode block fired after toggle completes
nRoundNumericCorner rounding radius (default 6)
nTopColorNumericGradient top/start color
nBottomColorNumericGradient bottom/end color
nClrHoverNumericTitle text color on mouse hover
nBetWeenSpaceNumericGap between sibling navigator panels (default 2)
cImageCharacterOptional background image file path
cBtnImage1CharacterToggle button image when collapsed (arrow right)
cBtnImage2CharacterToggle button image when expanded (arrow left)

Methods

MethodDescription
New( nTop, nLeft, nBottom, nRight, oWnd, lBorder, nClrBorder, nBackColor, nWidthClosed, cTitle, cImage, cBtnImg1, cBtnImg2, nClrText, nClrHover, nTitleH, nSpace, lDesign, lPixel )Create a new TNavigator panel
ReDefine( nId, oWnd, lBorder, nClrBorder, nBackColor, nWidthClosed, cTitle, cImage, cBtnImg1, cBtnImg2, nClrText, nClrHover, nTitleH, nSpace, lDesign )Redefine from dialog resource
ToggleSize()Toggle between expanded and collapsed states, reposition siblings
CloseAll()Collapse all linked navigator panels
OpenAll()Expand all linked navigator panels
ChangeWidth( nWidth, nHeight )Resize the navigator panel

Example: Linked Navigator Panels

#include "FiveWin.ch"

function Main()

   local oWnd, oNav1, oNav2

   DEFINE WINDOW oWnd TITLE "Navigator" SIZE 600, 400

   oNav1 := TNavigator():New( 0, 0, 400, 200, oWnd,,,;
              RGB( 157, 188, 219 ), 50, "Files" )

   oNav2 := TNavigator():New( 0, 202, 400, 402, oWnd,,,;
              RGB( 157, 188, 219 ), 50, "Search" )

   oNav1:aRelatedNavigators := { oNav2 }
   oNav2:aRelatedNavigators := { oNav1 }

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also