4D v16.3CALL FORM |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
CALL FORM
CALL FORM
The CALL FORM command executes the project method whose name you passed in method with the optional param(s) in the context of a form displayed in a window, regardless of the process owning the window. Just like in the worker-based interprocess communication feature (see About workers), a message box is associated with the window and can be used when the window displays a form (after the On Load form event). CALL FORM encapsulates the method name and its arguments in a message that is posted in the window's message box. The form then executes the message in its own process. The calling process can be cooperative or preemptive, thus this feature allows a preemptive process to exchange information with forms. In window, you pass the window reference number of the window displaying the called form. In method, you pass the name of the project method to be executed in the context of the window parent process. You can also pass parameters to the method using one or more param parameters. You pass parameters the same way you would pass them to a subroutine (see the Passing Parameters to Methods section). Upon starting execution in the context of the form, the method receives the parameter values in $1, $2, and so on. Remember that arrays cannot be passed as parameters to a method. Furthermore, in the context of the CALL FORM command, the following additional considerations need to be taken into account:
You want to open two different dialog windows from the same form, but with different background colors and different messages. You also want to send messages afterwards and display them in each dialog window. In the main form, a button opens the two dialogs: //Object method to create forms The doAddMessage method only adds a row in the list box in the "FormMessage" form: C_TEXT($1) //Caller name At runtime, you get the following result: You can then add other messages by executing the CALL FORM command again: CALL FORM(formRef1;"doAddMessage";Current process name;"Hello 2 Form 1") You can use the CALL FORM command to pass custom settings to a form, for example configuration values, without having to use process variables: $win:=Open form window("form")
See also
|
PROPERTIES
Product: 4D HISTORY
Created: 4D v15 R5 ARTICLE USAGE
4D Language Reference ( 4D v16) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||