How can I solve? ( I need to use a dialog and not a window)
Test_Source
- Code: Select all Expand view RUN
- #include "Fivewin.ch"
#include "constant.ch"
#include "splitter.ch"
// test dialog with two panel and splitter
Function Test()
local oDlg,oFont,oBold,oFld
local nBottom := 33
local nRight := 80
local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
local nHeight := nBottom * DLG_CHARPIX_H
local oPanelImg,oPanelFolder,oBtnPrint,oBtnClose
local nSplit:= 200
local oSplit
DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -12
DEFINE DIALOG oDlg SIZE nWidth, nHeight TRANSPARENT PIXEL TRUEPIXEL RESIZABLE ;
TITLE 'test ' COLOR CLR_BLACK, nRgb( 245,244,234) FONT oFont
@ 100,10 BUTTON oBtnPrint PROMPT "Confirm" of oDlg SIZE 80,22 ACTION NIL
@ 100,10 BUTTON oBtnClose PROMPT "Close" of oDlg SIZE 80,22 ACTION oDlg:End()
oDlg:bResized := <||
oRect := oDlg:GetCliRect()
oBtnPrint:nLeft := oRect:nRight - 200
oBtnPrint:nTop := oRect:nBottom - 40
oBtnClose:nLeft := oRect:nRight - 100
oBtnClose:nTop := oRect:nBottom - 40
if oPanelImg != nil
oPanelImg:nTop := oRect:ntop
oPanelImg:nLeft := oRect:nleft+2
oPanelImg:nwidth := nSplit-2
oPanelImg:nBottom := oBtnPrint:nTop-2
Endif
if oPanelFolder != nil
oPanelFolder:nTop := oRect:ntop
oPanelFolder:nLeft := nSplit+2
oPanelFolder:nwidth := oRect:nWidth-205
oPanelFolder:nBottom := oBtnPrint:nTop-2
Endif
if oSplit != nil
oSplit:Setsize( oSplit:nWidth, oRect:nBottom -40 )
oSplit:Refresh()
Endif
return nil
>
ACTIVATE DIALOG oDlg centered ;
ON INIT ( oPanelImg:= PanelGreen(oDlg,nSplit),;
oPanelFolder:=PanelWhite(oDlg,nSplit),;
BuildSplitter(oPanelImg,oPanelFolder,oDlg,oSplit,nSplit,oBtnPrint),;
Eval(oDlg:bResized ) )
RELEASE FONT oFont, oBold
return nil
//--------------------------------------------------------------------------------------//
Static function PanelGreen(oDlg,nSplit)
local oPanel,oBrushGreen
Local aGradgreen := { Rgb( 225,239,219),Rgb( 225,239,219)}
DEFINE BRUSH oBrushGreen GRADIENT aGradgreen
oPanel:=Tpanel():New( 45, 2, oDlg:nBottom, nSplit, oDlg)
oPanel:SetBrush( oBrushGreen )
oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
return oPanel
//--------------------------------------------------------------------------------------//
Static function PanelWhite(oDlg,nSplit)
local oPanel,oBrushWhite
Local aGradWhite := { Rgb( 245,245,245),Rgb( 245,245,245)}
DEFINE BRUSH oBrushWhite GRADIENT aGradWhite
oPanel:=Tpanel():New( 45, nSplit+2, oDlg:nBottom, oDlg:nWidth-10, oDlg)
oPanel:SetBrush( oBrushWhite )
oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
return oPanel
//------------------------------------------------------------------------//
static Function BuildSplitter(oPanelImg,oPanelFolder,oDlg,oSplit,nSplit,oBtnPrint)
@ 00, nSplit SPLITTER oSplit ;
VERTICAL ;
PREVIOUS CONTROLS oPanelImg ;
HINDS CONTROLS oPanelFolder ;
LEFT MARGIN 2 ;
RIGHT MARGIN 2 ;
SIZE 1, oDlg:nBottom-40 PIXEL ;
OF oDlg ;
_3DLOOK ;
UPDATE STYLE
oSplit:bchange := { ||ResizeDialog(oSplit,oDlg,oBtnPrint,oPanelImg,oPanelFolder,nSplit) }
RETURN NIL
//------------------------------------------------------------------------//
Function ResizeDialog(oSplit,oDlg,oBtnPrint,oPanelImg,oPanelFolder,nSplit)
local oRect := oDlg:GetCliRect()
if oSplit != nil
oSplit:Setsize( oSplit:nWidth, oRect:nHeight-60 )
oSplit:Refresh()
Endif
if oPanelImg != nil
oPanelImg:nTop := oRect:ntop
oPanelImg:nLeft := oRect:nleft+2
oPanelImg:nwidth := nSplit-2
oPanelImg:nBottom := oBtnPrint:nTop-2
Endif
if oPanelFolder != nil
oPanelFolder:nTop := oRect:ntop
oPanelFolder:nLeft := nSplit+2
oPanelFolder:nwidth := oRect:nWidth-205
oPanelFolder:nBottom := oBtnPrint:nTop-2
Endif
RETURN NIL
apparently inserting the creation of the splitter in a function after the creation of the panels could work but when I go to resize the dialog the two panels remain at the same size and are not above the two buttons