the second combobox only changes a get for a btnbmp
the problem is that the procedure recreates the dialog elsewhere and if you use oDlg:center() it puts it back in the center
but a flash is visible, many times you see the dialog in the left corner and then in the center .
apparently nothing happens if there is only the combobox in the dialog, if there are the other controls (about 20) you have the perception of the flash
I haven't found any solutions
a small sample
- Code: Select all Expand view RUN
- #include "FiveWin.ch"
#include "Constant.ch"
Function Test()
local oModulo
local oBar
local nBottomDlg := 22
local nRightDlg := 89
local nWd := Max( nRightDlg * DLG_CHARPIX_W, 180 )
local nHt := nBottomDlg * DLG_CHARPIX_H
local aElemento :={"opzione1","opzione2","opzione3" }
local aTipoDATA :={"dato1","dato2" }
local atext :={"opzione1","opzione2","opzione3" }
local cText := "opzione1"
local cType:="opzione1"
local cFieldValue:="dato1"
local cDesc:=space(100)
local nRow:= 0,nCol:= 10
local nInterlinea := 30
local oFont := TFont():New( "Tahoma", 0, -12,, )
local oBold := TFont():New( "Tahoma", 0, -12,,.t. )
local aGet:=array(20)
local oSay:=array(20)
local oBtnSel:=array(10)
local oMenu:=array(6)
local oLine:=array(10)
local aMenu:= {"test1","test2","test3","test4","test5","test6"}
local nTop,nLeft,nWidth,nHeight
LOCAL lcheck1:=.f.,lCheck2
DEFINE DIALOG oModulo SIZE nWd, nHt PIXEL TRUEPIXEL;
FONT oFont TiTle "test" COLOR CLR_BLACK, RGB( 245,245,235) ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MINIMIZEBOX)
DEFINE BUTTONBAR oBar OF oModulo SIZE 70,70 2015 BOTTOM NOBORDER
oBar:bClrGrad := { | lPressed | If( ! lPressed,;
{ { 1, RGB( 250,250,245),RGB( 250,250,245)} },;
{ { 1, RGB( 245,245,235 ), RGB( 245,245,235 )} } ) }
nRow+=8
@ nRow, 5 SAY oSay[1] PROMPT "Tipo Elemento : " SIZE 80,14 PIXEL OF oModulo TRANSPARENT FONT oBold
@ nRow, 120 COMBOBOX aGet[1] VAR cType ITEMS aElemento SIZE 150,90 PIXEL OF oModulo ;
ON CHANGE (Change_Field_Value( aGet,oBtnSel,oSay,oLine,oMenu),;
Change_Dialog(aGet,oModulo),;
EVAL( oModulo:bResized))
nRow+=nInterlinea
@ nRow, 5 SAY oSay[3] PROMPT "Tipo Dato " SIZE 80,14 PIXEL OF oModulo TRANSPARENT FONT oBold
nRow-=2
@ nRow, 120 COMBOBOX aGet[3] VAR cFieldValue ITEMS aTipoDATA SIZE 120,90 PIXEL OF oModulo ;
ON CHANGE (Change_Field_Value( aGet,oBtnSel,oSay,oLine,oMenu),;
EVAL( oModulo:bResized))
@ nRow,241 BTNBMP aGet[4] OF oModulo;
PROMPT space(200) ;
SIZE 350, 23 PIXEL FLAT NOROUND
aGet[4]:bClrGrad := { | lPressed | If( ! lPressed,;
{ { 1, RGB( 250,250,245),RGB( 250,250,245)} },;
{ { 1, RGB( 245,245,235 ), RGB( 245,245,235 )} } ) }
aGet[4]:nClrBorder := RGB(195,195,185)
aGet[4]:DISABLE()
@ nRow, 250 GET aGet[5] VAR cDesc MEMO SIZE 390,49 PIXEL OF oModulo UPDATE
oModulo:bResized := <||
local oRect := oModulo:GetCliRect()
local ntipo:=aGet[1]:nAt
aGet[4]:nTop := oRect:nTop+34 //desc btnbmp
aGet[4]:nLeft := oRect:nLeft+250
aGet[4]:nWidth := oRect:nWidth-340
aGet[5]:nTop := oRect:nTop+34 //desc
aGet[5]:nLeft := oRect:nLeft+250
aGet[5]:nWidth := oRect:nWidth-260
return nil
>
ACTIVATE DIALOG oModulo CENTERED ;
ON INIT ( oModulo:resize() ,;
ChangeButtons(oBar ) ,;
Change_Field_Value( aGet,oBtnSel,oSay,oLine,oMenu),;
Change_Dialog(aGet,oModulo))
RETURN NIL
//--------------------------------------------------------------------//
Static Function Change_Field_Value( aGet,oBtnSel,oSay,oLine,oMenu)
local nTipo:=aGet[1]:nAt
local nDato:=aGet[3]:nAt
Do case
case ndato= 1
IF nTipo = 1
aGet[4]:show() //desc
aGet[5]:hide() //desc
elseIF nTipo = 2
aGet[4]:show() //desc
aGet[5]:hide() //desc
elseIF nTipo = 3
aGet[4]:show() //desc
aGet[5]:hide() //desc
Endif
case ndato= 2 //Value
IF nTipo = 1
aGet[4]:hide() //desc
aGet[5]:show() //desc
elseIF nTipo = 2
aGet[4]:show() //desc
aGet[5]:hide() //desc
elseIF nTipo = 3
aGet[4]:hide() //desc
aGet[5]:show() //desc
Endif
Endcase
aGet[4]:refresh() //desc
aGet[5]:refresh() //desc
RETURN NIL
//----------------------------------------------------------------//
//-----------------------------------------------------------------//
Static Function Change_Dialog(aGet,oDlg)
local nTipo:=aGet[1]:nAt
local nBottomDlg
local nRightDlg
local nWd
local nHt
Do case
case nTipo = 1
nBottomDlg := 24
nRightDlg := 89
case nTipo = 2
nBottomDlg := 20
nRightDlg := 89
case nTipo = 3
nBottomDlg := 24
nRightDlg := 89
endcase
nWd := Max( nRightDlg * DLG_CHARPIX_W, 180 )
nHt := nBottomDlg * DLG_CHARPIX_H
oDlg:setSize(nWd,nHt)
oDlg:center()
sysrefresh()
return nil
//--------------------------------------------------------------//
function ChangeButtons( oBar )
AEval( oBar:aControls, { | oCtrl | oCtrl:nTop += 4, oCtrl:nHeight -= 4 } )
return .T.
//--------------------------------------------------------------/