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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 13.05.2011, 12:25   #1  
Katuxa is offline
Katuxa
Участник
 
36 / 10 (1) +
Регистрация: 13.05.2011
Модальные диалоговые окна
Всем добрый день!
Помогите плиз решить одну проблемку в Аксапте.
Есть форма, с нее по кнопке вызывается диалоговое окно и нужно чтобы на первой форме ничего нельзя было редактировать. Сделала следующим образом:
В методе Dialog в классе указала:
dialog.windowType(FormWindowType::PopUp);
И в методе Clicked() кнопки, при помощи которой вызывается диалоговое окно, сделала все элементы неактивными:
X++:
 int ctrlCount, i;
    ;
    super();
    ctrlCount = element.design().controlCount();
    for (i = 1; i <= ctrlCount; i++)
    {
       element.design().controlNum(i).enabled(false);
    }
Когда диалоговое окно открыто работает все классно, но если его закрыть все контролы так и остаются недоступными. Может кто знает как это решить? Может есть какой-то другой способ решения такого вопроса.
PS это в аксапта 2009.
Старый 13.05.2011, 12:51   #2  
MikeR is offline
MikeR
MCT
Аватар для MikeR
MCBMSS
Лучший по профессии 2015
Лучший по профессии 2014
 
1,628 / 627 (24) +++++++
Регистрация: 28.11.2005
Адрес: просто землянин
Думаю, что форму открываете через FormRun.
Тогда надо делать refresh()
X++:
            if (FormRun.closed())
{
   //обновление источника данных
}
__________________
Axapta book for developer
Старый 13.05.2011, 12:59   #3  
Katuxa is offline
Katuxa
Участник
 
36 / 10 (1) +
Регистрация: 13.05.2011
Закрытие формы
Если вы под формой подразумеваете диалоговое окно, то не совсем понятно где мне это писать, т.к. у меня диалоговое окно вызывается в классе, формы нет.
Старый 13.05.2011, 13:47   #4  
MikeR is offline
MikeR
MCT
Аватар для MikeR
MCBMSS
Лучший по профессии 2015
Лучший по профессии 2014
 
1,628 / 627 (24) +++++++
Регистрация: 28.11.2005
Адрес: просто землянин
Там же есть методы


X++:
    if (dialog.run()){
        dialog.close();
   }
Dialog это обертка над FormRun
__________________
Axapta book for developer
Старый 13.05.2011, 14:19   #6  
Katuxa is offline
Katuxa
Участник
 
36 / 10 (1) +
Регистрация: 13.05.2011
К сожалению Blogger в данный момент недоступен .
Старый 13.05.2011, 15:06   #7  
rDenis2 is offline
rDenis2
Участник
 
62 / 36 (2) +++
Регистрация: 13.05.2010
Я делал так. Из родительской формы вызывался диалог

X++:
void runPassFailDialog()
{
    Args            args;
    FormRun         formRun;
    ;

    args = new Args();
    args.caller(this);

    formRun = new MenuFunction(menuitemdisplaystr(SMAPassFailDialog), MenuItemType::Display).create(args);

    formRun.run();
    //Make form modal
    formRun.wait(true);
}
За это сообщение автора поблагодарили: Dreadlock (4).
Старый 13.05.2011, 15:08   #8  
kashperuk is offline
kashperuk
Участник
Аватар для kashperuk
MCBMSS
Соотечественники
Сотрудники Microsoft Dynamics
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии 2011
Лучший по профессии 2009
 
4,361 / 2084 (78) +++++++++
Регистрация: 30.05.2004
Адрес: Atlanta, GA, USA
Цитата:
Сообщение от Katuxa Посмотреть сообщение
К сожалению Blogger в данный момент недоступен .
Читать вроде можно.

Цитата:
This Blog Linked From Here Related links (DAX blogs, communities, etc)
This Blog
Linked From Here
.Related links (DAX blogs, communities, etc)
.

Monday, June 25, 2007
3 Dialog extensions
Performing one of the modifications on the project I am currently working on, I had to modify the behavior of one of the basic classes using the RunBase framework.

Anyway, what I needed to do was:


1.Override the basic lookup for a specific control on the dialog.

2.Prevent user interaction with other forms until the dialog is closed.
3.Make some of the controls in the dialog mandatory.
Well, the perfect solution here would be to create a Form, and use it as the dialog.
But the code was very highly customized, so it would be a hard job.
So I decided to go another way, using what I have on hand, and that is the Dialog class.
For that, I needed a couple of modifications to the Dialog class, as it does not allow any of the 3 features I neded.

But what any developer should clearly understand when using dialogs is - this is just another form. Simple as that - Dialog is just another AOT form. What this means is that with a dialog we can do all the things we can do with a form.
Also, which is very nice and I thank DAX Developers for that, RunBase framework uses DialogRunBase class for showing forms, and this class is extending from class Dialog, so changes made to Dialog will also be available in RunBase framework.

Here is a small explanation of what has been modified:

•Added a class Dialog variable showModal, which controls the modal state of the used dialog.
•Added a parm method to set the value of the showModal variable. So, basically, to make a modal dialog you simply have to call this method passing true as the parameter.

•Added a method SetFormModal, which actually does all the enabling/disabling of windows (DAX 3.0 only, as DAX 4.0 already has built-in modal forms)
•Modified runOnClient() method to allow server dialogs to run modal as well
•Modified wait() method, which calls SetFormModal method (DAX 3.0 only)
•AddField and AddFieldd modified to allow specifying a specific name for a control.
•DialogField class was modified to allow setting the mandatory property (mandatory(), unpack() methods) and specifying a specific name for a control (new and fieldname methods)
The project contains 4 objects:

•Class\Dialog - only modified methods

•Class\DialogField - only modified methods
•Class\Tutorial_RunBaseForm
•Jobs\tutorial_DialogModalMandatory
The tutorials show the features added to the Dialog and DialogField classes (one of them is present in the basic application and is extending from RunBase, using an AOT form, the second is a job, showing the use of Dialog class)

DAX 3.0 Download link (was created in DAX 3.0 SP5 KR2) - DOWNLOAD
DAX 4.0 Download link (was created in DAX 4.0 SP1 EE) - DOWNLOAD

Important:
After importing the project do not forget to compile forward the Dialog class and to restart the DAX client.

Certain Issues you should know about:

1.InfoActions, if present, will allow to access forms, if the infolog window with them was opened before the modal dialog was called.

2.Mandatory property starts working only after a value is entered into the control. What this means is that if you simply press OK right after the dialog is opened, you won't receive an error (regular forms works this way too)
Credits
The modification allowing to specify a specific name for a DialogField was originally posted on the Russian Axapta forum
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
(Не)перерисовка окна клиента AX 2009 при длительных операциях - вариант решения gl00mie DAX: Программирование 12 27.02.2019 15:03
Событие(я) при активизации окна Workspace HorrR DAX: Программирование 5 28.09.2009 17:27
Как изменить заголовок окна предв.просмотра отчета Владимир Максимов DAX: Программирование 6 03.07.2006 15:34
Как убрать кнопку закрытия окна у диалога? Romb DAX: База знаний и проекты 5 15.02.2006 11:41
Как получить размер окна и клиентской области? gudzon DAX: Программирование 15 15.09.2005 15:15

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

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

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