#include "FiveWin.ch"
#include "Splitter.ch"
#define ID_TOP 30
#define ID_FXBAR 68
*+--------------------------------------------------------------------
*+
*+ Function Main()
*+
*+--------------------------------------------------------------------
*+
FUNCTION Main()
LOCAL oWnd, oFld1, oFld2, oSplit, nPart
LOCAL nHeight, nWidth
LOCAL oBtn1, oBtn2
LOCAL ii, oBtn0, nCol := 0, aButton := {}
LOCAL bAction := { || MsgInfo( "hello Main" ) }
DEFINE WINDOW oWnd FROM 0, 0 TO 600, 800 PIXEL
nWidth := oWnd:nWidth / 2
nHeight := oWnd:nHeight
oFld1 := TFolder() :New( 0, 0, { "Grid_left1" },, oWnd, 1,,, .T., .F., nWidth - 5, nHeight - 70 )
oBtn1 := TButton() :new( ID_TOP, 2, "left" , oFld1, bAction, nWidth - 6, nHeight - 120,,,, .T. )
oBtn1:bAction := bAction
oFld2 := TFolder() :New( 0, nWidth + 5, { "Grid_right1" },, oWnd, 1,,, .T., .F., nWidth - 5, nHeight - 70 )
oBtn2 := TButton() :new( ID_TOP, 2, "right", oFld2, bAction, nWidth - 6, nHeight - 120,,,, .T. )
oBtn2:bAction := bAction
nPart := oWnd:nWidth / 12
FOR ii := 1 TO 12
oBtn0 := TButton() :new( nHeight - ID_FXBAR, nCol, "F" + STRZERO( ii, 2 ), oWnd, bAction, nPart - 4, 20,,,, .T. )
nCol += nPart
AADD( aButton, oBtn0 )
NEXT
@ ID_TOP, nWidth - 10 SPLITTER oSplit ;
VERTICAL ;
PREVIOUS CONTROLS oFld1 ;
HINDS CONTROLS oFld2 ;
LEFT MARGIN 1 ;
RIGHT MARGIN 1 ;
SIZE 8, nHeight - 98 PIXEL ;
ON CHANGE DoResize( oWnd, oSplit, oFld1, oFld2, oBtn1, oBtn2, aButton ) ;
COLOR CLR_BLUE ;
OF oWnd
#IFDEF __HMG__
END WINDOW
#ENDIF
ACTIVATE WINDOW oWnd ;
ON RESIZE DoResize( oWnd, oSplit, oFld1, oFld2, oBtn1, oBtn2, aButton ) CENTER
RETURN NIL
*+--------------------------------------------------------------------
*+
*+ Procedure DoResize()
*+
*+ Called from ( split1.prg ) 2 - function main()
*+ ( tgrid.prg ) 2 - procedure main()
*+
*+--------------------------------------------------------------------
*+
PROCEDURE DoResize( oWnd, oSplit, oFld1, oFld2, oBtn1, oBtn2, aButton )
LOCAL nTop := oWnd:nTop
LOCAL nBottom := oWnd:nBottom
LOCAL nRight := oWnd:nRight
LOCAL nLeft := oWnd:nLeft
LOCAL nHeight := nBottom - nTop
LOCAL nPart := oWnd:nWidth / 12
LOCAL nLeftWidth, nRightWidth
LOCAL ii, oBtn, nCol := 0
LOCAL oCtrol
// ************************ left *************************
oSplit:AdjLeft()
oSplit:nTop := ID_TOP
oSplit:nHeight := nHeight - ID_TOP - ID_FXBAR
oCtrol := oSplit:aPrevCtrols[ 1 ]
nLeftWidth := oCtrol:nWidth
IF nLeftWidth > oWnd:nWidth
nLeftWidth := oWnd:nWidth - 100
oSplit:SetPosition( nLeftWidth )
ENDIF
oCtrol:nLeft := 0
oCtrol:nRight := nLeftWidth
oCtrol:nTop := ID_TOP
oCtrol:nBottom := nHeight - ID_FXBAR - 130
oCtrol:SetSize( nLeftWidth, nHeight - ID_FXBAR - 40 )
oBtn1:SetPos( ID_TOP, 20 )
oBtn1:SetSize( nLeftWidth - 40, nHeight - ID_FXBAR - 90 )
// ************************ right *************************
oSplit:AdjRight()
oSplit:nTop := ID_TOP
oSplit:nHeight := nHeight - ID_TOP - ID_FXBAR
oCtrol := oSplit:aHindCtrols[ 1 ]
nRightWidth := oCtrol:nWidth
oCtrol:nLeft := nLeftWidth
oCtrol:nRight := nRightWidth
oCtrol:nTop := ID_TOP
oCtrol:nBottom := nHeight - ID_FXBAR - 130
oCtrol:SetSize( nRightWidth, nHeight - ID_FXBAR - 40 )
oBtn2:SetPos( ID_TOP, 20 )
oBtn2:SetSize( nRightWidth - 40, nHeight - ID_FXBAR - 90 )
// ************************ NEED again *************************
oFld1:SetPos( ID_TOP, 0 )
oFld1:SetSize( nLeftWidth, nHeight - ID_FXBAR - 40 )
// ************************ Fx Buttons *************************
FOR ii := 1 TO 12
aButton[ ii ] :SetSize( nPart, 30 )
aButton[ ii ] :SetPos( oWnd:nHeight - ID_FXBAR, nCol )
nCol += nPart
NEXT
oWnd:Refresh()
RETURN
*+ EOF: SPLIT1.PRG