Skip to content

5. Component methods

Gabriel Inzirillo edited this page Dec 5, 2020 · 7 revisions

AJUI_Button ( { template_obj} ) -> class obj

This method replaces New AJUI_Button starting from V18R3, it is used to return the Button class. The functions of the class are identical to the formulas. It is possible to pass an object as a parameter to it in order to import an AJUI Button template (JSON file). The object expects as properties:

  • templateName : Name of the folder containing the JSON file to import (template). If the file is not found, the method will return a new instance of AJUI Button.
C_OBJECT($o)
$o:=New object("templateName";"slideOn")
Form.btn1:=AJUI_Button.new ($o)
Form.btn1.Name("btn1")
  • templatePath (optional): You can specify a path to retrieve the file otherwise, the component will search in the default folder located in the resources (.../Resources/AJUI_Button_Templates/). You can use "#" to designate the 4D resources folder in your path.
$template_obj:=New object("templateName";"MyTemplate.json";"templatePath";"C/:/MyTemplates/")
$myBtn:=AJUI_Button.new ($template_obj)

AJUI_Btn_LoadTemplates ({folderPath}) -> templates_name_col

Utility method to get all JSON files from a folder into a collection. You can pass in parameter the path of the folder containing the templates. If this is not the case, the method will search in the default path (.../Resources/AJUI_Button_Templates/).

$folder:=Folder(Form.templateLocPref.path_global;fk platform path)
If($folder.exists)
  $templates_col:=AJUI_Btn_LoadTemplates($folder.platformPath)
End if

AJUI_Btn_info ( ) -> version_txt

This method returns a string representing the version number of the component.

DEPRECATED

New AJUI_Button ( { template_obj} ) -> button_obj

This method returns an object variable that represents an instance of AJUI Button. It contains all the properties and their default values as well as the formulas (member functions) to manipulate them. It is possible to pass an object as a parameter to it in order to import an AJUI Button template (JSON file). The object expects as properties:

  • templateName : Name of the folder containing the JSON file to import (template). If the file is not found, the method will return a new instance of AJUI Button.
C_OBJECT($o)
$o:=New object("templateName";"slideOn")
Form.btn1:=New AJUI_Button ($o)
Form.btn1.Name("btn1")
  • templatePath (optional): You can specify a path to retrieve the file otherwise, the component will search in the default folder located in the resources (.../Resources/AJUI_Button_Templates/). You can use "#" to designate the 4D resources folder in your path.
$template_obj:=New object("templateName";"MyTemplate.json";"templatePath";"C/:/MyTemplates/")
$myBtn:=New AJUI_Button($template_obj)