23.12.2008, 20:24 | #1 |
Участник
|
Как програмно поймать клик на кнопке ?
Есть такой код Job :
X++: static void ag_createFormControl(Args _args) { Args args; Form form; FormRun formRun; FormBuildDesign formBuildDesign; FormBuildDataSource formBuildDataSource; FormBuildGridControl formBuildGridControl; FormBuildStringControl formBuildStringControl; FormStringControl formStringControl; FormGridControl formGridControl; formBuildCommandButtonControl formBuildCommandButtonControl; formButtoncontrol formbuttoncontrol; DictTable dictTable; int idx; int idx2; int idx3; ; // Create the form header. form = new Form(); // 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 controls. formBuildGridControl = formBuildDesign.addControl(FormControlType::Grid, "Table Grid"); formBuildGridControl.dataSource(dictTable.name()); idx = formBuildGridControl.id(); formBuildStringControl = formBuildDesign.addControl(FormControlType::String, "Table String"); formBuildStringControl.dataSource(dictTable.name()); idx2 = formBuildStringControl.id(); formbuildcommandbuttoncontrol=formbuilddesign.addControl(formcontroltype::CommandButton,"OK"); formbuildcommandbuttoncontrol.text('&OK'); idx3=formbuildcommandbuttoncontrol.id(); // Add data fields to the controls. formBuildGridControl.addDataField(formBuildDataSource.id(), dictTable.fieldName2Id("AccountNum")); formBuildGridControl.addDataField(formBuildDataSource.id(), dictTable.fieldName2Id("Phone")); formBuildStringControl.dataSource(formBuildDataSource.id()); formBuildStringControl.dataField(1); args = new Args(); args.object(form); // Create the run-time form. formRun = new FormRun(args); formRun.run(); //------------------------------------------------------------------- // formrun.controlMethodOverloadObject(formbuttoncontrol); // formbuttoncontrol=new formbuttoncontrol(); // formbuttoncontrol=formrun.controlMethodOverloadObject(formbuttoncontrol); // formbuttoncontrol=formrun.controlCallingMethod(); formButtonControl = formRun.control(idx3); formbuttoncontrol.clicked(); //------------------------------------------------------------------ formRun.detach(); // Select the grid control. formGridControl = formRun.control(idx); formGridControl = formRun.selectTarget(formGridControl); formGridControl.showColLabels(false); } |
|