When creating a dialog to be used with the PA_ModalDialog to open a dialog from a plug-in, here are a few tips to keep in mind.
1. Create the Form inside a blank database. Create a new database Table and then create the Forms you wish to load from the plug-in. When writing the form to disk using ctrl-9 for Windows, or command-9 for the Mac, 4D will write one resource file per table onto the hard drive. Each resource file will contain a 'FO4D' resource for every form in the table. To reduce the size and complexity of this file we would recommend using a blank database to create the table and associated forms to be loaded from the plug-in. This will reduce the number of 'FO4D' resources along with the associated 'CC4D' (contains form/object methods) and 'STL#' (contains styles used in the form) resources. Keep in mind that if you have more than one Table you will get more than one resource file.
2. DO NOT call any methods from the form. Any method called will not be written to disk. You MUST make sure all code is contained within the form. When 4D writes the resource file to disk, only code that is contained within the form will also be written within the resource file.
3. You can use standard actions like Accept, Cancel, etc. for button actions. These actions will function as they would in a normal 4D dialog. You may also use the API call PA_CloseDialog to close the form. Be sure to look over the API commands listed in the "4D Plug-in API Reference.pdf" document starting on page 149 for a list of the relevant API calls that you may use within your plug-in.
4. Keep in mind that PA_NewDialog creates a "4th Dimension context". Such a context is a kind of environment given by 4th Dimension to the dialog. In this environment, 4th Dimension deals with the dialog in interpreted mode so the plug-in can use this dialog even in a compiled database. Thus, the plug-in can use variables (and even create variables on the fly) that are unknown to the Compiler.
As a result, a plug-in cannot directly access any other variable while using a 4th Dimension Dialog. If the plug-in needs to access other process variables, it must call PA_Dial4DSaveVariables which will switch from dialog variables to current process variables, then it can use the process variables and call PA_Dial4DRestoreVariables, which will switch from current process variables to dialog variables. At least, in the object/form methods of the dialog itself, never call any other variables than the ones used in the dialog.