Рисайзинг формы.
* Рекурсивный метод изменения размеров
* элементов формы. Количество элементов
* на форме и уровень вложенности объектов -
* неограничено.
* Кроме этого метода на форму необходимо
* поместить:
* Свойства: amas[1,1] - массив, для первонач.размеров
* всех элементов формы
* nkolm - фактическая его размерность
* FIRSTHEIGHT - первоначальные
* FIRSTWIDTH размеры формы
* nkofh - коэффициенты высоты
* nkofw и длины изменения
*
* nb1 - переменные для
* nb2 панимуляции с Fontsize
*
* ndelta - текущее смещение значения Fontsize
*
* В метод Init поместить:
THISFORM.firstheight=THISFORM.height
THISFORM.firstwidth=THISFORM.width
THISFORM.nkolm = 0
THISFORM.ndelta = 0
THISFORM.recurs (THISFORM,.F.)
* И в Resize :
THISFORM.nkofh = THISFORM.HEIGHT/THISFORM.FIRSTHEIGHT
THISFORM.nkofw = THISFORM.WIDTH/THISFORM.FIRSTWIDTH
thisform.nkolm = 0
THISFORM.nb1 = 0
THISFORM.nb2 = 1
THISFORM.recurs(THISFORM,.t.)
if (THISFORM.nb2 > 0 and THISFORM.ndelta > 0);
or (THISFORM.nb1 > 0)
THISFORM.ndelta = THISFORM.ndelta + THISFORM.nb1
THISFORM.ndelta = THISFORM.ndelta - THISFORM.nb2
endif
*
* и все...
*
Метод : Recurs
lparameters oObj, lP
LOCAL nTotMem,i,aMems[1],m1
m1 = 7
WITH oObj
if thisform.name # .name or thisform.baseclass # .baseclass
if type("oObj.top") = "N" or type("oObj.height") = "N";
or type("oObj.left") = "N" or type("oObj.width") = "N";
or type("oObj.fontsize") = "N"
thisform.nkolm = thisform.nkolm + 1
if !lP
dimension thisform.amas[thisform.nkolm,m1]
if type("oObj.top") = "N"
thisform.amas[thisform.nkolm,1] =oObj.top
endif
if type("oObj.height") = "N"
thisform.amas[thisform.nkolm,2] = oObj.height
endif
if type("oObj.left") = "N"
thisform.amas[thisform.nkolm,3] = oObj.left
endif
if type("oObj.width") = "N"
thisform.amas[thisform.nkolm,4] = oObj.width
endif
if type("oObj.headerheight") = "N"
thisform.amas[thisform.nkolm,5] =oObj.headerheight
endif
if type("oObj.rowheight") = "N"
thisform.amas[thisform.nkolm,6] = oObj.rowheight
endif
if type("oObj.fontsize") = "N"
thisform.amas[thisform.nkolm,7] =oObj.fontsize
endif
else
if type("oObj.top") = "N"
oObj.top = thisform.amas[thisform.nkolm,1]*THISFORM.nkofh
endif
if type("oObj.height") = "N"
oObj.height = thisform.amas[thisform.nkolm,2]*THISFORM.nkofh
endif
if type("oObj.left") = "N"
oObj.left = thisform.amas[thisform.nkolm,3]*THISFORM.nkofw
endif
if type("oObj.fontsize") = "N"
if (thisform.amas[thisform.nkolm,7]*THISFORM.nkofh)-THISFORM.ndelta > 4
oObj.fontsize = (thisform.amas[thisform.nkolm,7]*THISFORM.nkofh)-THISFORM.ndelta
else
oObj.fontsize = 4
THISFORM.ndelta = THISFORM.ndelta - 1
endif
endif
if type("oObj.width") = "N"
if (oObj.baseclass ="Label" and !.wordwrap);
or oObj.baseclass ="Checkbox"
if (TXTWIDTH(oObj.caption,oObj.fontname,oObj.fontsize))*;
FONTMETRIC(6,oObj.fontname,oObj.fontsize) > oObj.width
THISFORM.nb1 = 1
THISFORM.nb2 = 0
endif
if (TXTWIDTH(oObj.caption,oObj.fontname,oObj.fontsize+1))*;
FONTMETRIC(6,oObj.fontname,oObj.fontsize+1) > oObj.width
THISFORM.nb2 = 0
endif
endif
oObj.width = thisform.amas[thisform.nkolm,4]*THISFORM.nkofw
endif
if type("oObj.headerheight") = "N"
oObj.headerheight = thisform.amas[thisform.nkolm,5]*THISFORM.nkofh
endif
if type("oObj.rowheight") = "N"
oObj.rowheight = thisform.amas[thisform.nkolm,6]*THISFORM.nkofh
endif
endif
endif
endif
nTotMem = AMEMBERS(aMems,oObj,2)
FOR i = 1 TO m.nTotMem
oObj = EVAL("."+aMems[m.i])
IF TYPE("."+aMems[m.i]) = "O"
thisform.recurs(oObj,lP)
ENDIF
ENDFOR
ENDWITH