4D v12.4

Methods Page

Home

 
4D v12.4
Methods Page

 

Methods Page  


 

 

The Methods page lists the project methods, database methods, and triggers, as well as project and table form methods for the database. These types of methods are grouped by category.

Note: When components with shared methods are installed in the database, the page displays the Component Methods category as well. This item lists the components installed and their shared methods. This point is detailed in Display of components.

This paragraph describes how to create each type of method from the Explorer.

  • Project Methods: To create a new project method, highlight the Project Methods item in the hierarchical list, or the name of an existing project method, and click the add button .
    You can also create a project method by duplication or copy-paste (see below).
  • Database Methods: You cannot create new database methods. Instead, you can add code to an existing blank database methods. To do so, expand the Database Methods item then double-click the database method to be modified or choose Edit Method... from the context menu or from the options menu. 
  • Triggers: To create a trigger, expand the Triggers item in the hierarchical list; highlight the desired table; then click on the add button or double-click on the table name. You can also choose Edit Method... from the context menu or from the options menu of the page. 
  • Project Form Methods: To create a new method for a project form, expand the Project Form Methods item in the hierarchical list; expand the desired table, and then highlight the desired form. Click the add button or double-click on the form name. You can also choose Edit Method... from the context menu or from the options menu of the page.
  • Table Form Methods: To create a new method for a table form, expand the Table Form Methods item in the hierarchical list; expand the desired table, and then highlight the desired form. Click the add button or double-click on the form name. You can also choose Edit Method... from the context menu or from the options menu of the page.
Note: You can also create a new form method by selecting Edit Form Method... in the context menu or the options menu of the Forms page.

You can display the Web Services Wizard from the Methods page by selecting Web Services Wizard... in the options menu of the page.

The Web Services Wizard appears, ready to be used to discover a Web Service and generate the corresponding proxy methods. For more information about using this wizard, refer to Subscribing to a Web Service in 4D

You can delete any method by highlighting it and clicking on the delete button at the bottom of the page, or by choosing Delete Method... from the context menu.

The manner of deletion depends on the method type:

  • Database methods, Triggers and Form methods: The contents of the method are erased and the method returns to its default “blank” state. A warning dialog box indicates that the deletion is permanent.
  • Project methods: The method is deleted from the list of methods and placed in the Trash. You can recover it from the Trash or delete it permanently (for more information, refer to the Trash Page section).

Click the icon to display the preview area and highlight the method you want to preview. The contents of the method then appear as in the Method editor. You can highlight, then copy or drag and drop, all or part of the contents of the preview area.

You can display or modify the properties of project methods from the Explorer by highlighting a method and choosing the Method Properties... command in the context menu or the options menu of the page.

The “Method Properties” dialog box appears, allowing you to modify the name as well as other method properties.

For more information about the other options of this dialog box, refer to Project method properties.

The Batch setting of attributes... command of the context menu or options menu (applied to project methods only) is used to modify an attribute (Invisible, Available through 4D HTML tags and URLS (4DACTION...), etc.) for all or part of the database project methods in a single operation. For more information about this command, refer to the Batch setting for method attributes paragraph. 

You can execute a database and/or a project method from the Explorer by selecting it and choosing Run Method... from the context menu or the options menu of the page. 

The method is executed in standard mode. For more information, refer to the Executing methods section.

When you are writing a method, you can add the name of another project method using drag and drop. Highlight the desired project method name in the Explorer and drag it to the Method editor window.
When creating custom menus, you can associate a project method with each menu command. You can do so by dragging a project method name from the Explorer to the Menu Bar editor. For more information, see Associating a project method.

You can copy, paste and duplicate project methods from the methods list of the Explorer. These functions allow you to duplicate a method in the same database or to copy it from one database to another. 

To duplicate or copy a method, select it in the list and choose the corresponding command in the context menu or in the options menu of the page. You can then paste the method by choosing Paste in the same context menu.

When you duplicate a method or when a method with the same name already exists in the place where you are pasting it, a number is added to its name, for example MyMethod1. This number is incremented as needed (MyMethod2, MyMethod3, etc.).

From the Explorer, you can search for a list of objects that reference a specific project method (other methods or menus). This function is available via the Search Method’s Callers command in the context menu or the options menu of the page:

Note: The Search Callers... command is also available in the Method menu of the Method editor

This command displays a new results window. For more information about the search results window, refer to Results window.

 
PROPERTIES 

Product: 4D
Theme: Explorer