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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 31.10.2013, 06:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
sjakalax: Custom box
Источник: http://sjakalax.blogspot.com/2013/10/custom-box.html
==============

hi all,

Don't know about you, but I've been using the Box class quite often. But sometimes I need a dialog with other options than the ones out-of-the-box Ax provides. Some situations just don't get covered by a Yes/No choice. That's where my CustomBox class kicks in: you get the look and feel of the standard Ax box, but with custom buttons.

It comes with only two public method, so it's pretty simple:
- a public static 'construct' method to create the object
- a public instance 'prompt' method to ... well, to prompt the dialog.

The constructor takes 5 parameters:
- the message/question itself
- a container holding the button labels: for each element in the container a button will be created using the provided label
- an integer indicating which of the elements of the container should be the default button. This one is optional, the first button is the default ... by default
- the title to be used. This one is optional, by default it states 'Microsoft Dynamics' on top of the dialog
- a boolean to make the dialog modal. This one is also optional but 'true' by default.

The prompt method doesn't take any parameters but does make sure to prompt the dialog and that the number of the button that was pressed is returned.

The example below should make the above more clear:

static void CustomBox_TryOut(Args _args)
{
CustomBox box;
int retValue;
;

box = CustomBox::construct("Press one of my buttons",
["I will", "I won't", "Not sure"],

2,
"Pick a button");
info(strFmt("you pressed button %1", box.prompt()));

}

The dialog triggered by the prompt method would look like this:

And the result in the infolog:


Source code of the class and a tryout job bundled in a private project can be downloaded here.

As with the standard Ax Box class, this class is also running on the client. So make sure it's not included in any server side batch or CIL code.

Enjoy!

Источник: http://sjakalax.blogspot.com/2013/10/custom-box.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: AX for Retail 2012 R2: Adding a Custom User Control to the POS Blog bot DAX Blogs 0 27.02.2013 07:14
emeadaxsupport: AX for Retail 2012 R2: Working with Custom Fields for Receipts Blog bot DAX Blogs 0 16.02.2013 23:12
sumitsaxfactor: Create Your First Custom Service [AX 2012] Blog bot DAX Blogs 0 19.05.2012 19:14
Microsoft Dynamics CRM Team Blog: How to control surfacing of Custom Activity Blog bot Dynamics CRM: Blogs 0 17.05.2011 01:14
Microsoft Dynamics CRM Team Blog: Convergence 2011 Concept Box Invitation Blog bot Dynamics CRM: Blogs 0 16.03.2011 19:11
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:10.