- In this lesson you will learn the following concepts
- Required configuration
- Required configuration for Android
- Required configuration for iOS
- My first project
- Creating the project
- My first window
- Creating the window
- Displaying a message
Lesson 2.1. My first Android/iOS project
In this lesson you will learn the following concepts
- Required configuration.
- Creating an Android/iOS project.
- My first window.
Estimated time: 1 h
To start developing with WINDEV Mobile, we will simply create our first project. It will be a cross-platform
project intended for Android and iOS. Most mobile applications must run on both Android and iOS.
With WINDEV Mobile, there is no need to develop two different projects, maintain them and make them evolve in parallel. You just need to create a single project and associate it with multiple platforms, e.g., Android and iOS: this makes it a cross-platform project. The platforms will be differentiated only when the application is generated and deployed.
|In this tutorial, we have chosen to create a cross-platform project. WINDEV Mobile also allows you to create: |
You can create an Android or iOS-only project following the same steps as the ones presented in this lesson.
- A project only for Android,
- A project only for iOS.
We will create a project containing a window to display a message.
But before creating our first project, let's take a look at the configuration required to develop an Android and/or iOS application.
Required configuration for Android
To develop an Android application, the following elements must be installed on the development computer:
- The JDK: The JDK (Java Development Kit) distributed by Oracle is used to compile the generated Java files.
- The Google Android SDK: The Android SDK (Software Development Kit) is a set of files and applications distributed by Google to allow applications to be compiled for Android.
Caution: The Android SDK includes groups of files that correspond to the versions of the platform on the devices (6, 7, etc.).
The download and setup of the Android SDK are proposed if necessary when generating the Android application from WINDEV Mobile.
- Gradle tool: This tool is required to compile and generate Android applications. Gradle can be downloaded and installed if necessary when generating the Android application from WINDEV Mobile.
It is recommended to restart the computer once the JDK and SDK have been installed.
Required configuration for iOS
To develop a WINDEV Mobile application for iPhone/iPad, you need:
Why a PC?
- 1 PC
- 1 Mac
- 1 iPhone and/or iPad (optional)
WINDEV Mobile 28 is a Windows application that runs on Windows Vista, 7, 8, 10, 11, ...
The application will be created on the PC (Project, Analysis, Windows, etc.) before being compiled on a Mac.
You don't need to install any Mac/Apple tools.Why a Mac?
A Mac is required because the project generated on PC must be compiled in a specific compiler to generate iOS applications. The minimum OS version required is Big Sur (for Xcode 13 to 13.2) or Monterey (Xcode 13.3).
Xcode is the Mac compiler for generating programs that run on iOS (i.e. for iPhone, iPad, Mac Catalyst and AppleWatch).
It is recommended to use Xcode 13 or higher.
For more details, see Compiling a WINDEV Mobile project in Xcode
(download addresses, etc.).
Creating the project
We will create our first project for Android and iOS.
|A corrected project is available. To open this project: |
- Go to the WINDEV Mobile home page (Ctrl + <).
- Click "Tutorial", then in "Part 2 - Lesson 2.1 - My first Android/iOS application", double-click "My Android/iOS project (Answers)".
- To create an Android / iOS cross-platform project:
- Start WINDEV Mobile 28.
- Go to the WINDEV Mobile home page (Ctrl + <).
- On the home page, click "Create a project" ( icon) and select "Android or iOS application".
- The project creation wizard starts. The different steps of the wizard will help you create your project. The information specified in this wizard can be modified later.
|Tip: Another method for creating a project:|
- Click in the quick access buttons of the WINDEV Mobile menu.
- The new element window appears: click "Project".
- The first step of the wizard allows you to define the project execution platform:
In our case, select "Android and iOS cross-platform" and go to the next step.
- The wizard proposes to create a blank project or a project based on an example. Choose "Create a blank project" and go to the next step.
- The wizard prompts you to choose the type of devices the project is intended for:
- Generate an application for phones and tablets.
- Generate an application for phones.
- Generate an application for tablets.
|If the application is intended to operate on several Android and/or iOS devices (e.g. phones of different sizes or different resolutions), it is recommended to use one of the following options: |
- "Generate an application for phones and tablets",
- "Generate an application for phones".
- In this example, we are going to generate an application for phones. Select "Generate an application for phones" and go to the next step.
- The wizard prompts you to enter the project name, location and description. We will name our project "My_iOS_Android_Project". By default, WINDEV Mobile creates this project in "\My projects\My_iOS_Android_Project". You can keep this location or change it via the [...] button.
- Go to the next step.
- The wizard proposes to add documents. Go to the next step.
- This step allows you to use the Source Code Manager (SCM). We will not use it in this example. Select "No, do not use SCM". Go to the next step.
|Remark: The Source Code Manager (SCM) is not available in the Express version.|
- This step is used to define the code style. Don't change the suggested options. Go to the next step.
- This step allows you to define the style book of the application. Choose "Phoenix".
- We can skip the other steps of the wizard for our first project. Click "Finish" directly. The project is automatically created. Two project configurations are automatically created:
The window creation and generation wizards will automatically show the options that correspond to the current configuration in the editor.
- an "iOS application" configuration, which is automatically selected.
- an "Android application" configuration.
- The new element window appears. This window is used to create all elements that can be associated with a project.
The first window allows the user to display a welcome message via the "Display" button.
You may think this is too basic but we advise you to create this window. You will be amazed by how intuitive and easy it is to use the WINDEV Mobile editor. Furthermore, this window will allow you to discover concepts that are fundamental for the rest of this tutorial and to see the entire process for developing an Android/iOS application with WINDEV Mobile.
Creating the window
- To create the window:
- In the "New" window, click "Window" then "Window".
|As a new project was created, the window for creating a new element is automatically displayed.|
To open the element creation window, simply click
in the WINDEV Mobile quick access buttons:
- The window creation wizard starts.
- In the list of windows, select "Blank for generic iPhone". Since the "iOS" configuration is selected by default, the wizard will prompt you to create a window for iPhone. The name of the skin template used is displayed at the lower-right section of the wizard. "Phoenix", the skin template we selected when creating the project is selected by default.
|Skin templates allow you to quickly create outstanding interfaces. A skin template defines the window style as well as the style of all controls that will be used in this window. Thus, the interface will always be cohesive and beautiful.|
- Validate. The window is automatically created in the editor. The save window appears. This window allows you to specify:
- the element title. This title will be displayed in the Action Bar of the window.
- the element name that corresponds to the window name. This name will be used programmatically.
- the element location. This location corresponds to the directory in which the physical file corresponding to the element is saved. The window is a "WDW" file, saved in the project directory.
- Specify the title of the element: "Welcome". The name of the element is automatically completed: "WIN_Welcome".
|Let's take a look at the window name proposed by WINDEV Mobile: this name starts with the letters "WIN_". This prefix is automatically added because the project uses a code style.|
The code style is used to define a prefix for each type of object, allowing you to quickly identify the element:
- a window starts with "WIN_",
- a button starts with "BTN_",
If you do not want to use this code style, you can simply disable it: on the "Project" tab, in the "Other actions" group, expand "Code style" and uncheck "Use code style".
- Save the window by clicking "OK".
- The window is displayed in the window editor. This window is composed of multiple areas:
- The system bar, which shows the time.
- The Action Bar. The "Action Bars" replace the title bar of a window and display multiple information: the application icon, the window title, some menu options and the window drop-down menu.
- The content area of the window, which will contain the different controls of the application.
Displaying a message
You are now going to create a Button control used to display a message.
- To create the "Display" Button control:
- On the "Creation" tab, in the "Usual controls" group, click . The control appears in creation mode under the mouse pointer.
- Move the cursor to the position where you want to create the control (e.g. at the top of the window). To drop the control in the window, simply click on the window.
- Right-click the control that was just created. The context menu of the control appears. Select "Description" in this context menu. The Button control description window appears.
- Enter the following control details:
- The control name: "BTN_Display".
- The control caption: "Display".
|We changed the name and caption of the Button control in its description window (also called "7-tab window").|
You can also change the control name and caption from the window being edited:
- Click the control to select it.
- Press the Enter or Space key: the text becomes editable.
- Type the new caption and validate.
- Validate the control description window ("OK"). The new control caption appears in the window editor.
- To improve the UI of our first window, we will center the Button control in the window:
- Click the Button control to select it.
- On the "Alignment" tab, in the "Centering and distribution" group, click "Center in the parent (Horz.)".
- The result appears immediately.
|WINDEV Mobile has many alignment options. If you don't know which alignment to choose, hover over the different options available in the "Alignment" tab. When you hover the mouse over an option, the controls selected in the window are automatically positioned and/or resized according to the hovered option.|
To apply the alignment, click the desired option.
If you don't want to apply the alignment, simply exit the alignment options: the controls move back to their initial position.
Remark on the assisted input
- We will display a message in a dialog box (a system small window). To do so, we will use our first WLanguage function: Info.
|WLanguage is the programming language used by WINDEV Mobile. It is a 5th-generation language (5GL) that includes highly sophisticated commands.|
- Select the control if necessary.
- When the control is selected, several handles appear around the control.
- To select a control, simply click on it.
- Right-click the control to open its context menu.
- Select "Code". This option opens the WINDEV Mobile code editor, in which all WLanguage statements can be typed.
|The code editor proposes different events for each type of control. These are the WLanguage events related to the control.|
Two events are displayed for the "Button" control:
- "Initializing", run when the window is displayed.
- "Click", run when the user clicks on the control.
Remark: Additional events can be added if necessary.
- Write the following WLanguage code in the "Click" event of the "BTN_Display" control:
: When the first two characters are typed, WINDEV Mobile opens a list with all the WLanguage elements that contain these characters. Code completion is a very powerful feature. No more mistakes when entering the name of an element: the syntax errors are reduced. Simply select the desired word and press Enter to validate. You can focus on the algorithm.
|When typing this WLanguage code in the code editor, you probably noticed that the different elements use different colors. This is called syntax highlighting. The code editor allows you to easily identify the different elements handled by the code:|
These colors can be modified element by element in the options of the code editor (on the "Home" tab, in the "Environment" group, expand "Options" and select "Options of the code editor").
- the WLanguage functions are colored in blue,
- the character strings are colored in purple,
- the names of the controls are colored in cyan.
displays the message passed as parameter.
- Save the changes by clicking in the quick access buttons or by pressing Ctrl + S.
- Close the code editor (click the "X" icon in the upper-right corner of the code editor). The window editor appears again.
We will test this project in the following lesson.