I have a folder on this dialog
I have a buttonbar at the bottom of odlg
I would like to make the dialog smaller when the end user selects tab number 3 and tab number 6
I made a small test
Problem is when press folder tab the dialog is resized but sometimes the oBar is hided or became smaller
and then I often notice a flutter, i.e. the dialog trembles
- Code: Select all Expand view RUN
- #include "FiveWin.ch"
#include "Constant.ch"
#define DEF_COLOR1 nRgb( 245,244,234)
#define DEF_COLOR2 nRgb(233,229,206)
#define DEF_COLOR3 RGB( 238,236,219 )
#define DEF_COLOR4 nRgb(218,214,179)
Function Test()
local oDlg,oFld,oFont,oBold
local aBtnBar:=array(2)
local aFolder := {"Menu1","Menu2","Menu3","Menu4","Menu5","Menu6"}
local aCooDlg := {0,0}
local nBottom:= 41
local nRight := 94.6
local nHt := nBottom * DLG_CHARPIX_H
local nWd := Max( nRight * DLG_CHARPIX_W, 180 )
aCooDlg[1]:=nWd
aCooDlg[2]:=nHt
oFont := TFont():New( "TAHOMA", 0, 18,, )
oBold := TFont():New( "TAHOMA", 0, 14,,.t. )
DEFINE DIALOG oDlg SIZE aCooDlg[1], aCooDlg[2] PIXEL TRUEPIXEL;
FONT oFont title "test folder" COLOR CLR_BLACK, RGB( 245,245,235) ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MINIMIZEBOX)
DEFINE BUTTONBAR oBar OF oDlg SIZE 80,70 BOTTOM NOBORDER 2010
DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "Nuovo" RESOURCE "NEW_REC" ;
ACTION NIL
DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modifica" RESOURCE "MOD_REC" ;
ACTION NIL GROUP
@0,0 FOLDEREX oFld PROMPTS aFolder ;
SIZE oDlg:nWidth,oDlg:nHeight-oBar:nheight PIXEL ;
FONT oFont ;
COLOR nRgb( 245,244,234) ROUND 0
oFld:bAction:= { || change_size(oFld:nOption,aCooDlg,oDlg,oFld,oBar) }
oDlg:bResized := <||
local oRect := oDlg:GetCliRect()
oFld:nbottom := oRect:nBottom-40
RETURN nil
>
ACTIVATE DIALOG oDlg CENTER ;
ON INIT (oDlg:resize(), ChangeButtons( oBar ) )
RETURN NIL
Function change_size(n,aCooDlg,oDlg,oFld,obar)
local nBottom,nHt
Do case
case n= 3
nBottom:= 32.4
nHt := nBottom * DLG_CHARPIX_H
case n= 6
nBottom:= 22
nHt := nBottom * DLG_CHARPIX_H
OTHERWISE
nHt := aCooDlg[2]
endcase
oDlg:setsize( aCooDlg[1],nHt)
eval( oDlg:bResized )
RETURN NIL
//------------------------------------------------------------------------//
function ChangeButtons( oBar )
AEval( oBar:aControls, { | oCtrl | oCtrl:nTop += 4, oCtrl:nHeight -= 4 } )
return .T.
//----------------------------------------------//