17.01.2014, 11:11 | #1 |
Участник
|
How to change Batch caption dialog field in run time. RunBaseBatch sample
Источник: http://alexvoy.blogspot.com/2014/01/...on-dialog.html
============== <div dir="ltr" style="text-align: left;" trbidi="on">This is an example of a RunBaseBatch class that demonstrates how to change another dialog fields in run time. Let's say we have a parameter of enum type, which selects the right business logic inside of Run method. It is a good idea to change the main static text of the dialog as well as the batch caption that serves as a description for an eventual batch job (and tasks). After adding this field in Dialog method we need to override Modified method for this field. protected Object dialog() { FormComboBoxControl combobox; dlg = super(); dialogEventType = dlg.addFieldValue(EnumStr(uapInterfaceEventType), eventType ); // to add details to the caption and task description in batch tasks dialogEventType.registerOverrideMethod(methodstr(FormStringControl, modified), methodstr(tmxRunBaseBatchSample, eventType_modified), this); // to avoid user input in the field combobox = dialogEventType.control(); combobox.comboType(1); return dlg; } In eventType_modified method we call two additional methods to apply the user input respectively for BatchCaption and MainInstruction fields. private boolean eventType_modified(FormStringControl _control) { boolean ret = _control.modified(); if(ret) { this.setBatchCaption(); this.setMainInstruction(); } return ret; } To get access to these dialog fields we use two different approaches. We find BatchCaption form control recursively inside of batch tab page based on its type. private void setBatchCaption() { FormStringControl batchCaptionControl; // to get the batch caption control; any of them if many batchCaptionControl = this.getBatchCaptionControl(dlg); if (batchCaptionControl) { batchCaptionControl.text(this.caption()); } } // returns the batch caption form control if any in the dialog private FormStringControl getBatchCaptionControl(DialogRunbase _dialog) { FormStringControl batchCaptionControl; // recursive routine to look for the right form control of BatchCaption EDT Object findBatchCaptionControl(Object _parentObject) { int i; Object childControl; Object foundControl; for (i = 1; i
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|