How to make dialog fields mandatory

See example below on how implement mandatory fields in dialog:

    boolean             ret;
    FilePath            workFolder;

    Dialog              dlg;
    DialogField         dfWorkFolder;
    FormStringControl   fsc;
    FormGroupControl    fgc;
    ;

    dlg             = new Dialog( "@CDT135" );
    dfWorkFolder    = dlg.addField( typeid( FilePath ), "@CDT136" );
    fgc             = dlg.mainFormGroup();
    fsc             = fgc.controlNum( 1 ); fsc.mandatory( true );

    while( dlg.run() )
    {
        workFolder  = dfWorkFolder.value();

        if( workFolder)
        {
            ret     = true;
            break;
        }

        dlg.doInit();
    }

1 Comment

  1. Hi,
    Thanks for the code !!

    It makes the dialog field wavy-underlined with red-color but still I am able to proceed without filling it with no error.

    Can we prevent that with any message?

    Thanks,
    Debashish