I used customer.dbf and Test.dbf you can found on fwh\samples
- Code: Select all Expand view
#include "FiveWin.ch"
#include "XBrowse.ch"
#include "Splitter.ch"
// Purpose: Showing two xbrowse with a Horizontal splitter in a dialog,
// an explorerbar at Right , on the first xbrowse there is a tab
// Author : Silvio falconi
// Date : 19.08.2010
STATIC oWnd,oBar,oDlg ,oSplit2,oSplit,oExBar
function Main()
DEFINE WINDOW oWnd TITLE "Simply Test ExplorerBar two browse, tab, and splitters" ;
MENU BuildMenu()
DEFINE BUTTONBAR oBar _3D SIZE 44, 46 OF oWnd 2007
oWnd:bResized := {|| ResizeWndMain() }
ACTIVATE WINDOW oWnd maximized on init Test()
return nil
function BuildMenu()
local oMenu
MENU oMenu 2007
MENUITEM "Test"
MENU
MENUITEM "Go Test "
ENDMENU
oMenu:AddMdi()
ENDMENU
return oMenu
function test()
Local oDlg
Local oGrid2
Local oGrid3
Local nSplit :=220
local aClient
lOCAL nGridBottom,nGridRight
local oTab
// create the dialog into oWnd
aClient := GetClientRect (oWnd:hWnd )
DEFINE DIALOG oDlg
oDlg:nTop = oBar:nHeight-1
oDlg:nLeft = 0
oDlg:nBottom = aClient[3] - 1
oDlg:nRight = aClient[4]
oDlg:nStyle = nOR( WS_CHILD, 4 )
nGridBottom := (oDlg:nBottom / 2) - oBar:nHeight
nGridRight := (oDlg:nRight / 2 )
// oWnd:oClient := oDlg
@0,0 EXPLORERBAR oExBar of oDlg SIZE nSplit-2, oDlg:nBottom
// open first xbrowse
SELECT 1
USE Customer ALIAS CU
oGrid2 := TXBrowse():New( oDlg )
oGrid2:nTop := 00
oGrid2:nLeft := nSplit+2
oGrid2:nBottom := 200
oGrid2:nRight := nGridRight
oCol = oGrid2:AddCol()
oCol:bStrData = { || CU->First }
oCol:cHeader = "First"
oGrid2:cAlias :=CU->(Alias())
oGrid2:SetRDD()
oGrid2:CreateFromCode()
//create the Tabs
@ oGrid2:nBottom, oGrid2:nLeft TABS oTab ;
OPTION 1 SIZE oWnd:nWidth()-80, 12 PIXEL OF oDlg ;
ITEMS ' First ', ' Last ';
ACTION ( nOrder := oTab:nOption ,;
CU->(DbSetOrder(nOrder)),;
CU->(DbGoTop()) ,;
oGrid2:Refresh(.t.) )
// open second xbrowse
SELECT 2
USE TEST ALIAS TEST
oGrid3 := TXBrowse():New( oDlg )
// oGrid3:nTop := oGrid2:nBottom+5
oGrid3:nTop := oTab:nbottom+5
oGrid3:nLeft := nSplit+2
oGrid3:nBottom := nGridBottom
oGrid3:nRight := nGridRight
oGrid3:cAlias :=TEST->(Alias())
oGrid3:SetRDD()
oGrid3:CreateFromCode()
//First splitter
@ oTab:nbottom+2, nSplit SPLITTER oSplit2 ;
HORIZONTAL ;
COLOR CLR_RED ;
PREVIOUS CONTROLS oGrid2,oTab ;
HINDS CONTROLS oGrid3 ;
SIZE oGrid3:nRight, 2 PIXEL ;
OF oDlg ;
_3DLOOK ;
UPDATE
// second Splitter
@ 00, nSplit SPLITTER oSplit ;
VERTICAL ;
COLOR CLR_BLUE ;
PREVIOUS CONTROLS oExBar;
HINDS CONTROLS oGrid2, oGrid3, oSplit2,oTab;
SIZE 1, nGridBottom PIXEL ;
OF oDlg ;
_3DLOOK ;
UPDATE
ACTIVATE DIALOG oDlg NOWAIT;
ON INIT ExplBarInit( oExBar ) ;
ON PAINT oSplit:AdjClient()
return nil
Function ResizeWndMain()
local aClient
if oDlg != NIL
aClient := GetClientRect (oWnd:hWnd )
oDlg:SetSize( aClient[4], aClient[3] - oWnd:oBar:nHeight - oWnd:oMsgBar:nHeight )
// oApp():oDlg:Move(oApp():oDlg:nYMove,)
oDlg:Refresh()
SysRefresh()
endif
return NIL
function ExplBarInit( oExBar )
local oPanel1, oPanel2, oPanel3, oPanel4
local bClick := { | o | MsgInfo( o:GetText() ) }
oPanel1 = oExBar:AddPanel( "One", "people" )
oPanel1:lSpecial = .T.
oPanel1:AddLink( "First item", bClick, "additem" )
oPanel1:AddLink( "Second item", bClick, "copy" )
oPanel2 = oExBar:AddPanel( "Two", "case" )
oPanel2:AddLink( "First item", bClick, "adddbf" )
oPanel2:AddLink( "Second item", bClick, "delete" )
oPanel2:AddLink( "Third item", bClick, "envelope" )
oPanel2:AddLink( "Fourth item", bClick, "envelope" )
oPanel3 = oExBar:AddPanel( "Three", "graphics" )
oPanel3:AddLink( "First item", bClick, "adddbf" )
oPanel4 = oExBar:AddPanel( "Four" )
oPanel4:AddLink( "First item", bClick, "copy" )
oPanel4:AddLink( "Second item", bClick, "additem" )
return nil
the problem is : the horizontal splitter run bad because when I move it the tab control ( it is on down the first xbrowse) become bigger and the I cannot move the Horizontal splitter