AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 18.09.2012, 18:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
ax-erp: How to override the event methods on dialog controls?
Источник: http://microsoft-dynamics-ax-erp.blo...on-dialog.html
==============


Overriding the event methods (e.g. modify, validate, selectionChange) on dialog controls is not as straight forward as it is on form controls, but the good news is that it is possible!
In order to override the event methods on dialog controls, the following needs to be done (for simplicity we assume that your class extends RunBase class) :
1) The method dialogPostRun() should be overridden and following two lines are added after the super() call:
_dialog.dialogForm().formRun().controlMethodOverload(true);
_dialog.dialogForm().formRun().controlMethodOverloadObject(this);

This will allow to call the event methods of your class.


2) The actual event methods should be added.

The format of the event method name is as follows: fld_1_

Please see the example below.

This method is called whenever a value of the dialog control with ID 900 is modified. In our case it is Employee ID field.

public boolean fld900_1_modified()

{
FormStringControl control = dialog.formRun().controlCallingMethod();

boolean isFieldModified;
;

isFieldModified = control.modified();
// every time the employee id is changed, update the employee name
if(isFieldModified)
{
dlgFldEmplName.value(EmplTable::find(control.text()).Name);
}

return isFieldModified;
}

You will also need to make sure that the control “Employee ID” gets the same control ID as used in the event method name (ID 900). This should be done at the time of adding the control to the dialog. Please see below:
protected Object dialog(DialogRunbase _dialog, boolean _forceOnClient)
{
;
dialog = super(_dialog, _forceOnClient);

// Add a new field by explicitly specifying the field id.
// This field id is used to create the field event methods (e.g. fld900_1_modified()).

dlgFldEmplId = new DialogField(dialog, typeid(EmplId), #dlgFlgEmplIdFieldNo);
dialog.addCtrlDialogField(dlgFldEmplId.name());

dlgFldEmplId.init(dialog);
dlgFldEmplId.label("@SYS81251");
dlgFldEmplId.helpText("@SYS81251");
dlgFldEmplId.value(emplId);


}

As you can see the macro #dlgFlgEmplIdFieldNo is used to assign the ID to the dialog control. The macro is defined in the classDeclaration and it equals 900.



Источник: http://microsoft-dynamics-ax-erp.blo...on-dialog.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ax-erp: Processing Business Tasks - Building a Display dimensions dialog Blog bot DAX Blogs 0 13.07.2012 16:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
Dynamics AX FAQ: How to override the event methods on dialog controls? Blog bot DAX Blogs 0 18.06.2008 20:05
Dynamics AX FAQ: How to override the event methods on dialog controls? Blog bot DAX Blogs 0 23.04.2008 04:16

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 09:06.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.