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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 23.12.2019, 10:58   #1  
Ventainais is offline
Ventainais
Участник
 
13 / 10 (1) +
Регистрация: 31.08.2019
Hide, show dialog query select button.
Greetings!


I'm creating a new report and added to it a datasource.
The report is run from extended RunBaseReport Class and in the dialog method
I create a dialog in witch I added an enum type combobox.

What I am trying to do is hide the select button depending on what value the user has selected.

X++:
public Object dialog(Object _dialog)
{
    InventFertilizerReportDesign    inventFert;
    ;
    dlg     = super(_dialog);

    dlgFldDesignVal     = dlg.addField(typeId(InventFertilizerReportDesign), "@LVT76");
    dlgFldDesignVal.value(reportDesign);
    dlgFldDateFrom      = dlg.addField(typeId(TransDate), "@SYS5209");
    dlgFldDateFrom.value(dateFrom);
    dlgFldDateTo        = dlg.addField(typeId(TransDate), "@SYS80662");
    dlgFldDateTo.value(datoTo);
    dlgFldShopId        = dlg.addField(typeId(ReShopId));
    dlgFldShopId.value(shopId);

    dlgFldShowPrice     = dlg.addField(typeId(NoYes), "@LVT4117");
    dlgFldShowWeight    = dlg.addField(typeId(NoYes), "@LVT4119");

    return dlg;
}

In method "dialogPostRun" I set controlMethodOverload to true
X++:
super(dialog);

    dialog.dialogForm().formRun().controlMethodOverload(true);
    dialog.dialogForm().formRun().controlMethodOverloadObject(this);
X++:
public int Fld6_1_selectionChange()
{
    int     ret;
    Object          mainFormGroupOrig;
    Object  control = dlg.formRun().controlCallingMethod();

    ret = control.selectionChange();

    switch (dlgFldDesignVal.value())
    {
        case InventFertilizerReportDesign::AmmoniaNitrateDesign :
            showQueryValues = true;
            dlgFldDateFrom.visible(true);
            dlgFldDateTo.visible(true);
            dlgFldShopId.visible(true);
            dlgFldShowPrice.visible(false);
            dlgFldShowWeight.visible(false);
            break;
        case InventFertilizerReportDesign::SalesReport          :
            showQueryValues = false;
            dlgFldDateFrom.visible(false);
            dlgFldDateTo.visible(false);
            dlgFldShopId.visible(false);
            dlgFldShowPrice.visible(true);
            dlgFldShowWeight.visible(true);
            break;
    }

    reportDesign = dlgFldDesignVal.value();

    return ret;
}

X++:
 public boolean showQueryValues()
{;

    return showQueryValues;
}
as simple it may be I can't figure out how to hide or show the button.
Старый 23.12.2019, 11:28   #2  
Pandasama is offline
Pandasama
Участник
 
448 / 133 (5) +++++
Регистрация: 11.08.2014
Адрес: Барнаул
Цитата:
Сообщение от Ventainais Посмотреть сообщение
public boolean showQueryValues()
try method .showQuerySelectButton() instead
Старый 23.12.2019, 11:31   #3  
Pandasama is offline
Pandasama
Участник
 
448 / 133 (5) +++++
Регистрация: 11.08.2014
Адрес: Барнаул
though if you want to hide/show this element in runtime - i think, not showQueryValues(), not showQuerySelectButton() cant help you - i'm almost sure than this methods processed just once, when dialog opened

i think, you must get object for button control (may be by modify RunBase method where this button is created, or maybe RunBase already have variable for this button) and change this object visible property

Последний раз редактировалось Pandasama; 23.12.2019 в 11:46.
Старый 23.12.2019, 11:33   #4  
VORP is offline
VORP
Участник
Аватар для VORP
 
146 / 95 (4) ++++
Регистрация: 26.05.2006
Method showQueryValues is called upon dialog initialization(/Classes/RunBaseDialogModify/Methods/init - (623, 10)), depending on it query button will be added. So if you modify it when dialog already initialized nothing happens. You should hide button manually, maybe looking at initQuery methods will be useful. But event after that you need to reset query if required, because it will be used even if its invisible.
Старый 23.12.2019, 11:34   #5  
Ventainais is offline
Ventainais
Участник
 
13 / 10 (1) +
Регистрация: 31.08.2019
public boolean showQueryValues() won't help to.
Старый 23.12.2019, 11:36   #6  
Ventainais is offline
Ventainais
Участник
 
13 / 10 (1) +
Регистрация: 31.08.2019
Thank you Pandasama and VORP.
I'll try to figure out what could be done.
Старый 27.12.2019, 14:48   #7  
Ventainais is offline
Ventainais
Участник
 
13 / 10 (1) +
Регистрация: 31.08.2019
One solution I have

X++:
    #define.GroupQueryPrinter('GroupQueryPrinter')
    #define.RightButtonGrp('RightButtonGrp')
    ;

    formRun = dlg.dialogForm().formRun();

    queryGroupCtrl = formRun.design().controlName(#GroupQueryPrinter);
    
    if (queryGroupCtrl)
        queryGroupCtrl.controlNum(1).visible(showQryVal);
        
    queryGroupCtrl = formRun.design().controlName(#RightButtonGrp);
    
    if (queryGroupCtrl)
        queryGroupCtrl.controlNum(1).visible(showQryVal);
not recommended but for my project it works.

This hides the query value field group and the select button.
Теги
axapta 2012, hide, select button, show

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: Microsoft Dynamics AX general performance analysis scripts page 5 Blog bot DAX Blogs 0 01.09.2014 14:11
dynamicscare: Using Power BI to Analyze Your Dynamics AX Data Blog bot DAX Blogs 1 06.10.2013 18:11
atinkerersnotebook: Using Service Management to Track Service Orders Blog bot DAX Blogs 1 25.08.2013 19:16
daxline: How to show or hide query ranges on dialogs in Dynamics AX? Blog bot DAX Blogs 0 03.08.2011 09:11
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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