Salı, Haziran 29, 2010

Create Form with X++

static void CreateForm()
{
Form form = new Form();
FormBuildDataSource fbds;
FormBuildDesign fbd;
FormBuildGridControl fgc;
FormBuildStringControl fsc;

FormRun fr;
str FormName;
args args = new ARgs();
;
//create design
fbd = form.addDesign("mydesign");
fbd.caption("AGC_InventParameters");
//info("Create Design");

//create datasource
fbds = form.addDataSource("myTable");
fbds.table(tablenum(AGC_InventParameters));
//info ("Create Design");


//add GridControl
fgc = fbd.addControl(FormControlType::Grid, "mygrid");
fgc.dataSource(fbds.name());
//info ("Add grid Control");

//add StringControl to Grid

//Kodu
fsc = fgc.addControl(FormControlType::String,"StringEdit1");
fsc.dataSource('AGC_InventParameters' );
fsc.dataField(fieldnuM(AGC_InventParameters, Kodu));
fsc.label("Kodu");
//Adi
fsc = fgc.addControl(FormControlType::String,"StringEdit2");
fsc.dataSource('AGC_InventParameters' );
fsc.dataField(fieldnuM(AGC_InventParameters, Adi));
fsc.label("Adi");
//EDT_Tipi
fsc = fgc.addControl(FormControlType::String,"StringEdit3");
fsc.dataSource('AGC_InventParameters' );
fsc.dataField(fieldnuM(AGC_InventParameters, EDT_tipi));
fsc.label("EDT_tipi");
//Yeni_EDT
fsc = fgc.addControl(FormControlType::String,"StringEdit4");
fsc.dataSource('AGC_InventParameters' );
fsc.dataField(fieldnuM(AGC_InventParameters, Yeni_EDT));
fsc.label("Yeni_EDT");
//Genişlik
fsc = fgc.addControl(FormControlType::String,"StringEdit5");
fsc.dataSource('AGC_InventParameters' );
fsc.dataField(fieldnuM(AGC_InventParameters, Genislik));
fsc.label("Genislik");


FormName = fsc.name("NEW");
//info (" Form " +FormName+ "olusturuldu");


//Open Form
args.object(form);
fr = new FormRun(args);
fr.run();
fr.wait();

}

Hiç yorum yok:

Yorum Gönder