How can you dynamically disable fields on a form at runtime?

I have an update form on which I want to disable only specified fields at runtime. The fields to be disabled are stored in a table, so when the form is opened, the code will loop through the table to retrieve each field name that should have a disabled control on the form. I would like to use the field name from the table to specify the name of the control to be disabled. For example, if the field name from the table is ‘ProductName’, then I want to disable the entry control for ‘ProductName’. I know the name of that entry control will be ‘?TAB’ + the field name from the table, which would be: ‘?TAB:ProductName’, so ideally the code could dynamically specify the name of the control to be disabled by using the current field name from the table (avoiding hard coding and allowing for new fields added to the form in the future that would not require a code modification).
Something like the following (but this particular code returns the error ‘BIND has not been called for Disable’):
BIND(‘L_String’,L_String)
L_String = ‘Disable(?TAB:’&Clip(LST:fieldname)&’)’
Evaluate(L_String)

This is using Clarion 10, legacy.
Thanks in advance for any suggestions,
KL

There is an undocumented RTL procedure which returns a string from an FEQ, it is wrapped inside my debuger class. I have used a loop like what you’re describing in a derived windowManager to do a select after a failed validation

From memory it might be cla$FieldName

I’m in my phone Atm but the. Debuger method is something like GetFEQDescr

You might be better off with a template that creates a list for you in the procedure.
Something like
q:fieldname = %field
q:Feq = %feq
add(q)
for all fields in the window. Then you have a simple lookup.

Here’s a GIST of the method I was talking about.

1 Like

Perhaps this type of thing could be useful for you.

This example translates the PROP:UseAddress to the actual address of the variable in question. You can then use that to find all occurrences of a variable on the window.

UseToActual.clw (5.2 KB)

Rather, you can use the function to find all occurrences. :slight_smile: