Notifications
Announcements
No record found.
Hi Friends,
I just use Dialog class to create simple dialog, how can I set text size? also, the focus is on 'Ok' button,
how can I change it to 'Cancel' button?
Many thanks,
River
*This post is locked for comments
Dialogtext tx;
FormButtonControl OkButton ;
dialog = new Dialog("My Dialog");
tx = dialog.addText("Select your favorite customer:");
tx.displayHeight(40); or whatever property u want to set
OkButton = dialog.dialogForm().control(#OkButton);
OkButton .setfocus();
More info.
https://community.dynamics.com/ax/b/daxbeginners/archive/2014/07/01/how-to-hide-or-disable-cancel-button-on-dialog
Hi Bhaskar,
Here is code I put in, compiling is fine, but, I got run time error, saying setFocus() is not method of CancelButton.
Error executing code: FormBuildCommandButtonControl object does not have method 'setFocus'
Any hint?
dialogText.displayHeight(40);
CancelButton = dialog.dialogForm().control('cancelButton');
CancelButton.setFocus();
if I do:
CancelButton = dialog.dialogForm().control(#cancelButton);
then, I got macro #cancelButton not existed error.
o set the focus on specific control when form is open, you need to override the firstField() method of the form and set your desired control after super() call.
public void firstField(int _flags=1)
{
super(_flags);
desiredControlName.setFocus();
}
Hi Bashir,
You talk about 'form', mean the dialog form?
You have to declared first.
If you are using macro you have to define the macro first in class declaration.
[tag:define].cancelButton('cancelButton')
FormButtonControl CancelButton;
Please override the dialogPostRun method and write below code.
public void dialogPostRun(DialogRunbase _dialog) { FormButtonControl myCtrl; super(_dialog); myCtrl = _dialog.dialogForm().formRun().control(CancelButton.id()); myCtrl.setFocus(); }
Please check
Hi Guys,
I need to clarify what I want to do here.
I have a dropdown box on Form, when value changed to a specific one, I need to pop up a dialog box with Ok and Cancel button, and I want focus on Cancel button.
It's basic a warning message.
Bhaskar, dialogPostRun method is for class, right?
it is very simple.
if (put your logc regarding data change && Box::okCancel("write your message", DialogButton::Yes) == DialogButton::Yes)
This is what I am looking for, thanks.
One more question, after user click cancel button, I want dropdown box reset back to originial value, how should I do it?
This dialog box, I pop it up in 'modified' method of dropdown, how can I find out old value, also, when I reset value back, surely, I don't want 'modified' method be called again.
How can we do it in new version? It is deprecated
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2