I would like to know if i set a field 'enable' to no, but i wanted to set back the 'enable' to yes with some certain condition inside a simple screen.
For example, when the user choose an item type to "A", the checkbox will be enable or else disable.
How should i write the method? please guide me. thank you.
The simplest way to do this is overriding active() on the form data source like this:
public int active()
ret = super();
Table_ds.object(fieldNum(Table, Field)).enabled(Table.ItemType == "A");
Notice that this will run only when you save or select the record on the form.
You can obtain a reference to the datasource field and use its enabled() method, e.g. YourDataSource_ds.object(fieldNum(YourTable, YourField)).enabled(true);.
Nevertheless if you actually wanted to set AllowEdit to No on table-field level, you wouldn't be able to re-enable it in a form.
Thanks Martin, it solves my problem.