static void CretateForm(Args _args)
{
Args args;
Form form;
FormRun formRun;
FormBuildDesign formBuildDesign;
FormBuildDataSource formBuildDataSource;
FormBuildGridControl formBuildGridControl;
FormGridControl formGridControl;
DictTable dictTable;
int idx;
int height;
;
// Create the form header.
form = new Form();
form.name("myForm");
// Add data sources to the form.
dictTable = new DictTable(tableNum(custTable));
formBuildDataSource = form.addDataSource(dictTable.name());
formBuildDataSource.table(dictTable.id());
// Create the form design.
formBuildDesign = form.addDesign('Design');
// Add a grid control.
formBuildGridControl =
formBuildDesign.addControl(FormControlType::Grid,'Grid');
idx = formBuildGridControl.id();
formBuildGridControl.addDataField(formBuildDataSource.id(),
dictTable.fieldName2Id("AccountNum"));
formBuildGridControl.addDataField(formBuildDataSource.id(),
dictTable.fieldName2Id("Phone"));
args = new Args();
args.object(form);
// Create the run-time form.
formRun = classfactory.formRunClass(args);
formRun.run();
formRun.detach();
formGridControl = formRun.control(idx);
formGridControl.heightMode(-1); // Fixed.
height = formGridControl.heightValue(120);
}