how to make controls on a form non-editable , when performing Push-action for a button.
I set a Push-action property for a button on a form , when i perform push-action , it opens a form.when form opens , some controls shd have to be turned into non-editable …
So these fields should be put into non-editable mode only when the form is called by this specific command button and not when called from somewhere else ?
That’s a pretty smart solution, but be aware that that would also mean that all of those controls would not be editable by default. You would have to add the call from all places that this form is used, and possibly replace simple RunObject button actions with a few lines of code.
Is this also the case if the controls are editable-property is set to Yes to begin with.
As long as the new function is not called, then all controls will be editable.
So basically you only have to modify existing calls of the form, if you want this limited editability instead.
In case it does not matter if or not or which way round to define the parameter:
In the OnInitForm trigger just call “EnableFields(TRUE)” will “initially” enable all fields and only call the “EnableFields(FALSE)” from the command button will disable the fields if required.
Yes indeed, it is the same as when the editable property is set to yes in the property. BUT, if you set EDITABLE to an uninstantiated boolean variable in OnInitForm or OnOpenForm (or through a function call in one of the triggers), then it will be set to that variable’s default value, which for a boolean is FALSE. Without actually setting that value to TRUE, controls will not be editable.
The purpose of my comment is just to make people aware that you have to be aware of this. Be aware of the variable’s default value, and make sure you are setting the EDITABLE property of the controls properly for when the form opens without having called the custom function.
I didn’t understand your comment though, because Thomas never mentioned any function-calls in the OnInitForm- nor in the OnOpenForm-triggers before you made that comment.
And i thought that if my form is editable by default, why would i have to make a function-call to make it editable.
When you do not call the function, the system will assume that the fields are editable/non-editable as defined in the properties. These settings are NOT part of the zup-file and therefore not restored when reopening the form.
So only if you want to change the default settings from the property, you would call that function - and this is what has been asked in this thread.
The call in the OnInitForm trigger is actually useless and just to make people feel safer.