In this chapter, you will create a simple application to demonstrate the Nexacro Platform application development environment and Nexacro Studio. The application will display the message "Hello, Nexacro Platform!" When you click the message text, "Nexacro Platform 14" will display in the Alert window.
Starting Nexacro Studio
Start Nexacro Studio by:
Double-clicking the Nexacro Studio icon on your Windows desktop. or
Double-clicking on the Nexacro Studio executable in the installation directory. The default installation path is C:\Program Files\nexacro\14\nexacrostudio14.exe
Immediately after installation, the Nexacro Studio UI displays the following screen without an open project.
Callout | Component | Description |
---|---|---|
1 | Project Explorer | List of components for the open project. |
2 | Form Design | Place for designing an application screen and editing a script. |
3 | Properties | Properties of the form, component, and dataset component. You can edit them in this sector. |
4 | Output | List of output messages (such as error messages), generated messages, and messages set up with trace() method. |
Creating a Project
Before creating a Nexacro Platform application, you must create a project. The project defines how the application will appear and run on the user’s screen. You can create a new project or reuse an existing template project. In this chapter, you will learn how to create a project.
Select the New Project Wizard from the menu:
[Menu] File > New > Project
1 Type the project's name in the "Name" field. 2 Set the location where the file will be saved in the "Location" field.
In this example, the settings will be as follows.
Field | Description | Predetermined value |
---|---|---|
1 | Project name | Hello |
2 | Project file savinglocation | D:\XP\PJ\Hello |
3 | Select project format | Create a new Project |
4 | Click Finish to save the project |
As the project is created, the project component will be displayed in the project explorer window.
The paths explained in this chapter are based on the Windows 7 operating system. The paths may differ depending on the operating system.
The file will be saved automatically to this location if you don't specify an alternative:
C:\Users\[User]\Documents\nexacro\
If you want to add ADL (Assertion Definition Language) while the project is still open, select Add to Current Project instead of 3 Create a New Project.
Creating an Application
Nexacro Platform applications run based on forms. While a project presents the "stage" for an application, a form decorates the stage, arranges movements, and add effects.
Creating a Form
Form Dimensions
The default form size is (1024x768), which will be used for this example. To modify the size and layout, you will need to access the Dimension tab. For now, you can skip this.
You can specify the basic size of a form by using Options. Follow the path [Tools > Options > Form Design > General], and revise the item "Default Width" and "Default Height" so that you can specify the basic size of created forms.
Run the Wizard
To create a new form, run the New Form Wizard and follow these steps.
[Menu] File > New > Form
Field | Explanation | Example Value |
---|---|---|
1 | Form name | frm_hello |
2 | Place where the service group will be saved (default value is "Base") | Base |
3 | Click the Finish button. |
Component Assignment
Once a new form is created, the form design window and toolbars are activated.
Toolbar | Description |
---|---|
TextStyle | Sets text properties |
Object | Assigns component |
Align | Arranges component’s screen |
Screen Layout
[Need to add info about the callouts in the figure]
Form Area | Description |
---|---|
1 Project Explorer | List of project objects |
2 Design/Source/Script tabs | Panel for editing design, source code, and scripts for form |
3 Properties/Style Property Editor tabs | Panel for modifying the form properties and styles |
4 Ribbon | Common commands |
Write Letters
You can use Static components to write text in Nexacro Platform applications. Click the Static component on the "Objects" toolbar, and then click where you want it placed in the Form Design window. The Static component is displayed in the default size.
Assign a Component in a Different Size
You can assign a component to the Form Design window in a different size than the default. Select the component, and instead of clicking the place where you want it in the design window, press and drag the left mouse button to the size you want.
Need to verify this works.
Revise Static Component Text
To revise a static component’s text, select the component in the Form Design window, click its text area to switch to edit mode, and make your changes.
To modify a component's properties, select it in the Form Design window, then edit the properties in the Properties window.
Generate Path
Nexacro Platform applications don't execute the code created on Nexacro Studio directly. The JavaScript code needs to be generated, which can be used in any environment based on the integrated framework. You need to specify the Generate Path to designate the folder where the generated JavaScript files are written. You can do this using QuickView or the Options menu as described in this section.
Using QuickView to Specify Generate Path
Access QuickView:
[Menu] Build > Quick View > Quick View
Using Options Menu to Generate Path
Another way to specify the Generate Path is by accessing: [Menu] Tools > Options > Environment > General > Generate Path. 1.
A new folder with the project name is created under the designated folder, and the JavaScript files will be created.
The followings are default set-ups of Working Folder, Generate Path, and Base Lib Path.
Working Folder
C:\Users\[user name]\Documents\nexacro\projects
Generate Path
C:\Users\[user name]\Documents\nexacro\outputs
Base Lib Path
C:\Program Files\nexacro\14\nexacro14lib
Generating the JavaScript Code
Nexacro Studio creates the JavaScript files and stores them at the Generate Path location.
As the converted JavaScript files are created, you can see QuickView executed.
Adding Events
Let's create an event that displays an Alert window when the user double-clicks the Static component, "Hello, Nexacro Platform."
Double-click the component on the Form Design window. The function will be created automatically as soon as the design window switches to the Form Script window, as shown here:
this.Static00_onclick = function(obj:Static, e:nexacro.ClickEventInfo) { }
Declare a task in this function by adding code that displays "Nexacro Platform 14" in the Alert window.
this.alert("Nexacro Platform 14");
The corresponding code for the form we have created here (frm_hello.xfdl) is listed below:
<?xml version="1.0" encoding="utf-8"?> <FDL version="1.5"> <TypeDefinition url="..\default_typedef.xml"/> <Form id="frm_hello" classname="frm_hello" left="0" top="0" width="1024" height="768" titletext="New Form"> <Layouts> <Layout> <Static id="Static00" text="Hello, Nexacro Platform!" left="50" top="50" width="160" height="70" onclick="Static00_onclick"/> </Layout> </Layouts> <Script type="xscript5.0"><![CDATA[ this.Static00_onclick = function(obj:Static, e:nexacro.ClickEventInfo) { this.alert("Nexacro Platform 14"); } ]]></Script> </Form> </FDL>