*/ THIS CODE IS IN THE INIT EVENT OF THE FORM. IT DOESN'T WORK WITH THE RESIZE() EVENT-ALTHOUGH IT COULD
*/ THE IDEA IS TO CHANGE THE SIZE IF THE SCREEN RESOLUTION OF THE WORK STATION IS NOT 800x600.
*/ set to maximum screen
_screen.windowstate = 2
*/ calc ratio of screen to 800X600 resolution
lnRatioWidth = sysmetric(1)/800
lnRatioHeight = sysmetric(2)/600
*/ set the form dimensions
this.width = int(this.width*lnRatioWidth)
this.height = int(this.height*lnRatioHeight)
this.left = int((.5*lnwidth)-(.5*this.width))
this.top = int((.5*lnheight)-(.5*this.height))
this.fontsize = int(this.fontsize*lnRatioWidth)
********************************************************************************
*/ this works for simple forms without container objects
*/ take each control and change its size and location
lnCtrlCnt = this.controlcount
i = 1
do while i <= lnCtrlCnt
lcCtrlName = "thisform." + thisform.controls(i).name
thisform.controlchangesize(lcCtrlName, lnRatioWidth, lnRatioHeight)
i = i + 1
enddo
********************************************************************************
********************************************************************************
********************************************************************************
*/ THIS IS FOR A COMPLICATED FORM WITH CONTAINERS AND CONTAINERS WITHIN CONTAINERS
*/ CREATE A TEMP FILE WITH BASECLASS,PARENT,OBJNAME FIELD FROM FORMS .SCX FILE.
*/
*/ THIS WORKS AS LONG AS THE FORM CLASS USED HAS NO CONTAINERS. THE CONTAINERS IN
*/ IN THE FORM CLASS DO NOT CHANGE SIZES.
*/
*/ WHEN I TRY TO CHANGE THE SIZE OF CONTROLS IN THE FORM CLASS I GET AN ERROR MESSAGE-
*/ #1744 "OBJECT CLASS IS INVALID FOR THIS CONTAINER"
*/
*/ I DON'T KNOW WHERE TO START WITH THIS.
select 0
use c:\ic\filetemp again
copy stru to c:\ic\tempclass
use c:\ic\tempclass alias ctrlall
append from forms\FORM.scx
replace all CtrlAll.tclass with CtrlAll.class, CtrlAll.tobjname with CtrlAll.objname, ;
CtrlAll.tparent with CtrlAll.parent, CtrlAll.tbaseclass with CtrlAll.baseclass
*/ takes each control on the form and a changes it sizes
lcBaseClassList = "FORM.GRID.OPTIONGROUP.PAGEFRAME.CONTAINER.COMMANDGROUP.PAGE."+;
"LABEL.TEXTBOX.EDITBOX.COMMANDBUTTON.CHECKBOX.COMBOBOX.LISTBOX.SPINNER.SHAPE"
go top
do while .not. eof("ctrlall")
if not upper(allt(ctrlall.baseclass)) $ lcBaseClassList
skip
loop
else
lcTparent = alltrim(ctrlall.tparent)
if upper(substr(lcTparent,1,11)) = "FRMCUSTOMRS"
lcTparent = "thisform" + iif(not empty(alltrim(substr(lcTparent,12))), ;
alltrim(substr(lcTparent,12)),'')
endif
lcCtrlName = lcTparent + iif(not empty(lcTparent) and ;
right(lcTparent,1)<>'.',".","") + alltrim(ctrlall.tobjname)
thisform.controlchangesize(lcCtrlName, lnRatioWidth, lnRatioHeight)
skip
endif
enddo
use
*/
*************************************************************************************
*****************************************************
*/ THIS IS THE METHOD - CONTROLCHANGESIZE
lparameter lcCtrlName , lnRatioWidth, lnRatioHeight
lcWidth = lcCtrlName+".width"
if type("&lcWidth")<>'U'
&lcWidth. = &lcWidth. * lnRatioWidth
endif
ETC FOR HEIGHT, TOP , LEFT, FONT
*****************************************************