| NAB plug-in for MWT user guide June 21, 2006 |
Contents
![]()
|
Chapter 2 Creating a Simple Application, Hello
This chapter explains how to use this tool to create a simple C/C++ application, Hello, on Eclipse.
The Hello application opens a single window with a single button in it. "Hello!" appears on the button when clicked.
The basic procedures to use this tool are explained below as you create the Hello application.
2.1 Starting Eclipse
This section explains the procedure for starting Eclipse.
Procedure
- Start the Eclipse application.
Figure: Welcome screen of Eclipse

- Select [Open Perspective] -> [Other...] from the [Window] menu.
Figure: Selecting a perspective

- Select [NAB/MWT] in the [Open Perspective] dialog box.
Figure: [Open Perspective] dialog box

- The following perspective window is displayed.
Figure: Initial screen in the [NAB/MWT] perspective window

2.2 Exiting Eclipse
This section explains the procedure for exiting Eclipse.
Procedure
- Select [Exit] from the [File] menu of Eclipse.
Figure: Selecting [Exit]

2.3 Creating a Project
To use this tool to develop an application, create a project as the unit of development in the current workspace.

Projects of this tool and projects of WideStudio/MWT are referred to as follows to distinguish between them in this manual:This tool:NAB/MWT projects
WideStudio/MWT:WideStudio/MWT projects
This section explains the procedure for creating a project for Hello.
Procedure
- Select [New] -> [Project...] from the [File] menu.
Figure: Selecting a project

- Select [NAB] -> [NAB/MWT Project] in the [New Project] dialog box. Click the [Next] button.
Figure: [New Project] dialog box

- Specify the language you want to use.
Select [C++] in [Programming language], and click the [Next] button.
Figure: Selecting a programming language

- Specify a project name.
Enter "Hello" in the [Project name] text box, and click the [Exit] button.
Figure: Specifying a project name

- The NAB/MWT project is displayed as shown below.
Figure: Initial screen of the created NAB/MWT project

2.4 Creating an Application Window
A window created with this tool is referred to as an application window.
Each application window is managed as a file and can be edited, such as in the [NAB/MWT Editor] view.
This section explains the procedure for creating an application window for Hello.
Procedure
- Select [New] -> [Other...] from the [File] menu.
Figure: Selecting a new application window

- Select [NAB] -> [NAB/MWT Window] in the [New] dialog box. Click [Next].
Figure: [New] dialog box

- Click the [Exit] button.
For the Hello application window name, leave the contents in the [Window name], [Class name], and [Window type] boxes at their default values.
Figure: Specifying an application window name and other items

- The application window is displayed as shown below.
Figure: Initial screen of the created application window

2.5 Allocating an Instance to an Application Window
A component such as a button in the application window is referred to as an instance.
This section explains the procedure for allocating the [push!] button as an instance to the Hello application window.
Procedure
- Select the [BTN] icon (WSCvbtn/push button class) in the [Commands] section of the [NAB/MWT Object Box] view, and allocate the button instance to the application window in the [NAB/MWT Editor] view.
Figure: Allocating the [BTN] icon
- You can modify the allocated button instance in the [NAB/MWT Properties] view.
Confirm that the instance is selected in the [NAB/MWT Editor] view, and specify the following values in the [NAB/MWT Properties] view.
Property name
Setting value
Name
newvbtn_000
X coordinate
10
Y coordinate
10
Width
200
Length
30
Character string to be displayed
push!
- The created button is displayed as shown below.
Figure: Window displayed after settings are made in the [NAB/MWT Properties] view
2.6 Creating an Event Procedure
Allocated instances in a running application window generate events that vary depending on mouse motions and size changes made.
In this tool, a procedure that is set for an event is referred to as an event procedure.
Create an event procedure that displays "Hello!" when the button in the Hello application window is clicked.
This section explains the procedure for creating an event procedure.
Procedure
- In the [NAB/MWT Tree] view or [NAB/MWT Editor] view, select the button instance for generating the event, and select [New] icon in the [NAB/MWT Procedures] view.
Figure: Selecting a new event procedure

- The [Create Procedure] dialog box appears. Specify the following values.
Setting item
Value
Procedure name
new_ep
Function name
btn_ep
Trigger
ACTIVATE
Figure: [Create Procedure] dialog box

- Enter the following code in the btn_ep function of the event procedure by using the source code editor:
object->setProperty(WSNlabelString,"Hello!");
Figure: Window displayed after this addition is made with the source code editor


If Java is the language used, add the following code in the btn_ep function:
object.setProperty("labelString","Hello!");

2.7 Building and Running an Executable File
This section explains the procedure for creating and running an executable file.
Procedure
- Build the file from the [Project...] menu.
If an error message is displayed in the [Console] view, take action according to the error message contents to correct the error.

To build the file, select [Clean] from the [Project...] menu, and run "build."
The build processing after you select [Clean] varies as follows:
- If [Build Automatically] is checked on the [Project...] menu, the build starts automatically.
- If [Build Automatically] is not checked on the [Project...] menu, check [Start a build immediately] in the [Clean] dialog box, and click [OK].
Figure: Build status
- Select [Run...] from the [Run] menu.
Figure: Selecting [Run...]

- Select [C/C++ Local Application] in the [Run..] dialog box, and click the [New] button.
Figure: [Run...] dialog box

- Enter "Hello.exe" in the [C/C++ Application] text box, and click the [Run] button.
For a Linux version, enter "Hello".
Figure: [Run...] dialog box


To debug the file, specify a debugger.
Select the [Debugger] tab in the [Run] dialog box, and specify [GDB Debugger] in [Debugger].

- The application is displayed as shown below.
"Hello!" appears on the [push!] button when clicked.
Figure: Running application

Contents 
All Rights Reserved, Copyright(C) FUJITSU LIMITED 2005-2006 - In the [NAB/MWT Tree] view or [NAB/MWT Editor] view, select the button instance for generating the event, and select [New] icon in the [NAB/MWT Procedures] view.




