web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

CheckBox in a Dialog and check if it checked or unchecked

(0) ShareShare
ReportReport
Posted on by

Hey,

i have a button on a form if i hit the button a dialog will open.

How can ich Display a CheckBox and check with a if() if the box is checked or unchecked.

I want that WinApi::browseForFolderDialog('Speicher Ordner'); if the box is checked and show the savePath on the Dialog.

Thanks.

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Hi Felix Schneider,

    Do you want to add new check box on a dialog and when user tick it enable file path selection ?

  • Community Member Profile Picture
    on at

    Yes, i try it but the if() statement dont work.

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    So you need:

    1) add new field to dialog

    2) override modified method of tickBox to enable\disable file path when user click on tick box

    Please read this blog for details and code snippets dynamicsaxforum.blogspot.co.nz/.../override-event-methods-on-dialog.html

  • Community Member Profile Picture
    on at

    i open the dialog by the clicked method from a button on the form.

    void clicked()

    {

       str                         fileName;

       str                         saveFolder

       ;

       ORDBBGSalesImport           salesImport;

       Dialog                      dl;

       DialogField                 dialogFileName;

       DialogField                 savePath;

       DialogButton                input;

       NoYesId                     saveImportFile  = NoYes::no;

       int                         recordsCount;

       dl= new Dialog("Auswahl Import Datei");

                                   dl.addGroup('Datei');

       dialogFileName              = dl.addFieldValue(typeId(FileNameOpen), fileName);

                                   dl.addGroup('Speichern');

       savePath                    = dl.addFieldValue(typeId(NoYesId), saveImportFile, 'Import Datei Speicher ? ');

                                   dl.addText('Speicherort: ');

       // TODO Code zum erstellen des Backups

      if(savePath.value()==NoYes::Yes)

      {

           saveFolder        = WinApi::browseForFolderDialog('Speicher Ordner');

           dl.addText(saveFolder);

       }

       if(dl.run())

       {

           fileName                = dialogFileName.value();

           if(!fileName)

           {

               error("Datei Auswählen");

           }

           else

           {

               salesImport         = ORDBBGSalesImport::construct(fileName);

               salesImport.run(false);

           }

       }

    this is the code that i try.

    Hope it helps.

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    The problem here that dialog will be shown on if(dl.run())  so there is no reason to check savePath.value() before run().

    I can see 2 options here:

    1) Create class nested from RunBase  and override modified method as I suggested in previous post.

    2) Use 2 dialogs, first to ask if user want to save and then prompt for file name (thats looks strange and probably bad idea) .

  • Suggested answer
    Community Member Profile Picture
    on at

    if (Form1_ds.object(fieldnum(Form1, CheckBox_name)).getValue())

    //checked

    else

    //unchecked

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans