#include "fivewin.ch"
#include "Splitter.ch"
REQUEST DBFCDX
FUNCTION Main()
LOCAL oSample
oSample = TSample():New()
RETURN NIL
//--------------------
CLASS TSample
DATA oWnd
DATA oTaskpanel
DATA oSplitV
DATA oSplitH
DATA oGrid
DATA oTab
DATA oPanelLeft
DATA oPanelTop
DATA oPanelDown
METHOD New()
METHOD BuildGrid()
METHOD BuildPanel()
METHOD BuildSplitterH()
METHOD BuildSplitterV()
METHOD Buildtab()
METHOD OnResizeWnd( nWidth, nHeight )
ENDCLASS
//--------------------
METHOD New() CLASS TSample
LOCAL oBrush
LOCAL oSelf := Self
DEFINE BRUSH oBrush COLOR CLR_CYAN
DEFINE WINDOW ::oWnd
DEFINE DIALOG ::oPanelLeft STYLE nOr( WS_CHILD ) SIZE 150, 150 OF ::oWnd
ACTIVATE DIALOG ::oPanelLeft NOWAIT
DEFINE DIALOG ::oPanelTop STYLE nOr( WS_CHILD ) SIZE 150, 150 OF ::oWnd
ACTIVATE DIALOG ::oPanelTop NOWAIT ;
ON INIT ::Move( 0, oSelf:oPanelLeft:nRight + 5, oSelf:oWnd:nHeight / 2, oSelf:oWnd:nWidth )
::oPanelDown = TPanel():New( ::oPanelTop:nHeight + 5, ;
::oPanelLeft:nRight + 5, ;
::oWnd:nHeight - ::oPanelTop:nHeight - 5, ;
::oWnd:nWidth, ::oWnd )
::BuildPanel()
::BuildGrid()
::BuildTab()
::BuildSplitterH()
::BuildSplitterV()
::oPanelDown:SetBrush( oBrush )
::oWnd:bResized = {| nType, nWidth, nHeight | ::OnResizeWnd( nWidth, nHeight ) }
ACTIVATE WINDOW ::oWnd
RETURN Self
//--------------------
METHOD BuildGrid() CLASS TSample
LOCAL i, aBrowse, oCol
USE "customer" ALIAS CU NEW SHARED
::oGrid := TXBrowse():New( ::oPanelTop )
::oGrid:nTop := 0
::oGrid:nLeft := 0
::oGrid:nBottom := ::oWnd:nHeight
::oGrid:nRight := ::oWnd:nWidth
aBrowse := { { { || CU->FIRST }, i18n("First"), 150, 0 },;
{ { || CU->LAST }, i18n("Last"), 150, 0 },;
{ { || CU->STREET}, i18n("Street"), 150, 0 },;
{ { || CU->CITY } , i18n("City"), 150, 0 } }
FOR i := 1 TO Len(aBrowse)
oCol := ::oGrid:AddCol()
oCol:bStrData := aBrowse[ i, 1 ]
oCol:cHeader := aBrowse[ i, 2 ]
oCol:nWidth := aBrowse[ i, 3 ]
oCol:nDataStrAlign := aBrowse[ i, 4 ]
oCol:nHeadStrAlign := aBrowse[ i, 4 ]
NEXT
::oGrid:SetRDD()
::oGrid:CreateFromCode()
::oPanelTop:oClient = ::oGrid
RETURN NIL
//--------------------
METHOD BuildPanel() CLASS TSample
LOCAL oPanel1
lOCAL bClick:={|| msgInfo( "clicked") }
::oTaskPanel := TExplorerBar():New( 0, 0, 150, 150, ::oPanelLeft )
oPanel1 = ::oTaskPanel:AddPanel( "One", "c:\fwh\bitmaps\32x32\people.bmp" )
oPanel1:lSpecial = .T.
oPanel1:AddLink( "First item", bClick, "c:\fwh\bitmaps\16x16\additem.bmp" )
oPanel1:AddLink( "Second item", bClick, "c:\fwh\bitmaps\16x16\copy.bmp" )
::oPanelLeft:oClient = ::oTaskPanel
RETURN NIL
//--------------------
METHOD BuildSplitterV() CLASS TSample
@ 00, ::oTaskPanel:nWidth + 1 SPLITTER ::oSplitV ;
VERTICAL ;
COLOR CLR_YELLOW ;
PREVIOUS CONTROLS ::oPanelLeft ;
HINDS CONTROLS ::oPanelTop, ::oPanelDown, ::oSplitH;
SIZE 2, ::oWnd:nHeight PIXEL ;
LEFT MARGIN 70 ;
RIGHT MARGIN 200 ;
OF ::oWnd ;
UPDATE
RETURN NIL
//--------------------
METHOD BuildSplitterH() CLASS TSample
@ ::oPanelTop:nHeight + 1, ::oTaskPanel:nWidth + 1 SPLITTER ::oSplitH ;
HORIZONTAL ;
COLOR CLR_YELLOW ;
PREVIOUS CONTROLS ::oPanelTop ;
HINDS CONTROLS ::oPanelDown;
SIZE ::oWnd:nWidth, 2 PIXEL ;
TOP MARGIN 120 ;
BOTTOM MARGIN 120 ;
OF ::oWnd ;
UPDATE
RETURN NIL
//--------------------
METHOD Buildtab() CLASS TSample
LOCAL oSelf := Self
@ ::oGrid:nBottom + 2, 0 TABS ::oTab SIZE ::oPanelTop:nWidth, 12 PIXEL OF ::oPanelTop ;
ITEMS ' First ', ' Last ';
ACTION ( CU->( DbSetOrder( ::oTab:nOption ) ),;
CU->( DbGoTop() ) ,;
oSelf:oGrid:Refresh( .T. ) )
::oPanelTop:oBottom = ::oTab
RETURN NIL
//--------------------
METHOD OnResizeWnd( nWidth, nHeight )
IF nWidth != NIL .AND. nHeight != NIL
::oPanelLeft:SetSize( ::oPanelLeft:nWidth, nHeight )
::oSplitV:SetSize( ::oSplitV:nWidth, nHeight )
::oSplitV:nLong = nHeight
::oPanelTop:SetSize( nWidth - ::oPanelLeft:nWidth - ::oSplitV:nWidth, ::oPanelTop:nHeight )
::oSplitH:SetSize( nWidth, 2 )
::oSplitH:nLong = nWidth
::oPanelDown:SetSize( nWidth - ::oPanelLeft:nWidth - ::oSplitV:nWidth, nHeight - ::oPanelDown:nTop )
ENDIF
RETURN NIL