static void createFormPk()
{
Args args;
Form form;
FormRun formRun;
FormBuildDesign fbDesign;
FormBuildDataSource fbDS;
FormBuildGridControl fbGrid;
FormBuildStringControl fbStr1;
FormBuildStringControl fbStr2;
FormBuildTabControl fbTab;
FormBuildTabPageControl fbTabPage1;
FormBuildTabPageControl fbTabPage2;
DictTable dictTable;
int idx, idx2, idx3;
FormControlType fctTabPage = FormControlType::TabPage;
FormControlType fctTab = FormControlType::Tab;
FormControlType fctGrid = FormControlType::Grid;
FormControlType fctString = FormControlType::String;
// Create the form header.
form = new Form();
// Add a data source to the form.
dictTable = new DictTable(tablenum(CustTable));
fbDS = form.addDataSource(dictTable.name());
fbDS.table(dictTable.id());
// Create the form design.
fbDesign = form.addDesign("Design");
fbDesign.caption("Customer information Pk");
// Add tab
fbTab = fbDesign.addControl(fctTab, "Overview");
// Add tab pages
fbTabPage1 = fbTab.addControl(fctTabPage, "Overview");
fbTabPage1.caption("Overview");
fbTabPage2 = fbTab.addControl(fctTabPage,"General");
fbTabPage2.caption("General");
// Add grid onto tab 1 and data fields onto grid.
fbGrid = fbTabPage1.addControl(fctGrid,"Table Grid");
fbGrid.addDataField(fbDS.id(),
dictTable.fieldName2Id("AccountNum"));
fbGrid.addDataField(fbDS.id(),
dictTable.fieldName2Id("CustGroup"));
fbGrid.addDataField(fbDS.id(),
dictTable.fieldName2Id("Currency"));
// Add string fields to tab 2, and assign datasource
fbStr1 = fbTabPage2.addControl(fctString,"String 1");
fbStr1.dataSource(fbDS.id());
fbStr1.dataField(dictTable.fieldName2Id("AccountNum"));
fbStr2 = fbTabPage2.addControl(fctString,"String 2");
fbStr2.dataSource(fbDS.id());
fbStr2.dataField(dictTable.fieldName2Id("CustGroup"));
// Create the run-time form.
args = new Args();
args.object(form);
formRun = classfactory.formRunClass(args);
formRun.run();
formRun.detach();
}
{
Args args;
Form form;
FormRun formRun;
FormBuildDesign fbDesign;
FormBuildDataSource fbDS;
FormBuildGridControl fbGrid;
FormBuildStringControl fbStr1;
FormBuildStringControl fbStr2;
FormBuildTabControl fbTab;
FormBuildTabPageControl fbTabPage1;
FormBuildTabPageControl fbTabPage2;
DictTable dictTable;
int idx, idx2, idx3;
FormControlType fctTabPage = FormControlType::TabPage;
FormControlType fctTab = FormControlType::Tab;
FormControlType fctGrid = FormControlType::Grid;
FormControlType fctString = FormControlType::String;
// Create the form header.
form = new Form();
// Add a data source to the form.
dictTable = new DictTable(tablenum(CustTable));
fbDS = form.addDataSource(dictTable.name());
fbDS.table(dictTable.id());
// Create the form design.
fbDesign = form.addDesign("Design");
fbDesign.caption("Customer information Pk");
// Add tab
fbTab = fbDesign.addControl(fctTab, "Overview");
// Add tab pages
fbTabPage1 = fbTab.addControl(fctTabPage, "Overview");
fbTabPage1.caption("Overview");
fbTabPage2 = fbTab.addControl(fctTabPage,"General");
fbTabPage2.caption("General");
// Add grid onto tab 1 and data fields onto grid.
fbGrid = fbTabPage1.addControl(fctGrid,"Table Grid");
fbGrid.addDataField(fbDS.id(),
dictTable.fieldName2Id("AccountNum"));
fbGrid.addDataField(fbDS.id(),
dictTable.fieldName2Id("CustGroup"));
fbGrid.addDataField(fbDS.id(),
dictTable.fieldName2Id("Currency"));
// Add string fields to tab 2, and assign datasource
fbStr1 = fbTabPage2.addControl(fctString,"String 1");
fbStr1.dataSource(fbDS.id());
fbStr1.dataField(dictTable.fieldName2Id("AccountNum"));
fbStr2 = fbTabPage2.addControl(fctString,"String 2");
fbStr2.dataSource(fbDS.id());
fbStr2.dataField(dictTable.fieldName2Id("CustGroup"));
// Create the run-time form.
args = new Args();
args.object(form);
formRun = classfactory.formRunClass(args);
formRun.run();
formRun.detach();
}
No comments:
Post a Comment