4D v13.4EXECUTE METHOD IN SUBFORM |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
EXECUTE METHOD IN SUBFORM
EXECUTE METHOD IN SUBFORM
The EXECUTE METHOD IN SUBFORM command can be used to execute the methodName project method in the context of the subformObject subform object. The project method called can receive from 1 to X parameters in param and return a value in return. Pass * in the return parameter if the method does not return parameters. You can pass the name of any project method that is accessible from the database or the component executing the command in methodName. The execution context is preserved in the method called, which means that the current form and current form event remain specified. If the subform comes from a component, the method must belong to the component and have the "Shared by components and host database" property. This command must be called from the form method of the parent form (containing the subformObject object). Note: The methodName method is not executed if the subformObject is not found in the current page or is not yet instantiated. Given the "ContactDetail" form used as subform in the parent form "Company". The subform object that contains the ContactDetail form is named "ContactSubform". Imagine that we want to modify the appearance of certain elements of the subform according to the value of the field(s) of the company (for example, "contactname" must switch to red when [Company]City="New York" and to blue when [Company]City="San Diego"). This mechanism is implemented via the SetToColor method. To be able to get this result, the SetToColor method cannot be called directly from the process of the "On Load" form event of the Company parent form because the "contactname" object does not belong to the current form, but to the form displayed in the "ContactSubform" subform object. The method must therefore be executed using the EXECUTE METHOD IN SUBFORM command in order to function correctly. Case of You are developing a database that will be used as a component. It includes a shared project form (named, for instance, Calendar) that contains dynamic variables as well as a public project method that is used to adjust the calendar: SetCalendarDate(varDate). SetCalendarDate(Current date) EXECUTE METHOD IN SUBFORM("Cal1";"SetCalendarDate";*;!01/01/10!) Advanced example: in the same context as previously, this example provides a generic method: // Contents of the SetCalendarDate method |
PROPERTIES
Product: 4D
INDEX HISTORY
Created: 4D v12 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||