Disable Enum

Hi All,

I write a class Having two dialog fields one is enum value and other is text value depending upon the enum value(for example enum value is approved ). The text field is enabled.

How can i achive this ?

hi,

i think you can refer this link as an example to get your right solution.

http://axforum.info/forums/showthread.php?t=15244

Hello Selvan,

If you want to enable/disable the text dialog field based on the value of the enum dialog field in a dialog form then you can do this as shown below in the getFromDialog method of your class:

In this code example dialogCustPaymValidate is the enum dialog field and dialogDescription is the text dialog field.

boolean getFromDialog()

{

;

custPaymValidate = dialogCustPaymValidate.value();

if (custPaymValidate == CustPaymentValidate::OffsetAccountIsBank)

{

// dialogDescription.allowEdit(false);

dialogDescription.enabled(false);

}

else

{

// dialogDescription.allowEdit(true);

dialogDescription.enabled(true);

}

return super();

}

Hello Selvan,

If you want to enable/disable the text dialog field based on the value of the enum dialog field in a dialog form then getFromDialog method is not the correct place because it gets called only after you press OK of the dialog form. This will not work for what you require.

I am looking for another solution to get this work and will inform you once I get it.

Hello Selvan,

You’ll have to do the following to enable/disable a string control on the basis of the value of an enum control:

  1. In the dialog method of your class call the allowUpdateOnSelectCtrl method on the DialogRunBase object with the parameter value true .

dialog.allowUpdateOnSelectCtrl(true);

  1. Override the dialogSelectCtrl() method of your class as shown in the below code example:

//

Object dialog()

{

DialogRunbase dialog = super();

;

dialogCustPaymValidate = dialog.addField(typeid(CustPaymValidate), “Validate customer payment”, “Validate payment from customer”);

dialogDescription = dialog.addField(typeid(Description), “Description”, “Description”);

dialog.allowUpdateOnSelectCtrl(true);

return dialog;

}

//

//

public void dialogSelectCtrl()

{

super();

if (dialogCustPaymValidate.value() == CustPaymentValidate::CheckNo)

{

dialogDescription.enabled(false);

}

else

{

dialogDescription.enabled(true);

}

}

//