When in a dialog an object tgroup is present , next code doesn't work properly ( a BUG ???)
When the dialog appears , the other controls (tget , button) are not visible , unless TAB is pressed
Closing the dialog gives also errors .
Code: Select all
#include "FiveWin.ch"
function Main(cNum)
local oDlg, nTest := 1, oIcon
DEFAULT cNum := "1"
DEFINE ICON oIcon RESOURCE "test"
DEFINE DIALOG oDlg RESOURCE "Test" ICON oIcon
REDEFINE GET nTest ID 101 SPINNER
REDEFINE BUTTON ID 200 ACTION olg:end()
REDEFINE BUTTON ID 210 ACTION olg:end()
REDEFINE GROUP ID 2 OF oDlg
ACTIVATE DIALOG oDlg CENTERED ON INIT ResizeDlg(oDlg , VAL(cNum))
return nil
********************************************************************************
PROC ResizeDlg(oDlg , F)
*********************
LOCAL aHlp[5] , lNewFont := .T. , NewFontH , oFont , oCtl
DEFAULT F := {2 , 2}
IF VALTYPE(f) == "N"
f := {f,f}
END
WITH OBJECT oDlg
aHlp[1] := :nTop // nTop
aHlp[2] := :nLeft // nLeft
aHlp[3] := :nWidth()*F[1] // nWidth
aHlp[4] := :nHeight()*F[2] // nHeight
:Move( aHlp[1] , aHlp[2] , aHlp[3] , aHlp[4] , .T. )
FOR EACH oCtl IN oDlg:aControls
aHlp[1] := oCtl:nTop*F[2] // nTop
aHlp[2] := oCtl:nLeft*F[1] // nLeft
aHlp[3] := oCtl:nWidth*F[1] // nWidth
aHlp[4] := oCtl:nHeight*F[2] // nHeight
oCtl:Move( aHlp[1] , aHlp[2] , aHlp[3] , aHlp[4] , .T. )
lNewFont := (oCtl:ClassName <> "TGROUP")
IF lNewFont
NewFontH := ROUND(oCtl:oFont:nHeight*F[2],0)
oFont := oClone(oCtl:oFont)
cFaceName := oFont:cFaceName
oFont:end()
DEFINE FONT oFont NAME cFaceName SIZE 0, -NewFontH
oCtl:SetFont(ofont)
oCtl:refresh()
END
NEXT
END
IF oDlg:lCentered
oDlg:center()
END
RETURN
#include "winapi.ch"
//#include "..\include\winapi.ch"
test ICON "..\icons\fivewin.ico"
TEST DIALOG 61, 39, 194, 139
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Testing Spinners"
FONT 8, "Tahoma"
{
EDITTEXT 101, 44, 25, 106, 15, WS_BORDER | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK", 200 , 42, 96, 50, 14
PUSHBUTTON "Cancel", 210 , 102, 96, 50, 14
GROUPBOX "Box", 2, 30 , 10, 150, 120 , BS_GROUPBOX | BS_LEFTTEXT
}