|
1 | 1 | <!--New AJUI_Button ( {template_obj} ) -> AJUI Tip instance --> |
2 | 2 |
|
3 | | -# New AJUI_Button |
4 | 3 |
|
5 | | -## Parameters |
6 | | - |
7 | | - * (object) (optional) template : |
8 | | - * (text) 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. |
9 | | - * (text) (optional) templatePath : 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/). |
| 4 | +## Description |
10 | 5 |
|
11 | | -## Return value |
| 6 | +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). |
12 | 7 |
|
13 | | -(object) instance of an AJUI Button |
| 8 | +```4d |
| 9 | + New AJUI_Button ( {template} ) -> instance |
| 10 | +``` |
14 | 11 |
|
15 | | -## Description |
| 12 | +| Parameter | Type | In/Out | Description | |
| 13 | +| --------- | ---- | ------ | ----------- | |
| 14 | +| template | object | in | Properties :<br> - (text) 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.<br> - (text) (optional) templatePath : 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/). | |
| 15 | +| instance | object | out | instance of AJUI_Button with all the member functions | |
16 | 16 |
|
17 | | -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: |
18 | 17 |
|
19 | 18 | ## Example |
20 | 19 |
|
21 | | -``` |
22 | | - C_Object($myButton;$template_obj) |
23 | | - C_String($path;$templateName) |
24 | | -
|
25 | | - $template_obj:=New object("templateName";$templateName;"templatePath";$path) |
26 | | - $myButton:=New AJUI_Button ($template_obj) |
27 | | -``` |
| 20 | +```4d |
| 21 | + Case of |
| 22 | + : (Form event code=On Load) |
| 23 | + C_Object($myButton;$template_obj) |
| 24 | +
|
| 25 | + $template_obj:=New object("templateName";Form.templateName;"templatePath";Form.templatePath) |
| 26 | + |
| 27 | + Form.btn:= New AJUI_Button($template_obj) |
| 28 | + Form.btn.Name("btn3") |
| 29 | + |
| 30 | + //default |
| 31 | + Form.btn.BGColor(AJUI_btn_default;"lightgrey") |
| 32 | + Form.btn.Label(AJUI_btn_default;"BTN 3") |
| 33 | + Form.btn.BorderSize(AJUI_btn_default;2) |
| 34 | + |
| 35 | + //hover |
| 36 | + Form.btn.BGColor(AJUI_btn_hover;"darkgrey") |
| 37 | + Form.btn.Label(AJUI_btn_hover;"On Hover") |
| 38 | + |
| 39 | + //active |
| 40 | + Form.btn.BGColor(AJUI_btn_active;"grey") |
| 41 | + Form.btn.Label(AJUI_btn_active;"On Click") |
| 42 | + End case |
| 43 | +
|
| 44 | + Form.btn.Draw() |
| 45 | + |
0 commit comments