Пожалуйста, проверьте код ниже как пример и измените его для ваших нужд
Form myForm;
FormBuildDesign design;
FormBuildControl control;
int cnt = 0;
Set buttonsSet = new Set(Types::Class);
void findButtons(FormBuildControl _buildControl)
{
FormBuildControl buildControl;
int i;
;
if (_buildControl.controlCount() > 0)
{
for (i = 1; i <= _buildControl.controlCount(); i++)
{
buildControl = _buildControl.controlNum(i);
findButtons(buildControl);
}
}
else
{
if (classidget(_buildControl) == classnum(FormBuildButtonControl) ||
classidget(_buildControl) == classnum(FormBuildCommandButtonControl) ||
classidget(_buildControl) == classnum(FormBuildDropDialogButtonControl) ||
classidget(_buildControl) == classnum(FormBuildMenuButtonControl) ||
classidget(_buildControl) == classnum(FormBuildFunctionButtonControl))
{
buttonsSet.add(_buildControl);
}
}
}
;
myForm = formRun.form();
design = myForm.design();
for (cnt = 1; cnt <= design.controlCount(); cnt++)
{
control = design.controlNum(cnt);
findButtons(control);
}
Пример кода для построения дерева управления
TreeItemIdx treeItemIdx;
TreeItemIdx parentItemIdx;
ImageRes imageRoot = imageListAppl_Tutorial.image(#ImageFormButtonGroup);
ImageRes imageRes = imageListAppl_Tutorial.image(#ImageFormButton);
SetEnumerator se;
FormBuildControl buildControl;
;
formTreeControl.deleteAll();
parentItemIdx = SysFormTreeControl::addTreeItem(formTreeControl,
'Buttons',
FormTreeAdd::Root,
'Data on Root',
imageRoot,
true);
SysFormTreeControl::setOverlayImage(formTreeControl, parentItemIdx, imageListAppl_Tutorial.image(#ImageOverlayRedLock));
se = _buttonsSet.getEnumerator();
while (se.moveNext())
{
buildControl = se.current();
treeItemIdx = SysFormTreeControl::addTreeItem(formTreeControl,
buildControl.toString(),
parentItemIdx,
'Data on element 2',
imageRes,
false);
}
SysFormTreeControl::expandTree(formTreeControl, formTreeControl.getRoot(), 1);