23.12.2019, 10:58 | #1 |
Участник
|
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; } |
|
23.12.2019, 11:28 | #2 |
Участник
|
|
|
23.12.2019, 11:31 | #3 |
Участник
|
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 |
Участник
|
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 |
Участник
|
public boolean showQueryValues() won't help to.
|
|
23.12.2019, 11:36 | #6 |
Участник
|
Thank you Pandasama and VORP.
I'll try to figure out what could be done. |
|
27.12.2019, 14:48 | #7 |
Участник
|
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); This hides the query value field group and the select button. |
|
Теги |
axapta 2012, hide, select button, show |
|
|