TSplitter

Fonte: source/classes/splitter.prg

Inherits from: TControl

TSplitter provides a draggable divider bar that allows users to resize adjacent control panels at runtime. It is commonly used to create resizable split-pane layouts (e.g. a tree view on the left and an edit area on the right) where the user can drag the splitter to allocate more or less space to each pane.

Key DATA Members

DATATypeDescription
lVerticalLogicalVertical splitter (left/right panes) vs horizontal (top/bottom)
aPrevCtrolsArrayControls on the previous side (left/top) to be resized
aHindCtrolsArrayControls on the hind side (right/bottom) to be resized
nFirstNumericInitial position of the splitter in pixels

Methods

MethodDescription
New( nRow, nCol, lVert, aPrev, lAdjPrev, aHind, lAdjHind, bMargin1, bMargin2, oWnd, bChange )Create a new TSplitter control
SetPosition( n )Set the splitter position programmatically
AdjClient()Adjust the parent window client area accounting for the splitter

Example: Vertical Splitter Between Tree and Edit

#include "FiveWin.ch"

function Main()

   local oWnd, oTree, oEdit, oSplit

   DEFINE WINDOW oWnd TITLE "Splitter Demo" SIZE 700, 500

   @ 0, 0 TREE oTree SIZE 200, 500 OF oWnd
   oTree:AddNode( "Node 1" )
   oTree:AddNode( "Node 2" )

   @ 0, 210 GET oEdit VAR cVar MEMO SIZE 480, 500 OF oWnd

   @ 0, 200 SPLITTER oSplit ;
      VERTICAL ;
      PREVIOUS oTree ;
      HIND oEdit ;
      SIZE 10, 500 OF oWnd

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Veja Também