Master action defaults file is an .ad2 file that contains default attributes (texts, images, accelerators, etc.) for actions that can be performed in the 4GL application. Master action defaults files have the name of the program, are stored together with it, and are loaded automatically when the application is run.
Application action defaults file is a user-defined configuration file with extension .ad2 or .fm2 that contains default attributes for actions that can be performed in several different 4GL applications in order to secure their common runtime behavior or change it according to current tasks and purposes.
Differences between master and application action defaults files are summed up in the table below.
|
Master action defaults file |
Application action defaults file |
has the same name as the 4GL program |
|
|
must be stored in the same folder as the program executable file |
|
|
is loaded automatically when the application is run |
|
|
can be created as a part of the Create new 4GL program wizard |
|
|
is applied at runtime |
|
|
In their essence, master and application action defaults files are the same type of files and have the same syntax and structure.
What differs is their purpose, location, and loading time.
Below you can see two example of an action defaults file that can serve both as master and application one:
#1
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://namespaces.querix.com/2015/fglForms" title="ActionDefaults">
<form.actions>
<Action identifier="accept" text="Action One" validate="true" defaultView="Auto" statical="true" accelerator1="A,true,false,true" actionImage="qx://application/accept.png"/>
<Action identifier="cancel" text="Action Two" validate="true" defaultView="Auto" statical="true" accelerator1="C,true,false,true" actionImage="qx://application/cancel.png"/>
</form.actions>
</form>
#2
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://namespaces.querix.com/2015/fglForms" title="ActionDefaults">
<form.actions>
<Action identifier="act_1" text="Action One" validate="true" defaultView="Auto" statical="true" accelerator1="A,true,false,true" actionImage="qx://application/accept.png"/>
<Action identifier="act_2" text="Action Two" validate="true" defaultView="Auto" statical="true" accelerator1="C,true,false,true" actionImage="qx://application/cancel.png"/>
</form.actions>
</form>
Usually, master action defaults files are created together with 4GL programs.
To create a master action defaults file, you have to check the create .ad2 checkbox after entering the program name:
If you have missed this step, you can create your master action defaults file at any other point of the program design in LyciaStudio:
After you have created your master action defaults file, it is added to your 4GL program and you can open and edit it in Lycia Form Designer either in Design (recommended) or in XML Source mode:
By default, your master action defaults file only the default form info :
Master action defaults files are edited in the same way as any other .ad2 files:
If you want to edit your master action defaults files as the XML code, we recommend you first to study these topics:
Master action defaults files must be located in the same folder as the program executable file (this folder is specified in listener.xml):
Application action defaults files are more flexible than master ones in terms of their creation, storage, and usage.
Application action defaults files can have two extensions - .ad2 or .fm2:
Application action defaults files can be create as ones in LyciaStudio:
All the file names you use in your 4GL development must be platform-independent.
If you use platform-dependent names (e.g., combine upper and lower case, use colons, finish names with a full stop, etc.), please remember that they might cause different problems when you move your project to another platform.
Regardless of their extension, application action defaults files can be edited in Lycia Form Designer either in Design (recommended) or in XML Source mode.
Before you start editing your application action defaults files as the XML code, we recommend you to study these topics:
Application action defaults files can be stored in any necessary location:
Contrary to master action defaults files, application action defaults files must be loaded from your 4GL code - by ui.Interface.loadActionDefaults():
CALL ui.Interface.loadActionDefaults("my_ads_yes_no")
The same application action defaults file can be used with as many 4GL applications as you need once they are called properly.