Tutorial Windev Mobile 21
Tutorial Windev Mobile 21
Tutorial Windev Mobile 21
Don't forget to visit our site (www.windev.com) on a regular basis to find out whether upgraded
versions are available.
This documentation is not contractually binding. PC SOFT reserves the right to modify or delete
any topic dealt with in this document.
All product names or other trademarks mentioned in this publication are registered trademarks of their respective owners.
PC SOFT 2016: This publication may not be reproduced in part or in whole in any form without the express permission of PC SOFT.
Summary
Introduction
Preliminary points...................................................................................................................................................11
Overview of the tutorial...........................................................................................................................................11
How to access the online help?............................................................................................................................. 12
Legend of symbols..................................................................................................................................................15
If you are familiar with WINDEV Mobile 20...........................................................................................................15
What is WINDEV Mobile used for?.........................................................................................................................15
Summary 3
Summary
Summary 5
Summary
Summary 7
Summary
Conclusion
Summary 9
10
Summary
Introduction
Preliminary points
Caution: This manual is a tutorial. We advise you to check the online help when you are using
WINDEV Mobile.
The aim of the tutorial is to help you discover WINDEV Mobile, become familiar with the editors
and teach you the concepts of WINDEV Mobile. This manual does not cover all the features of
WINDEV Mobile.
This manual is intended for the developers who are already familiar with WINDEV. This manual
only presents the main concepts required to develop an application for a mobile device (operating
in Android, iPhone, iPad, Windows Mobile, ...).
If you are not familiar with WINDEV, we recommend that you to read the WINDEV tutorial
beforehand.
Note: To receive the WINDEV tutorial, get in touch with the sales department of PC SOFT.
You should plan on spending a few hours to follow this course and to learn WINDEV Mobile: you'll
find it well worth it!
WINDEV Mobile evolving all the time, the screen shots found in this course may differ from the
windows displayed in your product.
Notes
The tutorial was intended to help you develop on the main mobile platforms:
Android.
iOS (iPhone/iPad).
Windows Mobile/CE.
This tutorial includes the following parts:
Part 1: Overview of WINDEV Mobile.
Part 2: Creating and deploying a first Android application.
Part 3: Creating and deploying a first iOS application.
Part 4: Quick reminder of the main concepts of WINDEV Mobile and WLanguage.
Part 5: Creating an application for data management for Android and iOS. This part is common
to Android and iOS and it allows you de create management windows for these two platforms.
Part 6: Creating applications for Windows Mobile.
WINDEV Mobile can also be used to develop Windows Universal apps applications
(that operate in Windows 10: Windows 10 tablets and PCs running Windows 10).
See the online help for more details.
Introduction 11
The tutorial was designed to progressively teach you how to use WINDEV Mobile. By following this
course:
you will discover the main concepts explained informally ; these are the concepts you must
learn and understand.
you will also be asked to perform operations that illustrate the concepts just explained.
As you progress through the tutorial, if you want to take a closer look at a concept or if you want to
get more details about a programming function, see the online help (accessible from the editors).
The size of a lesson is not necessarily proportional to its relevance...
Tip
And don't forget to take a look at the examples supplied with WINDEV Mobile: they are very
instructive!
The tutorial may have evolved since this document was published. Don't forget
to check the online version of the tutorial. The PDF file is accessible from the
menu of WINDEV Mobile: on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "Tutorial (PDF)".
12
Introduction
Introduction 13
Notes
The online help of WINDEV, WEBDEV and WINDEV Mobile on Internet is available
from any computer equipped with an Internet access, without the product being
necessarily installed. This help is updated on a regular basis.
Each Web user can add comments about the documentation pages: personal
notes, examples, links and so on.
Note: If you have no access to Internet, you have the ability to start the local help from the product:
1.On the "Home" pane, in the "Environment" group, expand "Options" and select "General
options of WINDEV Mobile".
2.In the "Help" tab, select:
the access mode to the help database.
the content of the help: help common to WINDEV, WEBDEV and WINDEV Mobile or help
about the product currently used.
14
Introduction
Legend of symbols
This symbol indicates the duration of the lesson. Please note that the actual time may
vary according to your level of experience.
An example is available to complement the lesson. The examples are available in the
home window of WINDEV Mobile.
This symbol introduces a "Tip": we strongly advise you to read the associated text.
This symbol introduces a "Warning": reading the associated text is extremely important.
This symbol introduces a "Note": we recommend that you read the associated text.
Introduction 15
Unlike other programming languages, there is no need to find and add modules to be able to
design, check and install an application.
The 5GL (5th Generation Language) of WINDEV Mobile, named WLanguage, will surprise you by
its simplicity: a few hours are all you need to get the hang of it, a week is usually all it takes to fully
master its potential!
No more programming hassle, WLanguage is available in English and in French!
16
:
Introduction
PART 1
Overview of
WINDEV Mobile
18
Overview
WINDEV Mobile is an IDE (Integrated Development Environment) allowing you to develop
applications for Android, iOS, Windows Phone, Windows Mobile, .... in a wide variety of fields:
business, industrial, medical, hospitality, ... The developed applications can give access to
information stored in the databases.
This tutorial will explain how to create your applications (with or without database) and how to
improve them by using the different features proposed by WINDEV Mobile.
If WINDEV Mobile 21 was already started, identify yourself il necessary. The development
environment is started. The home window is displayed. This home window is used to:
create a project,
open an existing project,
open an example,
open one of the projects found in the tutorial.
Let's take a look at the development environment of WINDEV Mobile. To do so, from the home
window:
Click "Tutorial".
Click "iOS/Android application (Answer)".
The corresponding project is opened in the editor.
20
Development environment
The editor
The development environment of WINDEV Mobile includes a specific interface and several editors
allowing you to create the different elements of your applications.
For example, the window editor is used to create windows, the report editor is used to create
reports, ...
All the editors are using the same environment:
1. Menu of editors, displayed in the shape of a ribbon (we'll see how to use it in the next paragraph).
2. Current editor (window editor here). This space allows you to view the element currently created
or modified in WYSIWYG (What You See Is What You Get).
3. Panes. The interface of WINDEV Mobile includes several panes allowing you to quickly access
different types of information.
Some examples:
the "Project explorer" pane (displayed on the right) is used to list all the project elements by
category.
the search pane (displayed at the bottom) is used to perform searches in the entire project and
in its elements.
22
The different ribbon panes are used to access the options of the different editors for the current
project. Several types of panes are available:
the current pane: The name of the current pane is displayed on a white background and an
orange line is displayed above the name.
the popup panes, specific to the current element: The name of the pane is displayed in orange.
the available panes: The name of the pane is displayed in white.
The option area
The options displayed in the ribbon differ according to the selected pane. Several types of options
are available:
Options to check,
Buttons to click,
Button with arrow used to expand the options. Two types of buttons with arrow are available:
the buttons with arrow used to expand a menu
the buttons with arrow used either to expand a menu (click on the arrow), or to perform a
default action (click on the button icon).
The options are organized by group. Each group of options has a name and it can also include a
group button
. This button is used to perform a specific action according to the current group:
displaying the description of the current element, displaying the help, ...
In this tutorial, to identify a menu option, we will be talking about panes and groups.
For example:
To display the help, on the "Home" pane, in the "Online help" group, click "Help".
24
PART 2
Android
application
26
Lesson 2.1. My
first
Android
project
Estimated time: 1 h
Overview
To start working with WINDEV Mobile, we are going to create a first project. This project will contain
a window used to display a message.
This first example will present the main concepts of development with WINDEV Mobile.
Before creating our first project for Android, a configuration of the development computer is
required.
My first project
Creating the project
Answer
1.Start WINDEV Mobile 21 (if not already done). Close (if necessary) the current project in order
to display the home window.
28
2.In the home window, click "Create a project" then "Android application".
Notes
3.The wizard for project creation starts. The different wizard steps help you create your
project. The information specified in this wizard can be modified later.
Tip: Other method for creating a project:
1.Click
among the quick access buttons of the WINDEV Mobile menu.
2.The window for creating a new element is displayed: click "Project".
4.The first wizard step is used to enter the name of the project, its location and its description.
In our case, this project will be named "My_Android_Project". WINDEV Mobile proposes to
create this project in the "\My Mobile projects\My_Android_Project" directory. You can keep
this location or modify it via the [...] button.
5.Go to the next step via the arrows found at the bottom.
6.The wizard proposes to add documents. Keep the default options and go to the next step.
Note
7.The wizard proposes to choose the type of Android devices affected by the project:
Generate an application for phones and tablets.
Generate an application for phones only.
Generate an application for tablets only.
Generate an application for a specific device.
If the application is intended to operate on several Android devices (phones
with different sizes or resolutions for example), we advise you to use one of the
following options: "Generate an application for phones and tablets", "Generate
an application for phones only" or "Generate an application for tablets only".
In this case, WINDEV Mobile proposes the smallest resolution to create the
application windows. Using anchors (see page 43 and page 125) will allow the
application to operate on all the devices.
Note
8.In this example, we are going to generate an application for phones. Select "Generate an
application for phones only" and go to the next step.
30
You own an Android device and you want to run the test of the created application
on this device? Select "Generate an application for a specific device". The wizard
next step is used to select the requested device.
9.In the left section of the wizard, click "Charters". This step is used to define the
programming charter. Don't modify the suggested options. Go to the next step.
10.This step is used to define the style book of the application. We will keep "Material Design
Blue Grey".
11.The other wizard steps not being important for our first project, click "End" in the left
section of the wizard.
12.Click the validation button at the bottom of the wizard. The project is automatically created.
13.The window for creating a new element is displayed. This window is used to create all the
elements that can be associated with a project.
My first window
Overview
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 may be surprised by
how intuitive and how easy it is to use the editor of WINDEV Mobile. 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 application with WINDEV Mobile.
Creating the window
1.In the window for creating a new element, click "Window" then "Window".
Note
As a new project was created, the window for creating a new element is
automatically displayed.
To display the window for creating a new element, all you have to do is click
among the quick access buttons of the WINDEV Mobile:
Note
32
Note
the title of the element: enter "Welcome". In our case, this title will be displayed in the Action
Bar of the window.
the name of the element that corresponds to the name of the window. This name will be
used in programming. By default, this name includes "WIN_" that corresponds to the
programming charter and "Welcome" that corresponds to the title of the window.
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 is using a programming charter.
The programming charter 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_",
etc.
If you do not want to use this charter, all you have to do is disable it: on the
"Project" pane, in the "Other actions" group, expand "Charter" and uncheck "Use
the charter".
the location that corresponds to the file name created for the window. The window is a file
whose extension is "WDW", saved in the project directory.
Notes
Validate the description window of the control (green button). The new control caption
appears in the window editor.
We are going to display a message in a dialog box (a small window proposed by the system).
Notes
Notes
1.Select the "Display" button with the mouse: all you have to do is click it.
2.Display the popup menu of the control (right mouse click).
3.Select "Code". This option opens the code editor of WINDEV Mobile, where all the
WLanguage statements can be entered.
34
The code editor proposes different processes for each type of control. These
processes correspond to the events linked to the control.
Therefore, two processes are displayed for the "Button" control:
Initialization, run when displaying the window.
Click on the button, run when the user clicks the button.
Note: Additional processes can be added if necessary.
Notes
Note about the assisted input: As soon as the first two characters are typed, WINDEV Mobile
proposes all the words of the WLanguage vocabulary containing these characters. The assisted
development is a very powerful feature. No more mistake when typing the name of an element:
the syntax errors are reduced. All you have to do is select the requested word and validate by
pressing [ENTER]. You can focus on the algorithm.
When typing this code in the code editor, you have noticed that different colors
are used by the different elements. This is the syntactic coloring. The code editor
allows you to easily identify the different elements handled by the code:
the WLanguage functions are colored in blue,
the character strings (between quotes) are colored in purple,
the names of controls are colored in cyan.
These colors can be modified element by element in the code editor options
(on the "Home" pane, in the "Environment" group, expand "Options" and select
"Options of the code editor").
Close the code editor (cross at the top right of the code editor). The window editor is redisplayed.
First test
Notes
For an Android application, WINDEV Mobile allows you to run the test of the application on the
development computer via the simulation mode. This test simulates an Android device on the
development computer. This test is useful when the developer has no Android device. However,
this test does not allow you to use the hardware components of the device (GPS, SMS, camera, ...).
WINDEV Mobile also allows you to run a test of the application via the Android
emulator (AVD) supplied with the SDK.
See the online help for more details.
Any developer knows that running a program test can be a long and tiresome job. In WINDEV
Mobile, a SINGLE CLICK allows you to run the test of the window, report or procedure while
you are creating it. This is both simple and fast!
Click the "x" button found in the simulator shell to close the window.
The editor of WINDEV Mobile is redisplayed.
First deployment on the device
Principle
To run the application in stand-alone mode on the Android device, you must:
Connect the device via a USB port.
Generate the application. An "apk" file will be created. This file contains all the elements required
to run the application on an Android device.
Select your device at the end of generation. Copying the application ("apk" file) can take several
seconds.
Let's take a look at these different steps.
36
Implementation
1.On the "Project" pane, in the "Generation" group, click "Generate" (you also have the ability to
click
among the quick access buttons).
2.WINDEV Mobile proposes to select the first project window. In our example, select "WIN_
Welcome" and validate (green button at the bottom of the screen).
7.Go to the next step by clicking the arrow keys at the bottom of the window. This step is used
to define:
the splash screen of the application,
the information saved in the manifest,
the start mode of the application (when the device is started or not).
8.Go to the next step. The wizard is used to define the version number of the application.
9.Go to the next step. This step is used to sign the application. The wizard proposes a generic
signature that can be used for the tests of the application. A specific signature is required to
distribute the application. See the online help for more details.
10.Go to the next step. The wizard allows you to include specific files (data files, images, ...).
This possibility will not be used in our example. Keep the default options.
11.Go to the next step. The wizard allows you to include specific libraries. Keep the default
options.
12.Go to the next step. The wizard allows you to include Maven libraries used by the project.
Keep the default options.
13.Go to the next step. The wizard is used to define the permissions of the application.
By default, according to the WLanguage functions used in the application, WINDEV Mobile
detects the necessary permissions.
14.Go to the next step. You have the ability to restrict the download of the application on
Google Play store to the devices equipped with the features used. This possibility will not be
used in our example. Keep the default options.
15.Go to the next step. The wizard is used to configure the options of Android SDK. Keep the
default options.
38
Notes
16.Go to the next step. The wizard is used to specify whether the application must be copied
and run on the device connected to the computer or on an emulator.
If this option is checked, a new window is displayed at the end of generation. This window
allows you to select the runtime device.
That's it, our first application is generated and run on the Android device.
Notes
To run the test of your application on the cell phone, select "GO - Run the project
test (mobile device)": the generation will be performed and the application will be
copied and run on the cell phone connected to the current computer.
40
Caution: The USB debugging must be enabled in order to run the tests on the
phone. If this operation is not performed, the phone will not be detected by
WINDEV Mobile.
To enable the USB debugging:
1.On the phone, select the "Parameters" menu.
2.Select "About the device".
3.Click "Build number" several times to enable the developer mode.
4.Move one level up.
5.The "Development option" choice appears. Select this option.
6.Check "USB debugging".
Note: The operations to perform may change according to the version of the
phone and to its make. For example, for a Samsung Galaxy Notes 3, you must
"tap" several times the "Version number" control found in the "About the device"
option in order to enable "Development option". In any case, a Google search with
"usb debugging <device name>" allows you to get the operating mode adapted to
the device used.
Overview
The Android system is available on the phones and on the tablets. WINDEV Mobile allows you to
easily create interfaces that adapt to the device used.
42
Answer
Open (if necessary) the "My_Android_Project" project that was created in the previous lesson.
A corrected project is available. To open this project, on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "My Android project (Answer)".
In our example, the project was created for a phone and its test was run in portrait mode in the
simulator.
We are now going to run its test in landscape mode in the simulator.
4.The orientation of the window changes on the screen. In our example, the location of the
button does not change: it does not adapt to the orientation of the screen.
We are now going to modify our window in order for the "Display" button to be centered in the
window and to remain centered regardless of the device orientation.
In order for the button to remain centered in the window, we are going to use the control
anchoring:
1.Select the button (click the button).
2.Display the popup menu (right mouse click).
3.Select "Anchor": the window for defining anchors is displayed:
Notes
44
Management of touchscreen
One of the most important aspects of the interface for a mobile application is the management of
the touchscreen feature.
A "multitouch" feature is a technique allowing the user to interact with a device via several contact
points.
Handling images is one of the most common features of the multi-touch. The display size on a
phone being reduced, it is often necessary to perform a zoom and/or to move in an image.
This allows you to perform a zoom on an image via the contact of 2 fingers moving apart.
To manage the "multi-touch", WINDEV Mobile proposes:
Specific options available in the Image control.
Specific WLanguage functions.
Specific optional processes.
See the online help for more details.
Practical example
Answer
Open (if necessary) the "My_Android_Project" project that was created in the previous lesson.
A corrected project is available. To open this project, on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "My Android project (Answer)".
1.On the "Creation" pane, in the "Usual controls" group, click "Image".
2.The Image control appears in creation under the mouse.
3.Move the mouse in the window toward the position where the control must be created. To
drop the control in the window, all you have to do is perform a new left mouse click.
4.Double-click the Image control: the description window of the control is displayed.
5.In the "General" tab, select an image found on your disk in the "Image" edit control via the
file picker([...] button).
6.If the image is found in a directory other than the project directory, WINDEV Mobile proposes
to copy the image file into the project directory. Accept by clicking the "Copy the file into the
suggested directory" button.
7.Display the "Details" tab: the options for managing the multi-touch are displayed:
Notes
46
the
application
This lesson will teach you the following concepts...
Generating the APK
Available distribution modes
48
Overview
WINDEV Mobile allows you to develop applications for the Android operating system.
Once the applications are created, developed and checked, all you have to do is deploy them.
Several deployment modes are available:
Deployment via Android Market/Google Play (or another market).
Deployment on a Web server.
Deployment from the PC via ADB.
Deployment by copy.
2.Add a link into the Web page for download. This link has the following format:
<a href='Path of apk file on the server'>Link</a>
50
PART 3
iOS
application
52
Lesson 3.1. My
Overview
To start working with WINDEV Mobile, we are going to create a first project. This project will contain
a window used to display a message.
This first example will present the main concepts of development with WINDEV Mobile.
Before creating our first project for iOS, a configuration of the development computer is required.
WINDEV Mobile 21 is a Windows application that can be used in Windows Vista, 10, ...
The application will be created on the PC before it is compiled on a Mac (project, analysis,
windows, ...).
This PC requires no setup of Mac/Apple tools.
Why a Mac?
A Mac is required because the project generated on the PC must be compiled in a specific compiler
to generate the iOS applications. The minimum version of the operating system must be version
10.8 (Mountain Lion).
Xcode is a development environment that is used to develop iOS applications (iPhone and iPad).
This tool will be used to compile the applications generated with WINDEV Mobile.
The minimum recommended version of Xcode is version 5.
See the online help for more details (download addresses, ...).
54
My first project
Create the project
Answer
1.Start WINDEV Mobile 21 (if not already done). Close (if necessary) the current project in order
to display the home window.
2.In the home window, click the "Create a project" icon then "iOS application".
Notes
3.The wizard for project creation starts. The different wizard steps help you create your
project. The information specified in this wizard can be modified later.
4.The wizard proposes to enter the name of the project, its location and its description.
Note
In our case, this project will be named "My_iOS_Project". WINDEV Mobile proposes to create this
project in the "\My Mobile projects\My_iOS_Project" directory. You can keep this location or
modify it via the [...] button.
5.Go to the next step via the arrows found at the bottom.
6.The wizard proposes to add documents. Keep the default options and go to the next step.
7.The wizard proposes to choose the type of devices affected by the project:
Generate an application for iPhone and iPad.
Generate an application for iPhone only.
Generate an application for iPad only.
Generate an application for a specific device.
If the application is intended to operate on several iOS devices (phones with
different sizes or with different resolutions for example), we advise you to use
one of the following options: "Generate an application for iPhone and iPad",
"Generate an application for iPhone only" or "Generate an application for iPad
only".
In this case, WINDEV Mobile proposes the smallest resolution to create the
application windows. Using anchors (see page 69 and page 125) will allow the
application to operate on all the devices.
56
9.In the left section of the wizard, click "Charters". This step is used to define the programming
charter. Don't modify the suggested options. Go to the next screen via the arrows found at the
bottom.
10.This step is used to define the style book of the application. We will choose "ActivePhone
7".
11.The other wizard steps not being important for our first project, click "End" in the left
section of the wizard.
12.Click the validation button at the bottom of the wizard. The project is automatically created.
13.The window for creating a new element is displayed. This window is used to create all the
elements that can be associated with a project.
My first window
Overview
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 may be surprised by
how intuitive and how easy it is to use the editor of WINDEV Mobile. 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 iOS application with WINDEV Mobile.
Creating the window
1.In the window for creating a new element, click "Window" then "Window".
Note
As a new project was created, the window for creating a new element is
automatically displayed.
To display the window for creating a new element, all you have to do is click
among the quick access buttons of the WINDEV Mobile:
Note
58
Note
the title of the element: enter "Welcome". In our case, this title will be displayed in the title
bar of the window.
the name of the element that corresponds to the name of the window. This name will be
used in programming. By default, this name includes "WIN_" that corresponds to the
programming charter and "Welcome" that corresponds to the title of the window.
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 is using a programming charter.
The programming charter 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_",
etc.
If you don't want to use this charter, all you have to do is disable it: on the
"Project" pane, in the "Other actions" group, expand "Charter" and uncheck "Use
the charter".
the location that corresponds to the file name created for the window. The window is a file
whose extension is "WDW", saved in the project directory.
Notes
Validate the description window of the control (green button). The control appears in the
window editor.
We are going to display a message in a dialog box (a small window proposed by the system).
Notes
Notes
1.Select the "Display" button with the mouse: all you have to do is click it.
2.Display the popup menu of the control (right mouse click).
3.Select "Code". This option opens the code editor of WINDEV Mobile, where all the
WLanguage statements can be entered.
60
The code editor proposes different processes for each type of control. These
processes correspond to the events linked to the control.
Therefore, two processes are displayed for the "Button" control:
Initialization, run when displaying the window.
Click the button, run when the user clicks the button.
Note: Additional processes can be added if necessary.
Notes
Note about the assisted input: As soon as the first two characters are typed, WINDEV Mobile
proposes all the words of the WLanguage vocabulary containing these characters. The assisted
development is a very powerful feature. No more mistake when typing the name of an element:
the syntax errors are reduced. All you have to do is select the requested word and validate by
pressing [ENTER]. You can focus on the algorithm.
When typing this code in the code editor, you have noticed that different colors
are used by the different elements. This is the syntactic coloring. The code editor
allows you to easily identify the different elements handled by the code:
the WLanguage functions are colored in blue,
the character strings (between quotes) are colored in purple,
the names of controls are colored in cyan.
These colors can be modified element by element in the code editor options
(on the "Home" pane, in the "Environment" group, expand "Options" and select
"Options of the code editor").
Close the code editor (cross at the top right of the code editor). The window re-appears.
First test
For an iOS application, WINDEV Mobile allows you to run the test of the application on the
development computer via the simulation mode. This test simulates an iOS device on the
development computer. This test is useful when the developer has no Mac device to compile the
application. However, this test does not allow you to use the hardware components of the device
(GPS, SMS, camera, ...).
Any developer knows that running a program test can be a long and tiresome job. In WINDEV
Mobile, a SINGLE CLICK allows you to run the test of the window, report or procedure while
you are creating it. This is both simple and fast!
Click the "x" button found in the simulator shell to close the window.
The editor of WINDEV Mobile is redisplayed.
First deployment on the device
Principle
To run the application in stand-alone mode on the device, you must:
Generate the iOS application (or Xcode project) in WINDEV Mobile.
Transfer the generated Xcode project onto the Mac in order to compile it.
Connect your device to your Mac and compile the Xcode project in order to generate the program
for the connected device.
Then, the program will be installed on the device. It will run in stand-alone mode.
Let's take a look at these different steps.
Implementation
1.On the "Project" pane, in the "Generation" group, click "Generate" (you also have the ability to
among the quick access buttons).
click
2.WINDEV Mobile proposes to select the first project window. In our example, select the "WIN_
Welcome" window and validate (green button at the bottom of the screen).
62
Notes
5.Go to the next step. Specify the path of the different icons found in the application. Several
icons must be supplied:
icons for iPad and iPad Retina,
icons for all the models of iPhone (the iPhone 4 has a different resolution with the Retina
screen).
6.Go to the next step. Specify the path of the different images used when starting the
application for iPad and for iPhone (images in PNG format). Default images are automatically
created for your application.
7.Go to the next step. Specify the version number of the generated application.
8.Go to the next step. This step is used to include specific files (data files, images, ...). This
possibility will not be used in our example. Keep the default options.
9.Go to the next step. This step is used to specify:
the minimum iOS version required to run the application.
whether files can be shared with iTunes. If this option is checked, you will have the ability to
retrieve the application files on Mac during the synchronization. For example, if data files
have been supplied with the application, the iTunes application will allow you to retrieve
these files.
10.Validate the wizard. The generation is performed in the EXE folder of the project directory.
The directory containing the source code that will be used on Mac is named "Project_name.
xcode.gen" ("My_iOS_Project.xcode.gen" in our example). This is the directory that must be
copied onto Mac. Click the "Open the generation directory" button.
The other operations must be performed on the Mac. You must:
Transfer the WINDEV Mobile project onto Mac.
Compile the project in Xcode.
Transfer the WINDEV Mobile project onto Mac
1.Copy the entire folder generated in the EXE directory onto an external media (USB key, external
hard disk, shared directory with MAC on network). This directory is named <Project Name>.
xcode.gen.
2.Paste this folder onto the MAC where the application will be compiled.
3.Open the folder on MAC and double-click the folder named "Project_name.xcodeproj".
4.The project is opened in Xcode.
1.In the drop-down list found in the top left corner, select the compilation options. Select the
scheme corresponding to your application then the compilation target (device currently
connected or a simulator).
2.To start the compilation, select "Product .. Clean" then "Product .. Build".
3.A status report of compilation is displayed at the top ("Succeeded" or the number of
warnings and errors otherwise). You have the ability to click these symbols to see the list of
errors/warnings.
4.Once the program is compiled without error, you can start the simulation ("Product .. Run").
The simulation window appears with the application.
Then, you have the ability to run the test of your application on your iPhone or iPad.
64
Overview
The iOS system is available on the phones (iPhone), on the tablets (iPad) and on the iPod. WINDEV
Mobile allows you to easily create interfaces that adapt to the device used.
66
This orientation is defined in the "IHM" tab of the description window of the window ("Description"
from the popup menu of the window).
Answer
Open (if necessary) the "My_iOS_Project" project that was created in the previous lesson.
A corrected project is available. This project contains the different windows
created in this lesson. To open the corrected project, on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "My iOS project (Answer)".
In our example, the project was created for a phone and its test was run in portrait mode in the
simulator.
We are now going to run its test in landscape mode in the simulator.
We are now going to modify our window in order for the "Display" button to be centered in the
window and to remain centered regardless of the device orientation.
In order for the button to remain centered in the window, we are going to use the control
anchoring:
1.Select the button (click the button).
2.Display the popup menu (right mouse click).
68
Notes
Management of touchscreen
One of the most important aspects of the interface for a mobile application is the management of
the touchscreen feature.
A "multitouch" feature is a technique allowing the user to interact with a device via several contact
points.
Handling images is one of the most common features of the multi-touch. The display size on a
phone being reduced, it is often necessary to perform a zoom and/or to move in an image.
This allows you to perform a zoom on an image via the contact of 2 fingers moving apart.
To manage the "multi-touch", WINDEV Mobile proposes:
Specific options available in the Image control.
Specific WLanguage functions.
Specific optional processes.
See the online help for more details.
Practical example
Answer
Open (if necessary) the "My_iOS_Project" project that was created in the previous lesson.
A corrected project is available. To open this project, on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "My iOS project (Answer)".
1.On the "Creation" pane, in the "Usual controls" group, click "Image".
2.The Image control appears in creation under the mouse.
3.Move the mouse in the window toward the position where the control must be created. To
drop the control in the window, all you have to do is perform a new left mouse click.
4.Double-click the Image control: the description window of the control is displayed.
5.In the "General" tab, select an image found on your disk in the "Image" edit control via the
file picker([...] button).
6.If the image is found in a directory other than the project directory, WINDEV Mobile proposes
to copy the image file into the project directory. Accept by clicking the "Copy the file into the
suggested directory" button.
7.Display the "Details" tab: the options for managing the multi-touch are displayed:
70
Notes
11.A GUI error appears in the error pane: the automatic scrollbars of the window are in conflict
with the scroll features of the Image controls.
12.To avoid this GUI error, disable the scrollbars of the window:
Display the description window of the window ("Description" from the popup menu).
In the "GUI" tab, uncheck "Automatic scrollbars".
Validate the description window.
among the quick access buttons). The GUI error disappears.
13.Save the window (click
Multi-touch support cannot be tested in the simulator. To check this feature,
you need to deploy the application on the mobile device. We'll see how to do
this in Android and iOS: Developing an application, page 95.
the
application
This lesson will teach you the following concepts...
Available distribution modes
72
Overview
WINDEV Mobile allows you to develop applications for the iOS operating system.
Once the applications are created, developed and checked, all you have to do is deploy them.
Deployment
Three methods can be used to deploy the application on a device (iPhone or iPad).
Via App Store: This type of distribution allows you to distribute your application without any
restrictions via the sales network of App Store. Your application will include the signature linked
to your certificate but it will not be linked to a single device.
Via an In-House network: This type of distribution allows you to distribute your application via a
Web server to a group of users working for the same company. To use this type of distribution,
you must register to the iOS Developer Enterprise program. Your application will include the
signature linked to your certificate but it will not be linked to a single device.
Via an Ad Hoc network: This type of distribution allows you to install the application on a network
containing up to 100 devices (iPhone or iPad). The application must be recompiled for the target
device by including the certificate for the signature as well as the unique identifier of the device.
Caution: To run the test of the application and/or to deploy the application on a device (iPhone or
iPad), you must register toward the iOS Developer Program. This registration is not free of charge.
The list of registration programs is available from the following address:
http://developer.apple.com/programs/which-program/
Three types of registration are available:
iOS Developer Program - Individuals
iOS Developer Program - Organizations
iOS Developer Enterprise Program
This registration is used to get a developer certificate allowing you to sign your applications in
order to compile them and to distribute them. This certificate is not free of charge. This developer
certificate is required even for a simple setup for test (debug) on a device.
74
PART 4
Programming
concepts
76
and terminology
Overview
In the previous parts, we have created our first Android application and/or our first iOS application.
After these exercises, let's talk about the main concepts of WINDEV Mobile and about the
terminology specific to WINDEV Mobile.
Main concepts
WINDEV Mobile allows you to easily create an application. But what is an Application?
An application is a tool used to automatically perform tasks, actions.
To create an application, WINDEV Mobile proposes to create a project. A project links and
organizes the different program elements. The program corresponding to the application will be
created from the project.
Notes
If your application is using data, WINDEV Mobile allows you to define the structure of the database
via the analysis. The WINDEV Mobile analysis contains the description of the files (also called
"Tables" in several databases). These files will contain the application data.
Describing the data files in the analysis does not mean that they are created. The
data files are physically created when running the application.
One or more WINDEV Mobile projects can be linked to the same analysis. In this case, we talk of
shared analysis. For example, an application for business management can be divided into several
modules. Each module is using the same analysis (at run time, each application can also use the
same data files).
Project 1
Classes
Style
sheet
Windows
and controls
Analysis
Project 2
Classes
78
Style
sheet
Project N
Windows
and controls
Classes
Style
sheet
Windows
and controls
Terminology
As already seen, a WINDEV Mobile project (linked to an analysis if necessary) is used to create an
application. Before we actually start working with WINDEV Mobile, let's go back to the vocabulary
used in WINDEV Mobile. Indeed, several terms are specific to WINDEV Mobile and they may differ
from the ones used in other tools.
In the analysis, the terms used are as follows:
File: The analysis is used to describe the structure of the database files. A "File" may
correspond to a "table" in other databases.
In WINDEV Mobile, "Table" is a term that defines a graphic object used to view the content of
a data file in table format and/or to enter rows. A table can be used to enter the details of an
order for example.
Record: A record is sometimes called row. A file record corresponds to all the items defined for
the file.
Item: In the analysis, an item represents a section of a data file. All the items found in a data
file are used to define the structure of a record.
Key/Index: With WINDEV Mobile and its HFSQL database, the concept of index is linked to the
concept of key. The concept of key is part of the characteristics of an item. The keys are used to
improve the speed for accessing the data and to simplify the browse operations performed on
the data files. In WINDEV Mobile, if a HFSQL data file includes several key items, a single index
file will be created at run time.
In the windows and reports, the terms used are as follows:
Window: The windows are used to display or enter information. The windows are also called
"Screens" or "Dialog boxes". The user can directly act on the windows via controls, buttons, ...
Report: The reports are used to get a custom view of information. This information can come
from the database, from text files, from controls found in the windows, ... The reports can be
generated in PDF in the mobile applications.
Control: "Control" is the term used to identify the different graphic objects displayed in a window
or in a report.
Skin template: The skin template is used to define the "appearance" of the application: visual
appearance of windows, buttons, controls, ...
Style: The style groups the graphic characteristics of an element: background image, border,
font, .... The styles of the different elements found in the interface of a WINDEV Mobile
application are grouped in a style sheet.
concepts
80
Introduction
In the previous lesson, we have worked with the code editor of WINDEV Mobile and its language
named WLanguage. This lesson allows you to discover the programming concepts of WLanguage
by presenting the following topics:
Declaring the different types of variables,
Main statements of WLanguage,
Procedures and functions,
Processing strings,
Processing numeric values.
Some examples:
Notes
Subscript is int
SupplierName is string
PriceTable is array of 10 currencies
I, J, K are ints
Counter is int = 120
B1 is boolean = False
Caution!
The global variables can be global to the project, to a window or to a report. All you have to do is
declare these variables:
in the initialization code of the project, to declare the global variables of the project. These
variables can be used in all the processes of the project and project elements (windows,
reports,...)
in the declaration code of the global variables of the window, to declare the global variables
of the window. These variables can be used in all the processes of the window and window
elements.
in the declaration code of the global variables of the report, to declare the global variables of
the report. These variables can be used in all the processes of the report and report elements.
All the variables declared elsewhere are local variables.
Most developers are tempted to declare all their variables as "global variables" in
a project. This type of programming is quite "easy". All the variables being global
variables, they can be handled from any process.
But this type of programming often causes overwritten variables and exception
problems.
Therefore, we advise you to declare a limited number of global variables and to
declare local variables when necessary.
If you want to share values between 2 windows, we highly recommend that you
use the method for "passing parameters" that will be presented later in this
tutorial.
82
Conditional statements
WLanguage allows you to manage the conditional statements such as:
IF, THEN, ELSE, END to run a test on a condition.
SWITCH, CASE, END to perform one or more actions according to the result of a test on a
condition.
Some examples
IF EDT_Maximum > Random(1, 999) THEN
Info("Congratulations, you won!")
ELSE
Info("Bad luck, you've lost!")
END
SWITCH day
CASE "Monday"
// First day of the week
CASE "Wednesday"
// Third day of the week
CASE "Friday"
// Fifth day of the week
CASE "Saturday", "Sunday"
// It's the weekend
OTHER CASE
// It's another day
END
Loop statements
Notes
Some examples
FOR i = 1 TO 100
// There is no need to declare i
Ctr ++ // Equivalent to Ctr=Ctr+1
END
i is int = 0
WHILE i < EDT_Maximum
i ++ // Equivalent to i=i+1
END
i is int = 0
LOOP
i ++ // Equivalent to i=i+1
IF i > EDT_Maximum THEN BREAK
END
Comments
To enter comments in the code, the code line must start with // (two "/" characters).
Example:
Tip
Several code lines can be set in comment ; to do so, select the code lines with
the keyboard (or with the mouse) and press the [CTRL] / keys (on the numeric
keypad).
To perform the reverse operation (to remove the comments), select the code
lines with the keyboard (or with the mouse) and press the [CTRL] [SHIFT] / keys
(on the numeric keypad).
84
4.In the window that is displayed, specify the name of the set of procedures and validate.
5.The processes associated with the set of procedures are displayed in the code editor.
Then, you will have the ability to create global procedures (this creation is presented in details in
the rest of this lesson).
How to decide whether a procedure is global or local?
To decide" whether a procedure must be global or local, ask yourself the following question: "Will
the procedure be used in this window only or can it be called from another window?"
If the procedure is called "from this window only", the procedure can be "local".
If the procedure can be called "from other windows", the procedure must be "global".
About passing parameters
A procedure can manage parameters. The parameters can be mandatory or optional parameters.
The "mandatory" parameters are always defined before the "optional" parameters. The declaration
of an "optional" parameter is performed by assigning a default value when declaring the
parameter. For example:
PROCEDURE MyProcedure (Param1, OptionParam = "Default value")
A window can also return a value to the process that called it (value by address by default). See
the online help about ..ReturnedValue for more details.
Calling a procedure
To call a procedure in a process, all you have to do is write its name in the code editor and specify
parameters if necessary.
WINDEV Mobile manages the calls to nested procedures.
86
Tip
In the code editor, when you are positioned on a procedure name, press the [F2]
key if you want to view the code of this procedure. Press [CTRL]+[F2] to go back
to the name of the procedure in the previous code.
Creating a procedure
A procedure can be created from the main editor of WINDEV Mobile. All you have to do is use the
"Project explorer" pane.
1.In the "Project explorer" pane, select the name of the window associated with the local
procedure.
2.Click the arrow on the left to display the different elements.
3.Select "Local procedures".
4.Select "New local procedure" from the popup menu of "Local procedures".
5.In the window that is displayed, specify the name of the procedure and validate.
6.The procedure appears in the code editor. Enter the code of the procedure.
Tip
Reminder: A procedure can also be created from the code selected in the code editor ("New ..
Create a procedure containing the selected code" from the popup menu). That's what we've done
in the previous lesson.
Processing strings
The ability to handle character strings is one of the most important features of a programming
language.
Several WLanguage features can be used to handle the character strings: WLanguage functions,
extraction operators, concatenation operators, ...
The most common functions for handling the character strings will be presented in this tutorial.
See the online help (keyword: "Character string") for more details.
Main operations performed on a character string
Initialization
A text control (a Static control or an edit control for example) can be initialized by one of the
following methods:
in the "Content" tab of the description window of the control:
A string can be built from several other strings. We talk of string concatenation. To concatenate
two strings, all you have to do is use the "+" operator.
// Info is used to display the result on the screen
Info(EDT_Text1 + EDT_Text2)
Extracting sections from a string
// Displays "WinDev"
// Displays "WinDev"
A string can be changed into uppercase characters with Upper or to lowercase characters with
Lower:
Info(Upper(EDT_Text))
Info(Lower(EDT_Text))
You can also find the position of a character string inside another one while ignoring the case. To
do so, Position must be associated with the IgnoreCase constant:
Pos = Position(EDT_Text, StringToFind, 1, IgnoreCase)
To find out the number of occurrences of a given character string inside another character string,
use StringCount:
NbOccurrences is int
NbOccurrences = StringCount("anastasia", "a")
// Returns 4
You also have the ability to find a string and to replace it in a single operation via Replace:
Replace(EDT_Text, "WinDev", "WinDev Mobile")
To build a string from a string and from the result of a function, we recommend
that you use InfoBuild. This function is used to build the text displayed according
to parameters (%1, %2, ...):
InfoBuild("%1 not found in the text", ...
StringToFind)
Tip
90
Tip
Processing currencies
Details
The reals are used to handle the decimal numbers by programming.
The currencies can also be used to manage these decimal numbers but with a better precision.
When using reals, the rounding is performed by the operating system and these rounding
operations may induce calculation errors.
For example:
// The calculation is false with a Double Real variable
MyReal is real
MyReal = 18.6 - 8.6 - 10
Error("18.6 - 8.6 - 10 = " + MyReal)
Note
92
WINDEV Mobile is very flexible when assigning variables. For example, a string of digits can be
assigned in a numeric variable (and conversely). For example:
i
c
i
c
c
i
is int
is string
= 123
= i
// the variable c contains the string "123"
= "456"
= c
// the variable i contains the value 456
To transform a number into a character string while respecting a specific format, all you have to do
is use NumToString. For example:
NumToString(1234.567,"012,3f") // returns "00001234,567"
The code wizard proposed by WINDEV Mobile can be used whenever you want to call NumToString
without exactly knowing which parameters to use: this wizard will inform you of the syntax to use
according to the requested result.
Notes
In the code editor, various information can be displayed when typing the name of
a function followed by the opening bracket:
the name of the wizard corresponding to the function. A wizard starts if this
option is selected. Via simple questions, this wizard automatically writes
the requested syntax.
the name of an example that is using this function. The example is
automatically opened in the editor if this option is selected.
The "reverse" function of NumToString is Val. This function is used to convert a string into a
numeric value.
94
PART 5
Android and iOS:
Developing an
application
96
Overview
Note
Two distinct projects have been created in the previous parts: an iOS project and an Android
project.
This new part will allow you to develop an Android and/or iOS application that is using a HFSQL
Classic database.
This part can be followed both by the developers of Android applications and by
the developers of iOS applications. The operations performed are identical, no
matter whether the project is developed for Android only or for iOS only.
We are going to develop a multi-platform project that can be used both on an Android platform and
on an iOS platform.
Most of the time, when developing an application for Mobile, this application must operate both
on Android and on iOS.
With WINDEV Mobile, there is no need to develop two different projects, to maintain them and to
make them evolve in parallel. All you have to do is create a single project associated with several
platforms, Android and iOS for example: this is called a multi-platform project.
Each project element (windows, queries, ...) can be associated with one or more platforms.
If a window is common to several platforms, the specific features of the platform can be managed
via the layouts. The layout is used to define several views of a window in the same project without
duplicating this window.
When the project is developed, all you have to do is select the requested configuration to create
and deploy the application on the selected platform.
98
In iOS and Android, only the HFSQL database is accessible in native mode. Both
the Classic mode and the Client/Server mode are available.
Note
HFSQL Classic
In HFSQL Classic mode, the data files are stored on the device (iPhone, iPad,
Android phones or tablets).
In this case, the application is stand-alone. No Wi-Fi or 4G connection is required.
The data is stored in the memory of the device. The maximum storage size
depends on the amount of memory on the device.
If the data entered on the mobile device must be synchronized with a database
found on a server (HFSQL or other), the replication must be implemented (see
the online help).
Windows or Linux
HFSQL server
Mobile device
Manta server
Database
Hxxx
functions
,
(read,
write...)
Replication
HFSQL
Client/Server
databases
HFSQL Client/Server
In HFSQL Client/Server mode, no data is stored on the device. The data is stored
on a computer on which a HFSQL server is installed.
Mobile Device 1
Windows or Linux
HFSQL server
Mobile Device 2
Note
Manta server
Mobile Device N
HFSQL
Client/Server
databases
To access this computer and this database, a method for communicating with
the server must be enabled in the mobile application (Wi-Fi or 4G) in order to
connect via the network or Internet.
The response times depend on the quality of the Wi-Fi or Internet network and on
the amount of requested data.
The access to the data will be performed by the Hxxx functions of WLanguage
and/or by SQL queries.
100
Start WINDEV Mobile 21 (if not already done). Close (if necessary) the current project in order
to display the home window.
Answer
To do so, in the home window, click "Tutorial" and select the "iOS/Android application
(Exercise)" project.
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "iOS/Android application (Exercise)".
A corrected project is available. This project contains the different windows
created in this lesson. To open the corrected project, on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "iOS/Android application (with
windows)".
Note
If you want to develop the application for the Android platform, go to Part 5.2 - Developing the
application.
If you want to follow this part for iOS only, you must add the iOS platform (see the next paragraph,
"Enabling the iOS platform").
All the operations performed in this part can be performed on a project
associated with an Android platform, on a project associated with an iOS platform
or on a multi-platform project.
To enable the iOS platform, all you have to do is create a project configuration:
Note
1.On the "Project" pane, in the "Project configuration" group, expand "New configuration" and
select "iPhone/iPad application".
The project configurations are used to define the different types of generation
supported by the project: Android, iOS, component, ...
The project elements can be:
common to several configurations (a window used in iOS and Android for
example).
specific to a configuration (a class used by a component for example).
You can work on a specific configuration at any time: the elements that do not
belong to this configuration are grayed in the project editor.
See the online help for more details.
Note
2.The wizard for creating a project configuration starts. The wizard proposes to create an iOS
platform. Go to the next step.
3.You can enter information regarding the platform. Keep the default options and go to the
next step.
4.The wizard proposes to choose the type of devices affected by the project:
Generate an application for iPhone and iPad.
Generate an application for iPhone only.
Generate an application for iPad only.
Generate an application for a specific device.
If the application is intended to operate on several iOS devices (phones with
different sizes or with different resolutions for example), we advise you to use
one of the following options: "Generate an application for iPhone and iPad",
"Generate an application for iPhone only" or "Generate an application for iPad
only".
In this case, WINDEV Mobile proposes the smallest resolution to create the
application windows. Using anchors (see page 68 and page 125) will allow the
application to operate on all the devices.
102
The presence of the new project configuration can be checked in the project explorer:
1.Expand "Configuration (iOS application)" at the top of the project explorer
2.The two configurations are displayed:
3.To select a specific configuration, all you have to do is double-click the name of the
requested configuration.
4.The iOS configuration that was just created is automatically selected.
Let's now start developing the application.
the application
104
Project analysis
Let's take a look at our initial project. This project contains no window. It only contains the analysis
describing the HFSQL Classic data files that will be used. The corresponding data files are supplied
with data in order to run the different tests.
Notes
We are going to create a window used to list the different products. These products will be
displayed in a "Looper" control.
This window will be created via the wizard for creating RAD windows (Rapid Application
Development).
The wizard for window creation proposes several windows generated by RAD.
These windows, generated from your data, propose modern interfaces for your
applications and they can be immediately used.
Notes
1.Click
among the quick access buttons. The window for creating a new element is
displayed: click "Window" then "Window".
2.In the wizard, select the "Standard" tab. In the "Window RAD for phones" area, choose
"Looper" and validate.
If you are using an iOS configuration, the window for creating a new window
contains additional options, specific to iOS.
You have the ability to create a RAD window whose type is "Looper" on an iOS
platform and on an Android platform.
106
5. The wizard proposes to choose the data source associated with the window. In our case, it
will be the "Product" data file:
The "Data files" option is selected by default.
Select the Product file.
9.The wizard automatically proposes the items of the data file corresponding to the generated
looper.
Generate a creation button in the Action Bar: If this option is selected, the wizard proposes
to generate a form window in edit.
Enable the deletion by row swipe: If this option is selected, the user will have the ability to
delete a looper element by swiping the corresponding row.
Generate the opening code of the form in XXX: If this option is selected, the wizard proposes
to generate a form window in edit or in read-only.
108
13.In our example, keep the default options. Go to the next step.
14.Give a title and a name to the generated window. Enter the title of the window: "List of
products". The name of the window is automatically filled.
Notes
15.Validate the wizard. The window is automatically created, displayed in the editor and
saved.
The data automatically appears in the window displayed in the editor. This
concept is called "Live Data": you see the data found in your files in real time!
This feature is very useful to adapt the size of controls to their content.
We are going to run a first test in the simulator to view the result. Click
access buttons (or press [F9]).
Notes
110
2.Save the window. Specify the title of the window: "Product form". Its name is automatically
proposed: "WIN_Product_form". Validate.
Note
If several platforms are defined in the project, the widow for element backup
proposes to associate the new element to all the platforms.
To associate the element to a single platform, all you have to do is expand
"Configurations" in the backup window and choose the requested platform:
To create the different edit controls used to display information about the product:
1.Display the "Analysis" pane if necessary: on the "Home" pane, in the "Environment" group,
expand "Panes" and select "Analysis". The different data files described in the "WM Managing
Products" analysis appear in the pane.
2.With the mouse, select the items of the "Product" file displayed in the pane (except for the
"ProductID" item).
3.Drag and Drop these items to the window that was just created.
4.Resize the controls ("Name", "Bar code", "Reorder date" and "Description") so that they are
visible in the window.
5.Reorganize the controls in the window. Respect the following order: "Photo", "Name", "Price",
"Quantity", "Bar code", "Reorder date", "Description".
112
FileToScreen is used to display in the controls the data found in the data file, for the current
record. In our case, the current record will be the record selected in the Looper control of the
"WIN_List_of_products" window. This looper is linked to the Product file.
3.Close the code window.
4.Save the window.
Displaying the form from the list of products
Let's see how to display the form of the selected product in the list of products.
1.Position on the "List of products" window: click the "WIN_List_of_products" button in the bar
of opened elements:
2.Right-click the Looper control and select "Code" from the popup menu.
3.In the code window that is displayed, enter the following code in the "Selecting a row of..."
process:
Notes
OpenMobileWindow(WIN_Product_form)
The assisted code input is going to help you: as soon as you type the opening
bracket "(", a drop-down list proposes the name of all the existing windows found
in the project. All you have to do is select the window with the keyboard or with
the mouse.
If the name of the window is not displayed in the list, it means that this window
was not saved beforehand.
First of all, display (if necessary) the "WIN_Product_form" window in the editor: click the
corresponding button in the bar of opened elements.
To add a validation option into the Action Bar of the window:
114
Notes
The description window of the Action Bar is adapted to the platforms used in the
project. Indeed, the Action Bar used in an Android application differs from the
Action Bar used in an iOS application.
If your project is using an Android configuration, only the options corresponding
to the Action Bar for Android are displayed.
Similarly, for an iOS configuration, only the options corresponding to the Action
Bar for iOS are displayed.
If your project is using both an Android configuration and an iOS configuration,
the window displays a preview of the Action Bar for the two platforms.
Numbers allow you to access the options to configure.
We are going to present the options required by our example. See the online help
for more details.
3.Click number 2. The interface for entering an option in the toolbar is displayed.
4.Click the "+" button to add an option. A new default option is created at the top right.
Notes
At run time, the caption of the option appears in the Action Bar:
If no image is associated with the option.
If the option is transferred into menu at the bottom.
In the "Preset image" area, expand the list and select "Validate".
116
Notes
Notes
6.The code of this option will be used to save the modifications performed in the "WIN_
Product_form" window. To enter this code:
Select (if necessary) the Action Bar control of the window.
Click "OK".
A drop-down menu with the "Validate" option is displayed.
This drop-down menu is visible in edit to enter the WLanguage code associated
with the option. This drop-down menu will not be displayed at run time.
When closing the product form, the content of the product list found in the "WIN_List_of_
products" window must be refreshed to take into account the modifications performed in the
form. To do so, use the "Closing a child window" process of the "WIN_List_of_products"
window.
1.Click the "WIN_List_of_products" button in the bar of opened elements:
2.Right-click the window background and select "Code" from the popup menu. The following
code is automatically displayed in the "Closing a child window" process:
LooperDisplay(LOOP_Product,taCurrentSelection)
118
1.Display (if necessary) the "WIN_List_of_products" window in the editor: click the corresponding
button in the bar of opened elements.
2.Select the Action Bar (at the top of the window).
3.Display the description window of the Action Bar: right-click and select "Description" from
the popup menu.
4.Click number 2. The interface for entering an option in the toolbar is displayed.
5.Click the "+" button to add an option. A new default option is created at the top right. Modify
the characteristics of this option:
In the "Caption" area, type "New product".
In the "Preset image" area, expand the list and select "Add".
120
HReset initializes the variables of the items found in the "Product" data file with the default
values to manage a new record.
among the quick access buttons.
7.Save the modifications by clicking
8.Close the code window (click the cross in the top right corner of the code editor).
Let's now check the management of the addition of a new record into the window of the
product form.
1.Display the "WIN_Product_form" window in the editor: click the corresponding button in the
bar of opened elements.
2.Display the code of the validation option in the Action Bar:
Select the Action Bar.
Click "OK".
A drop-down menu with the "Validate" option is displayed.
Select "Code" from the popup menu of the "Validate" option (right mouse click).
The "Click" process does not change:
ScreenToFile()
HSave(Product)
Close()
Display the "WIN_List_of_products" window in the window editor and run its test in the
Notes
If your project is using several platforms, run a GO for each one of the platforms.
The differences regarding the display and the operating modes will appear in the
simulator.
Caution!
Overview
We are going to manage the photo of the product by using the camera of the device.
To do so, we are going to:
create a button to start the camera. The photo will be retrieved in the format of an image in
memory and displayed in the Image control of the product.
create a button used to select a photo in the album found on the mobile.
Creating the button for taking photos
We are going to modify the button in order to associate it with an image representing a
camera:
1.Select the button and display its popup menu (right mouse click).
2.Select "Description". The description window of the control is displayed.
3.In the "General" tab, position on the "Image" edit zone and click the "Catalog" button.
4.The image catalog of WINDEV Mobile is opened. This catalog contains hundreds of images
in different fields, formats and sizes.
5.In the "Find" area at the top, type the word "photo" then select the "Android Holo" theme and
validate. Several images are displayed:
122
7.In the next screen, you have the ability to choose the size of the image, the color, the
orientation, its format and its name.
8.Keep all the default options and specify the name of the image ("Camera").
9.Validate the window.
10.The path of the image is displayed in the button description.
11.Give a name to the button: "BTN_Camera".
12.Clear the caption of the button.
13.Validate the description window.
14.In the editor, reduce the size of the button.
Taking photos
We are going to enter the code used to take a photo and to display it in the Image control of the
product form.
1.Select "Code" from the popup menu of the button (right mouse click).
2.Enter the following code in the "Click" process:
// Local variable
sPhoto is string
// Start the camera
sPhoto = VideoStartApp(viPictureCapture)
IF sPhoto <> "" THEN
IMG_Photo = sPhoto
END
In this code, VideoStartApp is used to start the native camera application of the device in order
to save a video or to take a photo.
among the quick access buttons.
3.Save the modifications by clicking
4.Close the code window (click the cross in the top right corner of the code editor).
Selecting a photo in the photo album
We are going to add a button used to select a photo in the album of the device and to associate it
with the product.
To create the button for selecting the photo, we are going to "Copy - Paste" the button for
The code of this button is used to open the photo album of the device and to select an image
in order to display it in the Image control of the product form.
1.Select "Code" from the popup menu of the button (right mouse click).
2.Replace the code of the "Click" process by the following code:
// Local variable
sPhoto is string
// Start the selection
sPhoto = AlbumPicker(albumImage)
IF sPhoto <> "" THEN
IMG_Photo = sPhoto
END
In this code, AlbumPicker is used to retrieve the photo selected in the photo album.
3.Save the modifications by clicking
among the quick access buttons.
4.Close the code window (click the cross in the top right corner of the code editor).
Caution!
Overview
The "Product" data file contains a "Bar_Code" item. This item is used to store the value of a bar
code. Some devices (especially the ones equipped with a camera) can scan a bar code to retrieve
its value.
The bar code will be managed via the camera of the device and by a specific WLanguage function.
Implementation
124
1.Select "Code" from the popup menu of the button (right mouse click).
2.Enter the following code in the "Click" process:
// Local variable
bc is BarCodes
// Start the scan
bc = BCCapture()
IF bc..Content <> "" THEN
EDT_Bar_Code = bc..Content
END
In this code, BCCapture is used to decode the information stored in a bar code by using the
camera of the device.
among the quick access buttons.
3.Save the modifications by clicking
4.Close the code window (click the cross in the top right corner of the code editor).
To define the anchoring that will be applied the different window controls:
1.Select the following controls (click each control while keeping the CTRL key down):
the photo of the product,
the button for taking photos,
the button for selecting a photo in the album.
2.Display the popup menu of the selection (right mouse click) and select "Anchor".
3.Select "Centered horizontally" (
).
4.Validate.
To define the anchoring that will be applied the edit controls:
1.Select the following edit controls (click each control while keeping the CTRL key down):
Name
Bar Code
Reorder date
Description
2.Display the popup menu of the selection (right mouse click) and select "Anchor".
3.Select "Width" (
).
4.Validate.
Repeat this operation for the button used to manage the bar codes. In this case, select
"Right" (
126
).
All the anchors have been defined in the window. The red arrows indicating the orientation of
anchors are displayed:
1.On the "Creation" pane, in the "Graphic controls" group, click "Map". The shape of the control
appears under the mouse.
2.Click in the window to create the control.
3.A message regarding the management of scrollbars in the window is displayed. Indeed,
both the window and the Map control include their own scrollbar. Therefore, a conflict occurs.
A single scrollbar must be enabled. We advise you to:
disable the scrollbar in the window because the window has a fixed size,
keep the scrollbar enabled in the Map control.
4.Click "Disable the automatic scrollbar". The Map control appears in the window editor.
5.Display the description window of the "Map" control (double-click the control for example).
6.In the description window of the control, specify the name of the control ("MAP_Store") and
validate.
among the quick access buttons.
7.Save the modifications by clicking
128
Implementation
1.Right-click outside the window. Select "Code" from the popup menu. The processes associated
with the window are displayed.
2.Enter the following code in the "Global declarations of..." process.
// Global variables
gMarker
is Marker
// Load the stores
FOR EACH Store
// Coordinates of marker
gMarker.Position.Latitude = Store.Latitude
gMarker.Position.Longitude = Store.Longitude
// Name of marker
gMarker.Name = Store.Name
// Add the marker
MapAddMarker(MAP_STORE,gMarker)
END
// Best zoom to view all the markers of the map
MAP_Store..Zoom = zoomAdaptSize
1.On the "Creation" pane, in the "Data" group, click "Multiline Zone". The shape of the control
appears under the mouse.
2.Click in the window to create the control.
3.Display the description window of the control (double-click the control for example).
4.In the description window, specify the name of the control ("MZ_Menu") and validate.
The Multiline Zone control contains an empty line. We are going to add as many lines as the
number of options found in our menu.
Our menu will include 3 options:
List of products.
Map of stores.
Exit from the application.
130
1.Display the description window of the control (double-click the control for example).
2.Click the "New line" button. A window is opened: this window contains all the preset line
templates.
3.Select the "Simple line with picto" template and validate. Repeat this operation twice. Now,
the multiline zone contains:
a "blank" line,
3 "simple lines with picto".
4.We are going to delete the blank line that is useless in our example:
Select the blank line (the first line) with the mouse.
Click the "Delete" button.
5.Validate the description window. Your menu is created.
Each line includes an Image control, a Static control and an arrow image. We are now going to
modify the Image control and the Static control of each line in order to represent the action of the
menu.
Modifying the 1st line: access to the list of products
To modify the image of the first line found in the Multiline Zone control:
Notes
In the window of the image catalog, type "List" in the search control and press [ENTER].
Select an image via a double click.
In the window for configuring the generated image, select a size (80 for example), give a
name to the image ("ListOfProducts" for example) and validate.
The image used in a Multiline Zone control is in "Homothetic extended
centered" mode by default. The image will be automatically "resized" to the
proper dimensions.
To modify the Static control of the first line found in the Multiline Zone control:
1.Click the first line and select the Static control.
2.Display the description window (double-click the control).
3.In the "General" tab of the description window:
Give a name to the control ("STC_ListOfProducts" for example).
Change the caption ("List of products" for example).
4.Validate the description window.
To modify the image of the second line found in the Multiline Zone control:
132
To modify the Static control of the second line found in the Multiline Zone control:
1.Click the second line and select the Static control.
2.Display the description window (double-click the control).
3.In the "General" tab of the description window:
Give a name to the control ("STC_MapOfStores" for example).
Change the caption ("Map of stores" for example).
4.Validate the description window.
To modify the image of the third line found in the Multiline Zone control:
To modify the Static control of the third line found in the Multiline Zone control:
1.Click the third line and select the Static control.
2.Display the description window (double-click the control).
3.In the "General" tab of the description window:
Give a name to the control ("STC_Exit" for example).
Change the caption ("Exit from the application" for example).
4.Validate the description window.
We are now going to write the code used to perform each menu action:
134
the orientation
Overview
In most cases, an application for mobile can be used in portrait mode and in landscape mode.
The interface of a window used in portrait mode can be changed to be used in landscape mode.
WINDEV Mobile manages the change of device orientation via the anchors.
Most of the time, the anchors are sufficient to adapt the display to the different orientations.
However, if the interface must change according to the orientation (different positioning of controls
in portrait mode and in landscape mode for example), the anchors are not sufficient.
To manage a different interface in portrait mode and in landscape mode, WINDEV Mobile gives
you the ability to use the layouts.
To follow this lesson, open (if necessary) the "WM Managing Products" project that was
Answer
136
If the "WM Managing Products" application was not created, a sample project is
available. This project allows you to follow this lesson.
To open this intermediate project, on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "iOS/Android application (with windows)".
A corrected project is also available. This project groups all the window
developed in this lesson.
To open this corrected project, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "iOS/Android application (Answer)".
Using anchors
The anchors have already been used in the "WIN_Product_form" window. In test mode, we get
the following interfaces:
Notes
All the controls found in portrait mode are also displayed in landscape mode but a lot of space is
not used and the window must be scrolled to access all the controls.
We are going to improve the display in landscape mode via the layouts.
The layout is used to define several views of a window in the same project without
duplicating this window.
This gives you the ability to define:
a specific view for the portrait mode,
a specific view for the landscape mode,
a view specific to the phone,
a view specific to the tablet,
...
Two layouts are created in our example. These layouts are displayed in thumbnail format, on
the right of the "WIN_Product_form" window.
1.Double-click the thumbnail of the "Landscape - MultiOS Phone" layout: the window
corresponding to this layout is displayed in the middle of the editor.
(top right corner of the main window, in the title bar) to enable the "automatic
2.Click
dissociation" mode. Via this option, any modification performed on one of the specific windows
of the layout will not be applied to the other ones.
3.We are going to modify the position of the controls in the layout:
Select the control corresponding to the photo of the product as well as the two buttons and
move them to the left of the window.
Select the "Name" and "Reorder date" controls and position them on the right of the photo
and buttons.
Select the "Price" and "Quantity" controls and move them below the photo of the product on
the left.
140
Select the "Bar code" control as well as its button and position them on the right of the price.
Select the "Description" control and position it on the right of the quantity. Reduce the height
of the control if necessary.
Select the Image control. The Image control as well as the two buttons are enclosed by a red
line. Indeed, an anchoring conflilct occurs with the Name control.
142
with search
144
Overview
In the lesson 5.2, we have explained how to create a window used to list the products in a looper.
We are going to create a window based on the same principle but proposing a search on the
product name:
the window displays the list of products in a looper.
when the user types the name of a product in the search area, the corresponding products are
displayed in the looper.
In our example, this search will be performed on the "Product" file.
The interface of the "WIN_Menu" window is as follows:
Notes
Answer
If the "WM Managing Products" application was not created in the previous part:
an intermediate project is available. This project contains the windows created
in the previous parts. This project allows you to follow this lesson and to create
the new windows.
To open this project, on the "Home" pane, in the "Online help" group, expand
"Tutorial" and select "iOS/Android application (with windows)".
a corrected project is available. This project contains all the windows created
in this part and it allows you to check your operations.
To open this corrected project, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "iOS/Android application (Answer)".
1.Click
among the quick access buttons. The window for creating a new element is
displayed: click "Query". The wizard for query creation starts.
2.Select "Select".
Indeed, the query that will be created will allow us to select records. Go to the next step.
3.The description window of the query is displayed.
4.Give a name and caption to your query: enter "QRY_Products" instead of "QRY_NoName1" in
the "Query name" area and "Finding products on the name" in the "Caption" area:
To build the query, we are going to select the elements that will be displayed in the result.
1.The query must be used to display the characteristics of the selected product:
Select the "Product" file in the "Analysis" area of the window.
Click the arrow to select all the file items in the query.
146
3.Validate the description window of the query (green button at the bottom of the screen).
4.The graphic representation of the query is displayed.
5.Save the query by clicking
among the quick access buttons.
6.Validate (if necessary) the backup window of the query.
To define a query parameter, display the description window of the query: double-click the
background of the graphic representation of the query (or select "Query description" from the
popup menu).
148
3.In the window that is displayed, we are going to specify that the selection condition
corresponds to a parameter:
Select "contains".
Select "the parameter".
Keep the parameter name automatically proposed: "ParamName".
4.Validate the description window of the condition. The number "1" appears on the right of the
"Product.Name" item, indicating that a selection condition was defined.
6.The query graph is modified to take into account the selection condition that was defined.
4.Validate the window. The query result corresponding to the specified parameters is
displayed.
5.Close the window.
We are now going to create the interface of our window based on this query.
150
Notes
The search window will be created via the wizard for creating RAD windows (Rapid Application
Development).
The wizard for window creation proposes several windows generated by RAD.
These windows, generated from your data, propose modern interfaces for your
applications and they can be immediately used.
12.Validate the wizard. The window is automatically created, displayed in the editor and
saved.
We are now going to modify the "WIN_List_of_products_Advanced" window in order to display
the Product form that was created in a previous lesson.
1.Right-click the Looper control and select "Code".
Caution: make sure you select the Looper control and not one of the controls included in it. In
the code editor, enter the following code in the "Initializing..." section:
QRY_Products.ParamName = Null
2.This code line is used to initialize the value of the parameter found in the "QRY_Products"
query used by the Looper control. By default, the value of this parameter is set to "Null",
allowing you to ignore the parameter. Therefore, all the products will be displayed in the
window.
3.In the code editor, enter the following code in the "Selecting a row..." section:
HReadSeek(Product,ProductID,QRY_Products.ProductID)
OpenMobileWindow(WIN_Product_form)
152
1.In the "General" tab of the description window of the Action Bar:
2.Click number 2. The interface for entering an option in the toolbar is displayed.
3.Click the "+" button to add an option. A new default option is created at the top right. Modify
the characteristics of this option:
In the "Caption" area, type "Find".
In the "Preset image" area, expand the list and select "Find".
Validate the description window.
4.The code of this option is used to make the search area visible. To enter this code:
Select (if necessary) the Action Bar of the window.
Click the search button.
A drop-down menu with the "Find" option is displayed.
Right-click the option.
Select "Code" from the popup menu.
In the "Selecting the menu" process, enter the following code:
ActionBarSearchVisible(True)
154
Notes
A specific internal window can be used to manage the "Pull to refresh" feature. In
this example, we will be using the default window. See the online help for more
details.
the refresh bar that will be displayed to the user during the operation.
the "Refreshing by pull/release" process among the processes of the Looper control. This
process is automatically called during the refresh gesture. We are now going modify this
process in order to manage the control update.
1.Select the Looper control and display the associated process (press F2 for example).
2.In the code editor, enter the following code in the "Refreshing by pull/release..." section:
LooperDisplay(LOOP_QRY_Products,taReExecuteQuery)
3.As already seen for the management of the search, LooperDisplay is used to redisplay the
Looper control. The taReExecuteQuery constant is used to re-run the base query of the Looper
control and therefore to take into account the new records entered in the database.
among the quick access buttons.
4.Save the modifications by clicking
5.Close the code window (click the cross in the top right corner of the code editor).
Run the test of the window that was just modified in the simulator (
156
Notes
Create an internal window. This internal window will contain the menu options.
Modify the "WIN_List_of_products_Advanced" window to display the menu.
An internal window is a simple window with no Action Bar and no toolbar. An
internal window is used to easily include a set of controls in another window.
5.Validate.
6.Save the window by clicking
7.In the window that is displayed, enter the name of the internal window: "IW_MLZ_Options".
8.Validate.
1.Open the "WIN_Menu" window that was created beforehand (double-click its name in the
project explorer for example).
2.Copy the controls found in the "WIN_Menu" window to the "IW_MLZ_Options" internal
window:
Select all the elements found in the "WIN_Menu" window (CTRL A).
Copy the elements (CTRL C).
Display the "IW_MLZ_Options" window (click its name in the bar of opened elements).
Paste the elements (CTRL V).
3.Via the selection handles, modify the width of the Multiline Zone control so that it is entirely
displayed in the internal window. Via the anchors, all the controls found in the Multiline Zone
are also modified. You get the following window:
158
We are now going to modify the WLanguage code used to open the list of products. Indeed:
we work with the "WIN_List_of_products_Advanced" window and not with the "WIN_List_of_
products" window anymore.
the "WIN_List_of_products_Advanced" window contains the sliding menu. Therefore, the
"List of products" option must not re-open this window.
We are going to change the selection code of the Multiline Zone control.
1.Select the Multiline Zone control.
2.Display the associated processes ([F2] key).
3.Replace the line:
by:
CASE 1 // List of products
WinSlidingVisible(swLeft,False)
In this code, WinSlidingVisible is used to make the sliding window displayed from the left
invisible. Therefore, the list of products is displayed.
among the quick access buttons.
4.Save the modifications by clicking
5.Close the code window (click the cross in the top right corner of the code editor).
1.Display the "WIN_List_of_products_Advanced" window (click its name in the bar of opened
elements).
2.Display the description window.
3.In the "Details" tab, in the "Left sliding window" area, select the "IW_MLZ_Options" window.
The "Swipe" option is used to automatically manage the display of the sliding window during
the swipe.
4.Validate.
5.The window being associated with an Action Bar, the editor proposes to enable the option
used to open the sliding window.
6.Accept.
We are going to check the operating mode of the sliding menu in the simulator:
1.In the project explorer, define the "WIN_List_of_products_Advanced" window as first project
window (indeed, the "WIN_Menu" window is now useless).
Select the "WIN_List_of_products_Advanced" window in the project explorer.
Display the popup menu.
Select "First project window". A specific icon (with a small 1) is displayed in front of the name
of the window, in the project explorer.
160
with scroll
Overview
Answer
In the Windows applications, all the operations are performed via the mouse or the keyboard.
In mobile, the interfaces must be configured differently. With the touchdown screens, all the
operations are performed with the fingers.
In the applications for mobile devices, WINDEV Mobile proposes several features to manages the
specific moves of fingers (pull to refresh, double touch, sliding, ...).
In this lesson, we are going to create a new form window, used to view the products.
In this window, you will have the ability to go from a product form to another one by swipe.
If the "WM Managing Products" application was not created in the
previous part, a corrected project is available. This project contains all the
windows created in this part and it allows you to check your operations.
To open this corrected project, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "iOS/Android application (Answer)".
1.On the "Creation" pane, in the "Containers" group, expand "Internal window" and select "Swipe
area (Internal window)".
2.Click the position where the control must be created in the window (top left corner).
3.Resize the Internal Window control so that it occupies the entire available space in the
window.
162
4.Modify the anchor of the Internal Window control ("Anchoring" option from the popup menu):
anchor the control in height and in width (
).
5.Validate.
Creating the internal window
To simplify the creation of the internal window, we are going to create it from the "WIN_Prod-
1.Display the "WIN_Product_form_Advanced" window in the editor (click its name in the bar of
opened elements).
2.Select the Internal Window control and display its description ("Description" from the popup
menu).
3.In the "General" tab, select the internal window that was just created ("IW_Product").
5.In the "Content" tab, we are going to configure the mode for filling the internal window. This
window will display the data found in the Product file:
Click "File/Query".
In the source, select the "Product" file.
164
In order not to be bothered by the keyboard appearance during the swipe, we are going to use
SIPVisible:
1.In the "WIN_Product_form_Advanced" window, display the processes of the Internal Window
control.
2.In the "Selection by swipe..." process, enter the following code:
SIPVisible(False)
To end this window, we are going to add the validation option into the Action Bar of the
window (this operation was already performed before page 114, we will present the
important points only):
1.Select the Action Bar (at the top of the window).
2.Display the description window of the Action Bar.
3.Click number 2. The interface for entering an option in the toolbar is displayed.
4.Click the "+" button to add an option. A new default option is created at the top right.
5.Modify the characteristics of this option:
In the "Caption" area, type "Validate".
In the "Preset image" area, expand the list and select "Validate".
Validate the description window.
6.To enter the code used to save the modifications performed in the "WIN_Product_form_
Advanced" window:
Select (if necessary) the Action Bar control of the window.
Click "OK".
A drop-down menu with the "Validate" option is displayed.
Right-click the option.
Select "Code" from the popup menu.
In the "Selecting the menu" process, enter the following code:
ScreenToFile()
HSave(Product)
Close()
To open the window with swipe from the list of products:
1.Display the window "WIN_List_of_products_Advanced" in the editor (click its name in the bar
of opened elements).
2.Display the processes linked to the Looper control.
3.In the process "Selecting a row... ", replace the code:
HReadSeek(Product,ProductID,QRY_Products.ProductID)
OpenMobileWindow(WIN_Product_form)
by
HReadSeek(Product,ProductID,QRY_Products.ProductID)
OpenMobileWindow(WIN_Product_form_Advanced)
We are going to check the operating mode of the project in the simulator:
among the quick access buttons.
1.Click
2.In the looper that is displayed, click a product to display its form.
3.Click the product form and move the mouse to the right or to the left. The product form
automatically changes.
166
Conclusion
This part explained the main concepts for developing Android or iOS applications.
Several themes have not been presented in this part:
managing the emails,
managing the notifications,
using visualization panel,
using the debugger,
...
Don't hesitate to see the online help to discover and check new features.
the application
168
Overview
That's it, our application is created, we must now compile it and install it on the device in order to
run its test.
If you have chosen to develop the application for Android only, you can follow the generation of the
Android application.
If you have chosen to develop the application for iOS, follow the generation of the iOS application,
page 173.
If you want to develop the application for the two platforms, follow the generation for Android then
the generation for iOS.
Notes
170
If your project is using the Android platform only, the files must be selected in the
EXE directory of the project.
11.Check the "Write" box for each file (required to be able to modify the data from the
application).
17.The last wizard screen is used to specify whether the application must be copied and run
on the device connected to the computer or on an emulator. If you own an Android device
connected to the development computer, check this option.
172
Notes
18.A new screen allows you to select the runtime device. If you own an Android device
connected to the development computer, select the device connected to the PC.
19.The generation of the Android application is performed.
Notes
1.Select (if necessary) the iOS platform via the project explorer.
2.On the "Project" pane, in the "Generation" group, click "Generate" (you also have the ability
among the quick access buttons).
to click
3.The wizard for generating an iOS application starts.
4.The wizard is used to:
define the name of the application, the company and the copyright.
enter the bundle identifier.
5.Go to the next step. Specify the path of the different icons found in the application for each
type of device.
6.Go to the next step. Specify the path of the different images used when starting the
application for iPad and for iPhone (images in PNG format). Default images are automatically
created for your application.
7.Go to the next step. Specify the version number of the generated application.
8.Go to the next step. This step is used to include specific files (data files, images, ...).
Click the "Add" button.
Select the data files (.fic, .ndx and .mmo) found in the "EXE\iOS application" directory of the
project. The list of files is displayed.
9.Indicate that these data files must be in write mode: check the "Write" box.
10.Go to the next step.
174
1.Copy the entire folder generated in the EXE directory onto an external media (USB key, external
hard disk, shared directory with MAC on network). This directory is named <Project Name>.
xcode.gen.
2.Paste this folder onto the MAC where the application will be compiled.
3.Open the folder on MAC and double-click the folder named "Project_name.xcodeproj".
4.The project is opened in Xcode.
1.In the drop-down list found in the top left corner, select the compilation options. Select the
scheme corresponding to your application then the compilation target (device currently
connected or a simulator).
2.To start the compilation, select "Product .. Clean" then "Product .. Build".
3.A status report of compilation is displayed at the top ("Succeeded" or the number of
warnings and errors otherwise). You have the ability to click these symbols to see the list of
errors/warnings.
4.Once the program is compiled without error, you can start the simulation ("Product .. Run").
The simulation window appears with the application.
Then, you have the ability to run the test of your application on your iPhone or iPad.
176
PART 6
Windows
Mobile
application
178
Lesson 6.1. My
Mobile project
first
Windows
Estimated time: 1 h
Overview
To start working with WINDEV Mobile, we are going to create a first project. This project will contain
a window used to display a message.
This first example will present the main concepts of development with WINDEV Mobile.
My first project
Create the project
Answer
We are going to create our first project for Windows Mobile. If you own the mobile device
(Smartphone or Pocket PC) on which the application must be run, we advise you to connect
this device to the development computer. Therefore, the characteristics of the device will be
automatically detected and proposed when creating the Windows Mobile project.
A corrected project is available. To open this project, on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "My Pocket project (Answer)".
1.Start WINDEV Mobile 21 (if not already done). Close (if necessary) the current project in order
to display the home window.
2.In the home window, click the "Create a project" icon then "Windows Mobile application".
Notes
The wizard for project creation starts. The different wizard screens help you create your
project. The information specified in this wizard can be modified later.
180
3.The first wizard screen is used to enter the name of the project, its location and its
description. In our case, this project will be named "My_Pocket_Project". WINDEV Mobile
proposes to create this project in the "\My Mobile Projects\My_Pocket_Project" directory. You
can keep this location or modify it via the [...] button.
4.Go to the next screen via the arrows found at the bottom.
5.The wizard proposes to add documents. Keep the default options and go to the next screen.
6.The next screen is used to detect the parameters of the device connected to the PC.
If your device is connected, click "Click here to automatically detect the device".
If no device is connected, go to the next screen to manually define the characteristics of the
device used.
7.If you have no device, the next screen allows you to choose the device that will be used to
develop your application.
Caution: this screen is important because the size of your windows will depend on this choice.
For our example, select "Windows Mobile 5/6". Go to the next screen.
182
My first window
Overview
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 may be surprised by
how intuitive and how easy it is to use the editor of WINDEV Mobile. 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 a Windows Mobile application with WINDEV Mobile.
Creating the window
1.In the window for creating a new element, click "Window" then "Window".
Note
As a new project was created, the window for creating a new element is
automatically displayed.
To display the window for creating a new element, all you have to do is click
among the quick access buttons of the WINDEV Mobile:
Note
Note
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 is using a programming charter.
The programming charter 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_",
etc.
If you don't want to use this charter, all you have to do is disable it: on the
"Project" pane, in the "Other actions" group, expand "Charter" and uncheck "Use
the charter".
the location that corresponds to the file name created for the window. The window is a file
whose extension is "WDW", saved in the project directory.
184
Validate the description window of the control (green button). The control appears in the
window editor.
We are going to display a message in a dialog box (a small window proposed by the system).
Notes
1.Select the "Display" button with the mouse: all you have to do is click it.
2.Display the popup menu of the control (right mouse click).
3.Select "Code". This option opens the code editor of WINDEV Mobile, where all the
WLanguage statements can be entered.
4.Enter the following code in the "Click BTN_Display" process:
Info("Hello")
Notes
Note about the assisted input: As soon as the first two characters are typed, WINDEV Mobile
proposes all the words of the WLanguage vocabulary containing these characters. The assisted
development is a very powerful feature. No more mistake when typing the name of an element:
the syntax errors are reduced. All you have to do is select the requested word and press the
[ENTER] key to validate. You can focus on the algorithm.
When typing this code in the code editor, you have noticed that different colors
are used by the different elements. This is the syntactic coloring. The code editor
allows you to easily identify the different elements handled by the code:
the WLanguage functions are colored in blue,
the character strings (between quotes) are colored in purple,
the names of controls are colored in cyan.
These colors can be modified element by element in the code editor options
(on the "Home" pane, in the "Environment" group, expand "Options" and select
"Options of the code editor").
Close the code window (cross at the top right of the code editor). The window re-appears.
First test
For a Windows Mobile application, WINDEV Mobile allows you to run the application test on the
development computer via the simulation mode. This test simulates a Windows Mobile device on
the development computer. This test is useful when the developer is not equipped with a Windows
Mobile device. However, this test does not allow you to use the hardware components of the
device (SMS, ...).
1.Click
among the quick access buttons (or press [F9]).
2.Validate (if necessary) the information message regarding the simulator mode.
3.The created window is started in execution. The simulator shell corresponds to:
the device connected to the development computer,
the device chosen in the wizard for project creation.
4.Click the "Display" button.
5.Validate the system window that is displayed.
Any developer knows that running a program test can be a long and tiresome job. In WINDEV
Mobile, a SINGLE CLICK allows you to run the test of the window, report or procedure while
you are creating it. This is both simple and fast!
Click the "x" button found in the simulator shell to close the window.
The editor of WINDEV Mobile is redisplayed.
186
1.On the "Project" pane, in the "Generation" group, click "Generate" (you also have the ability to
among the quick access buttons).
click
2.WINDEV Mobile proposes to select the first project window. In our example, select "WIN_
Welcome" and validate (green button at the bottom of the screen).
3.The wizard for creating a mobile executable starts.
4.The first wizard screen is used to define the name and icon of the application.
Notes
The icon of the executable can be chosen in the image catalog of WINDEV Mobile ("Catalog"
button).
As soon as an image can be used (in a control, in a window, in a report, ...), the
"Catalog" button is displayed in the description window of the control. This button
allows you to select an image among the images supplied in the image catalog of
WINDEV, WEBDEV and WINDEV Mobile.
To perform a search in the image catalog:
specify the keyword corresponding to the search,
validate. The images found are automatically displayed.
By double-clicking the requested image, this one is generated and included in
your project.
5.The other screens are not required by our application. Click the "2- Copy onto the mobile"
link found on the left of the wizard.
6.This screen is used to define the options for copying files onto the mobile:
188
190
Example
The "Pocket Notes" and "Pocket Telephony" examples (supplied with WINDEV
Mobile) are using HFSQL data files.
These examples are accessible from the home windows.
Notes
To access this computer (and therefore the database), a method for communicating with the
server must have been enabled in the mobile application (Wi-Fi or 3G) in order to connect via the
network or Internet.
The response times depend on the quality of the Wi-Fi or Internet network and on the amount of
requested data.
The access to the data will be performed by the Hxxx functions of WLanguage and/or by SQL
queries.
During the test (in simulation mode) of a WINDEV Mobile application that handles
HFSQL data files, the data files used are the ones found on the PC.
CEDB
The CEDB format is a database format that can be used on the mobile devices (Pocket PC).
A CEDB database corresponds to a ".CDB" file. A CEDB database can contain several data files
(also called "tables").
Two types of CEDB databases are available:
the standard CEDB databases, that correspond to the databases found by default on the
mobile device. These databases contain the following data files: "Tasks", "Contacts",
"Appointments", ...
the other CEDB databases (called custom databases), that correspond to Access databases
(".MDB" files) previously exported from a PC.
Note: When an Access database (".MDB" file) is copied onto a mobile device (via the file explorer),
this database is automatically transformed into a CEDB database (".CDB" file).
Notes
Notes
Caution: The structure of the CEDB databases is not intended to process a large
amount of data. Therefore, we recommend that you use HFSQL databases.
Furthermore, HFSQL allows you to benefit from all the features available in
WINDEV Mobile (RAD, file link, ...).
Notes
During the test (in simulation mode) of a WinDev Mobile application that handles
a CEDB database, the database used is found on the Pocket PC.
AS/400
This database format is accessible via a Native Access by the Windows Mobile applications. To
use this Native Access, an additional module is required in addition to WINDEV Mobile.
Contact PC SOFT Sales Department for more details.
For example: application for taking orders in a restaurant. The new orders are automatically
sent to the database found on the PC.
Copying the data files onto the mobile device:
All the data files (or some of them) are copied onto each mobile device beforehand (Pocket
PC for example). Each application handles its own files. To take into account the
modifications performed in each application, the data files must be synchronized
(automatically or not).
Windows PC
Mobile Device
File 1
File 1
File 3
File 2
File 2
For example: application for opinion survey in the street. The answers will be available in
the WINDEV application once the data files have been synchronized.
192
Example
To allow the WINDEV Mobile application to access the data files found on the PC:
the mobile devices must have network access (Ethernet card, Wi-Fi, etc.)
the data found on the PC must be accessible in read/write via a UNC path (the directory
used must be a shared directory).
Then, the data can be handled (addition, modification and deletion) by the HFSQL functions.
Databases in HFSQL format (on the Pocket PC and on the PC)
The "Network tasks" example (supplied with WINDEV Mobile) includes a project
that can be used on a Windows Mobile device (Pocket Network tasks) and a
project that can be used on PC (PC Network tasks). These two examples handle
the data files found on the PC.
Copying the data files onto the mobile device (Pocket PC for example)
To update the data files found on the PC with the data entered on the mobile devices, all you have
to do is synchronize the files.
If the data files used are in HFSQL format, all the mobile devices must be connected one by one to
the PC. The automatic HFSQL synchronization via ActiveSync takes everything in charge.
Example
If the data files used are not in HFSQL format, you must program the synchronization between the
WINDEV Mobile application and the WINDEV application. See the examples supplied with WINDEV
Mobile for more details.
Databases in HFSQL format (on the mobile device and on the PC)
The "Sending SMS", "Managing lists of purchases" and "Stocks" examples
(supplied with WINDEV Mobile) include a project that can be used on mobile
device (Pocket PC for example) and a project that can be used on PC. These
examples present the synchronization of data entered in the two projects.
programming
Estimated time: 1 h
194
Overview
In this lesson, we are going to develop a Windows Mobile application that is using a HFSQL Classic
database.
This application will allow us to present some specific features of the programming for Windows
Mobile.
Opening the project
Start WINDEV Mobile 21 (if not already done). Close (if necessary) the current project in order
to display the home window.
Answer
To do so, in the home window, click "Tutorial" and select the "Pocket Managing Products
(Exercise)" project.
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "Pocket Managing Products (Exercise)".
A corrected project is available. This project contains the different windows
created in this lesson. To open the corrected project, on the "Home" pane, in
the "Online help" group, expand "Tutorial" and select "Pocket Managing Products
(Answer)".
Project description
Let's take a look at our initial project. This project is an existing project. It contains no window. It
only contains the analysis describing the HFSQL Classic data files that will be used. In the EXE
directory, the corresponding data files are supplied with data in order to run the different tests.
1.On the "Creation" pane, in the "Data" group, expand "Table" and select "Table (Vertical)".
196
4.In the wizard, select "Display the data found in a file or in an existing query". Go to the next
screen.
5.Select the "Product" file. Go to the next screen.
6.Select the items to display:
7.Keep the "Name", "Description" and "Price" items (a checkmark must be found in front of
these items). Go to the next screen.
8.Keep the proposed sort item (ProductID). The products will be sorted in the Table control
according to this item. Go to the next screen.
9.In the "Additional parameters" screen, keep the default options. Go to the next screen.
10.Select the "Vertical" orientation and go to the next screen.
11.Keep the default name ("TABLE_Product") and validate.
12.The Table control appears in the window editor.
13.Resize the control and its columns via the handles in order for the content to be displayed
in the window.
Notes
The data automatically appears in the window displayed in the editor. This
concept is called "Live Data": you see the data found in your files in real time!
This feature is very useful to adapt the size of controls to their content.
198
1.Display the "Analysis" pane if necessary (on the "Home" pane, in the "Environment" group,
expand "Panes" and select "Analysis"). The different data files described in the "Pocket
Managing Products" analysis appear in the pane.
2.With the mouse, select the items of the "Product" file displayed in the pane (except for the
"ProductID" item).
3.Drag and Drop these items to the window that was just created.
4.Resize the controls ("Name", "Bar Code", "Reorder Date" and "Description") so that they are
visible in the window:
Select the requested control.
Use the sizing handles (blue squares) to modify the size of the control.
Respect the following order: "Photo", "Name", "Price", "Quantity", "Bar Code", "Reorder Date",
"Description".
6.We are going to view the navigation order in the window: press the [F5] key. The numbers
that are displayed represent the navigation order in the window. Press [F5] again in order for
the numbers to disappear. The navigation order is automatically adapted to the order of the
controls in the window.
7.Save the window.
FileToScreen is used to display in the controls the data found in the data file, for the current
record.
3.Close the code window (click the cross in the top right corner of the code editor).
4.Save the window.
200
1.Position on the "List of products" window: click the "WIN_List_of_products" button found in
the button bar:
Notes
Open(WIN_Product_form)
TableDisplay(TABLE_Product,taCurrentSelection)
The assisted code input is going to help you: as soon as you type the opening
bracket "(", a drop-down list proposes the name of all the existing windows found
in the project. All you have to do is select the window with the keyboard or with
the mouse.
If the name of the window is not displayed in the list, it means that this window
was not saved beforehand.
Notes
We are going to add a button into the "WIN_Product_form" window: a "Validate" button to manage
the validation of modifications.
In the applications for Windows Mobile, the use of a "Cancel" button is not
required. Indeed, the user can just click the cross (top right of the window) to
cancel the input performed.
1.Display (if necessary) the "WIN_Product_form" window in the editor: click the corresponding
button in the button bar.
2.On the "Creation" pane, in the "Usual controls" group, click
: the shape of the button
appears under the mouse. Then, click inside the window to create the button (beside the
image for example).
3.Select the control and press the [ENTER] key on the keyboard. The button caption becomes
editable. Type "Validate" and press the [ENTER] key on the keyboard.
4.Resize the button if necessary (with the handles) in order for the caption to be entirely
displayed in the button.
We are now going to enter the code of the "Validate" button.
1.Right-click the button and select "Code" from the popup menu.
2.In the "Click" process, enter the following code:
ScreenToFile()
HModify(Product)
Close()
202
Display the "WIN_List_of_products" window in the window editor and run its test in the
Display (if necessary) the "WIN_List_of_products" window in the editor: click the corresponding button in the button bar.
3.Resize the button if necessary (with the handles) in order for the caption to be entirely
displayed in the button.
4.The code of this option is used to open the "Product form" window and to reset its controls.
To enter this code:
Right-click the "New product" button.
Select "Code" from the popup menu.
In the "Click" process, enter the following code:
HReset(Product)
Open(WIN_Product_form)
TableDisplay(TABLE_Product)
HReset initializes the variables of the items found in the Product file with the default values to
manage a new record.
Open is used to open the form window.
TableDisplay is used to update the content of the Table control: the new record will be displayed
in the control.
among the quick access buttons.
5.Save the modifications by clicking
6.Close the code window (click the cross in the top right corner of the code editor).
We are now going to modify the window of the product form to manage the addition of a new
record.
1.Display the "WIN_Product_form" window in the editor.
2.We are going to modify the code of the validation button:
Right-click the button and select "Code" from the popup menu.
204
In the "Click" process, replace the existing code by the following code:
ScreenToFile()
IF Product..NewRecord THEN
HAdd(Product)
ELSE
HModify(Product)
END
Close()
Notes
Display the "WIN_List_of_products" window in the window editor and run its test in the
simulator ( among the quick access buttons).
In the list of products, click the "New product" button.
Enter a new product.
Validate. The new product is displayed in the list of products.
Close the simulator.
206
8.Right-click the new option and select "Add before" from the popup menu.
9.In the input area that is displayed, type "Exit" and validate.
Programming the menu
We are now going to enter the code of these two menu options.
1.In the window editor, display the "Exit" option. All you have to do is expand the menu, just like
you did at run time.
2.Display the popup menu of the "Exit" option (right mouse click) and select "Code".
3.Enter the following code:
Close()
Close is used to close the current window. The "Menu" window being the only window, the
application is automatically closed.
1.In the window editor, display the "List of products" option. All you have to do is expand the
menu, just like you did at run time.
2.Display the popup menu of the "List of products" option (right mouse click) and select
"Code".
1.On the "Project" pane, in the "Generation" group, click "Generate" (you also have the ability to
among the quick access buttons).
click
2.The wizard for creating a mobile executable starts.
3.The first wizard screen is used to define the name and icon of the application. The icon of
the executable can be chosen in the image catalog of WINDEV Mobile ("Catalog" button).
4.The other screens are not required by our application. Click the "2- Copy onto the mobile"
link found on the left of the wizard.
208
5.This screen is used to define the options for copying files onto the mobile:
the
application
This lesson will teach you the following concepts...
Available distribution modes
210
Overview
WINDEV Mobile allows you to develop applications for Windows Mobile.
Several methods can be used to install a WINDEV Mobile application on a device running Windows
Mobile (Pocket PC for example):
setup in CAB format. This setup program is run on the mobile device directly.
setup in MSI format. This setup program is run on a PC running Windows connected to a mobile
device (Pocket PC for example).
setup by direct copy of the executable from the PC to the Pocket PC (as already seen in the
previous lessons).
These different setup modes are available via the wizard for setup creation.
Caution: The setup program of a Windows Mobile application can be created with a 32-bit editor
only.
1.On the "Project" pane, in the "Generation" group, click "Setup procedure". The wizard for
creating the executable and the setup starts.
2.The executable being already created, click "2-Setup" on the left of the wizard.
3.In the message box that is displayed, click "Access the setup options".
4.The description screen of the application is displayed. Go to the next screen via the arrow
buttons.
5.You can choose the setup mode of your mobile application:
6.For our example, we are going to choose a setup by ActiveSync: check the corresponding
option and go to the next screen.
7.The wizard asks for the setup directory of the application. Keep the default option. Go to the
next screen.
8.Specify the files to install. The wizard proposes the executable. You also have to install the
data files of the application. Click the "Add" button and select the HFSQL files (.fic, .ndx and
.mmo files) found in the EXE directory of your project.
212
To use this application, start the application on the mobile device (double-click the ".EXE" file for
example).
Update in CAB format
The CAB format proposes two types of updates:
update by entirely re-installing the application. In this case, the update is identical to the initial
setup. See the previous paragraph.
update by Internet (HTTP protocol). This update consists in:
creating the executable of the application on the development computer via WINDEV Mobile.
generating the setup program of the application on the development computer via WINDEV
Mobile. This setup program corresponds to a ".CAB" file.
copying this setup program onto a Web directory by FTP.
retrieving and installing the update on the mobile device.
214
Conclusion
The tutorial is over now!
This course has discussed a variety of subjects, but not all the features of WINDEV Mobile, far
from it!
You are now familiar with the main concepts.
We recommend that you spend another day exploring the menu options of WINDEV Mobile, for
each one of the modules.
You can also explore the examples supplied with WINDEV Mobile: some are simple and only
address one topic, while others are more complex. These examples will show you the different
aspects of WINDEV Mobile as well as the development for the different platforms. Reading the
source code is also a good way to learn.
It would take too much time to discuss all the available topics (there are hundreds, even
thousands!). WINDEV Mobile proposes several features that were not presented in this tutorial:
sockets and HTTP functions...
queries, queries with parameters, ...
printing, ...
Conclusion 215
216
Conclusion