I wish create this window
it is a dialog on main window with ttitle on top , xbrowse at left a vertical splitter and a folder at right
on bottom a buttonbar
how i can make it ?
Inot wish use tlayout class but on a Windows and a tfsdi dialog
a tfsdi dialog is a dialog with the style nOR( WS_CHILD, 4 )
i made a test but not run ok there is someone can help me please . i insert the tfsdi class on bottom
- Code: Select all Expand view
// a Windows with a Dialog with ttitle xbrowse and buttonbar
#include "fivewin.ch"
REQUEST DBFCDX
REQUEST DBFFPT
static oWndMain,oBar,oBartitle
Static oDlgNew,oGrid,oPanelRight,oSplit
Static cIniFile
Function Main()
cIniFile := cFilePath( GetModuleFileName( GetInstance() ) ) + "test.ini"
DEFINE WINDOW oWndMain Title "Test with ttitle and xbrowse,splitter,"
DEFINE BUTTONBAR oBar _3D SIZE 44, 46 OF oWndMain
SET MESSAGE OF oWndMain TO "fivewin power" CENTER NOINSET
oWndMain:bResized := {|| ResizeWndMain() }
ACTIVATE WINDOW oWndMain;
on init test()
return nil
//--------------------------------------------------------------------------//
Function Test()
Local oCol,i,aBrowse
Local nSplit :=VAL(GetPvProfString("Browse", "CuSplit","302", cIniFile))
oDlgNew := TFsdi():New(oWndMain)
oWndMain:oClient := oDlgNew
oBarTitle:=TTitle():New( oDlgNew,0, 0,oDlgNew:nGridRight, 40)
USE CUSTOMER ALIAS CU
oDlgNew:NewGrid( nSplit )
oGrid:cAlias := "CU"
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:CreateFromCode()
//---------------------------------------------------------------------------//
oPanelRight:=TPanel():New(oBarTitle:nBottom+1,nSplit+2,;
oDlgNew:nGridRight,;
oDlgNew:nGridBottom-26,;
oDlgNew)
//---------------------------------------------------------------------------//
oSplit := TSplitter():New(oBarTitle:nBottom+1,nSplit,(.not..F.) .or. .T.,{oGrid},.not..F.,;
{oPanelRight},.not..F.,,,;
oDlgNew,,1,oDlgNew:nGridBottom ,;
.T.,.T.,,.F.,.T.,.T. )
ACTIVATE DIALOG oDlgNew NOWAIT ;
ON PAINT (oSplit:AdjClient()) ;
ON INIT ( Load_dialog(),oGrid:SetFocus(),ResizeWndMain()) ;
VALID ( oGrid:nLen := 0 ,;
DbCloseAll(), oDlgNew := NIL, .t. )
return nil
Function Load_dialog()
Local oFld
@ 30,0 FOLDER oFld ITEMS "Anagrafica","Rapporti Commerciali","Varie";
SIZE oPanelRight:nRight,oPanelRight:nBottom-26 PIXEL;
OF oPanelRight ;
OPTION 1
oPanelRight:oClient:= oFld
return nil
//---------------------------------------------------------------------------//
Function ResizeWndMain()
local aClient
IF oDlgNew != NIL
aClient := GetClientRect ( oWndMain:hWnd )
oDlgNew:SetSize( aClient[4], aClient[3] - oBar:nHeight - oWndMain:oMsgBar:nHeight+1 - oBartitle:nBottom)
IF oSplit != NIL
oSplit:Refresh()
ENDIF
IF oBarTitle != nil
oBarTitle:SetSize(aClient[ 2 ],40)
oBarTitle:Refresh()
ENDIF
IF oGrid != NIL
oGrid:SetSize( aClient[ 3 ]- oGrid:nLeft, oDlgNew:nHeight -oBartitle:nBottom)
oGrid:Refresh()
ENDIF
if oPanelRight != nil
oPanelRight:SetSize( aClient[ 4 ]- oPanelRight:nLEFT,oDlgNew:nHeight- oBartitle:nBottom)
oPanelRight:Refresh()
endif
oWndMain:oMsgBar:Refresh()
SysRefresh()
ENDIF
return nil
//-----------------------------------------------------------------------------//
CLASS TFsdi FROM TDialog
DATA nGridBottom, nGridRight
CLASSDATA lRegistered AS LOGICAL
METHOD New( oWnd, lPixels ) CONSTRUCTOR
METHOD AdjClient() // INLINE oApp():oWndMain:AdjClient()
METHOD NewGrid( nSplit )
ENDCLASS
METHOD New( oWnd ) CLASS TFsdi
local aClient
default oWnd := oWndMain // GetWndDefault()
aClient := GetClientRect (oWnd:hWnd )
::oWnd = oWnd
::nTop = oBar:nHeight
::nLeft = 0
::nBottom = aClient[3] - 1
::nRight = aClient[4]
::nStyle := nOR( WS_CHILD, 4 )
::lHelpIcon := .f.
::lTransparent := .f.
DEFINE FONT ::oFont NAME 'Tahoma' SIZE 0, -12
::nGridBottom := (::nBottom / 2) - oBar:nHeight
::nGridRight := (::nRight / 2 )
::aControls := {}
::SetColor( CLR_WHITE, GetSysColor(15) )
::Register( nOr( CS_VREDRAW, CS_HREDRAW ) )
SetWndDefault( Self )
return Self
METHOD NewGrid( nSplit ) CLASS TFsdi
oGrid := TXBrowse():New( oDlgNew )
oGrid:nTop := oBarTitle:nBottom
oGrid:nLeft := 00
oGrid:nBottom := oDlgNew:nGridBottom
oGrid:nRight := oDlgNew:nGridRight
return nil
METHOD AdjClient() CLASS TFsdi
return nil