Wednesday, March 9, 2011

Create Form Through Job

This is simple code to Create form through job


static void CSL_FormUsingCode(Args _args)
{
    Form                                       form;
    FormRun                                 formRun;
    Args                                        args;
    FormBuildDesign                     formBuildDesign;
    FormBuildControl                    formBuildControl;
    FormBuildTabControl              formBuildTabControl;
    FormBuildTabPageControl      formBuildTabPageControl;
    FormBuildGridControl            formBuildGridControl;
    FormBuildDatasource             formBuildDatasource;
    FormBuildStringControl          formString,formString1;
    ;

    form = new Form();
    formBuildDatasource         = form.addDataSource(tableStr(PurchTable));
    formBuildDesign                = form.addDesign('design');
    formBuildDesign.caption("JIT_testForm");
    formBuildTabControl         = formBuildDesign.addControl(FormControlType::Tab, 'Tab');
    formBuildTabPageControl  = formBuildTabControl.addControl(FormControlType::TabPage,'General');
    formBuildGridControl        = formBuildTabPageControl.addControl(FormControlType::Grid, 'Grid');
    formBuildTabPageControl.caption("General");
    formString                         = formBuildGridControl.addDataField(formBuildDatasource.id(), fieldNum(PurchTable,PurchId));
    formString1                       = formBuildGridControl.addDataField(formBuildDatasource.id(), fieldNum(PurchTable,PurchName));
    formString.label("PurchId");
     args = new Args();
    args.object(form);
    formRun = classFactory.formRunClass(args);
    formRun.init();
    formRun.run();
    formRun.wait();
}



No comments:

Post a Comment