WinDev 22 Tutorial
WinDev 22 Tutorial
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 2017: 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.................................................................................................................................................. 15
Overview of the tutorial.......................................................................................................................................... 15
Legend of symbols used in this guide................................................................................................................... 16
How to access the online help?............................................................................................................................. 16
If you are familiar with WEBDEV 21...................................................................................................................... 19
What is WINDEV used for?..................................................................................................................................... 19
Summary 3
Simple operations on the variables...................................................................................................................... 48
Tips............................................................................................................................................................ 49
The String variables in details............................................................................................................................... 49
The String type.......................................................................................................................................... 49
Practical example..................................................................................................................................... 50
The array variables in details.................................................................................................................................54
Declaration............................................................................................................................................... 54
Filling an array and accessing the elements........................................................................................... 54
Advanced arrays....................................................................................................................................... 55
4 Summary
Practical example: Using a procedure.................................................................................................................. 77
Project used.............................................................................................................................................. 77
Implementation........................................................................................................................................ 77
Creating and using a procedure.............................................................................................................. 80
Conclusion............................................................................................................................................................... 81
Summary 5
Lesson 3.4. The full RAD
What is RAD?....................................................................................................................................................... 119
Generating RAD................................................................................................................................................... 120
Application test.................................................................................................................................................... 123
6 Summary
Lesson 4.4. Multicriteria search
Overview................................................................................................................................................................176
Creating the query used to find the orders.........................................................................................................177
Creating the query.................................................................................................................................. 177
Query test...............................................................................................................................................180
Using parameters in the query..............................................................................................................181
Test of query with parameters...............................................................................................................184
Creating the interface used to perform a multicriteria search........................................................................ 184
Modifying the Tab control.......................................................................................................................184
Creating the controls used to configure the criteria and to display the result.....................................186
Summary 7
Lesson 4.9. Sending an email
Overview............................................................................................................................................................... 246
A window for sending emails...............................................................................................................................247
Creating the window............................................................................................................................... 247
Creating the controls used to configure the sending............................................................................ 247
Creating the controls used to enter the characteristics of the email...................................................249
Sending the email..................................................................................................................................251
Window improvements....................................................................................................................................... 253
Closing the window................................................................................................................................253
Formatting..............................................................................................................................................253
Non-modal opening of the window........................................................................................................254
8 Summary
Lesson 4.14. Deploying the application
Overview............................................................................................................................................................... 293
Creating the executable...................................................................................................................................... 293
Creating the setup............................................................................................................................................... 298
Installing an application..................................................................................................................................... 301
The different types of deployment..................................................................................................................... 302
Overview.................................................................................................................................................302
Setup with network update....................................................................................................................303
Setup with Internet update....................................................................................................................305
Multisite setup........................................................................................................................................305
Summary 9
Lesson 4.17. SCM
Introduction.......................................................................................................................................................... 332
SCM (Source Code Manager).............................................................................................................................. 332
Principle of SCM.....................................................................................................................................332
Creating the SCM database...................................................................................................................333
Including a project in the SCM............................................................................................................................ 334
Adding the project into the SCM............................................................................................................334
Opening a project from the SCM............................................................................................................337
Configuring the SCM..............................................................................................................................338
Handling the project via the SCM....................................................................................................................... 339
Modifying a project parameter..............................................................................................................339
Modifying a project window...................................................................................................................340
Checking the checked-out element back in..........................................................................................342
Synchronizing the project......................................................................................................................343
Off-line mode (or mobile mode).............................................................................................................344
SCM administrator.................................................................................................................................344
Disconnecting from the SCM.................................................................................................................345
Conclusion............................................................................................................................................................ 345
10 Summary
PART 6 - Optimizing and debugging a project
Summary 11
Handling XML files............................................................................................................................................... 412
Overview................................................................................................................................................. 412
Practical example................................................................................................................................... 413
Handling XLS files................................................................................................................................................ 413
Practical examples................................................................................................................................. 414
12 Summary
Lesson 7.9. The OOP
Concepts............................................................................................................................................................... 436
The classes.............................................................................................................................................436
The objects.............................................................................................................................................436
The members.........................................................................................................................................436
The methods...........................................................................................................................................436
Concept of inheritance...........................................................................................................................436
Constructor and Destructor...................................................................................................................437
Data encapsulation................................................................................................................................437
Example..................................................................................................................................................437
Creating an object-oriented program....................................................................................................437
Simple example................................................................................................................................................... 438
Declaring a class....................................................................................................................................438
Describing the methods.........................................................................................................................439
Declaring and handling the objects......................................................................................................440
UML diagram........................................................................................................................................................ 441
PART 8 - Appendices
Conclusion
Summary 13
14 Summary
Introduction
Preliminary points
Caution: This manual is a tutorial. We advise you to refer to the online help when you are using
WINDEV.
The aim of the tutorial is to help you discover WINDEV, become familiar with the editors and teach
you the WINDEV concepts.
This manual does not cover all the features of WINDEV.
You should plan on spending a few hours to follow this course and to learn WINDEV: you'll find it
was well worth it!
If you try to develop an application before following this tutorial, you will lose time, and a lot more
than the few hours you'll spend on this tutorial.
This tutorial was designed to be followed in two different ways:
• either you follow all the detailed exercises in each lesson (recommended method).
• or, if you are in a hurry and already experienced, you can read it without doing the exercises
(all the exercises have screen shots). However, in order to quickly assimilate the main
concepts, we recommend that you follow the tutorial step by step.
WINDEV evolves all the time, so the screen shots found in this course may differ from the windows
displayed in your product.
Introduction 15
Legend of symbols used in this guide
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 via the
home window of WINDEV.
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.
The tutorial may have evolved since this document was published. Don't hesitate
Notes
to check the electronic version of the tutorial (PDF file accessible from the
WINDEV menu: on the "Home" pane, in the "Online help" group, expand "Tutorial"
and select "Tutorial (PDF)".
16 Introduction
The help can be displayed:
• in a specific "help browser":
Introduction 17
We advise you to check the online help on Internet rather than the local online
help. Indeed, the Internet online help is updated on a regular basis.
The online help of WINDEV, WEBDEV and WINDEV Mobile on Internet is available
Notes
from any computer equipped with an Internet access, without the product being
necessarily installed.
Each Web user can add comments about the documentation pages: personal
notes, examples, links...
• the content of the help: help common to WINDEV, WEBDEV and WINDEV Mobile or help
about the product currently used.
18 Introduction
If you are familiar with WEBDEV 21...
If you are familiar with WINDEV 21, following this tutorial will do no harm: it's a good opportunity to
"review" the WINDEV features!
Introduction 19
20 Introduction
PART 1
Discovering
WINDEV
22 Part 1: Discovering WINDEV
Lesson 1.1. Discover WINDEV
• Starting WINDEV
Starting WINDEV
The editor
The development environment of WINDEV 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 WINDEV interface includes several horizontal and vertical panes allowing you to
quickly access different types of information. For example:
• 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.
These panes can be hidden by pressing [CTRL] + [W] if necessary.
4. Bar of opened documents. This bar is used to quickly view all the opened elements. A simple
click on the button corresponding to the element displays it in its own editor.
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 tab of the pane appears in white and a light orange line is displayed at the
top of the tab.
• the popup panes, specific to the current element: The name of the pane is displayed in blue.
• the available panes: The name of the pane is displayed in black.
Depending on the selected environment theme (light or dark), the colors used to identify these
different panes are different. See “The environment colors”, page 27 for more details.
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 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".
Note: To improve the readability of this manual, the light theme will be used for the different
images that illustrate the operations to perform.
The windows are used to display or enter information on the screen. The user can
Note
Start WINDEV 22 (if not already done). Display the home window of WINDEV if necessary:
press [CTRL <].
Open the "WD My First Windows" project.
To do so, in the home window, click "Tutorial" and select the first project named "My first
windows (Exercise)".
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "My first windows (Exercise)".
Important
In this part, we will focus on creating simple windows. The "WD My First Windows"
project is an empty project that was already created. The creation of a project will
be presented in another lesson.
• in the home window, click "Tutorial" and select the project named "My first
windows (Answer)".
• on the "Home" pane, in the "Online help" group, expand "Tutorial" and select
"My first windows (Answer)".
Overview
You are going to create the following window:
This window allows the user to type his first name and to display a welcome message with the
"Display" button.
You may think this is too basic but we advise you to create this window. You may well be surprised
by how intuitive and easy it is to use the WINDEV editor. Furthermore, this window will teach you
principles that are fundamental for the rest of this tutorial.
2. 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.
3. Click "Window" then "Window". The wizard for window creation starts.
4. Select "Blank" in the list of "standard" windows displayed on the left. In the list of skin
templates found on the right, the "Elegant" skin template is selected by default. You can
choose another skin template proposed in the list.
The skin templates allow you to quickly create outstanding interfaces. A skin
Note
template defines the style of the window as well as the style of all controls that
will be used in this window. No ugly interface anymore.
5. Validate. The window is automatically created in the editor. The backup window of the
created element is displayed. This window is used to specify:
• The title of the element. For a window, this title will be displayed in the title bar of the
window.
• The name of the element. This name corresponds to the logical name of the element. This
name will be used to handle the element by programming.
• The location of the element. This location corresponds to the backup directory of the
element.
Study the window name proposed by WINDEV: 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:
Note
7. In this example, we want to use a shorter window name: replace "WIN_My_first_window" by
"WIN_Welcome".
8. Click the green button to validate the information displayed in the backup window.
To quickly edit the caption of a control, you also have the ability to:
Tip
4. Type the caption: "Display". The name of the button automatically becomes "BTN_Display".
5. You can see the name of the button:
• in the tooltip displayed when hovering the control:
We are going to display the text typed in a dialog box (a mini-window proposed by the system).
To do so, we will be using our first WLanguage function: Info.
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:
Notes
• Initialization,
• Click on the button, run when the user clicks the button.
Note: Additional processes can be added if necessary.
Note about the assisted input: As soon as the first two characters are typed, WINDEV 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.
This is the reason why the programming charter is so important. All the elements
Notes
handled in the application code use the same standard so they can be easily
identified when typing code.
The Info function displays the message passed in parameter on one or more lines. Our message
is built from the text "Hello " and from the value of the "EDT_FirstName" control. The "," character
separates the parameters found in the Info function. Each parameter is displayed on a different
line.
Notes
In this example, the text is displayed in a system window but it can also be
displayed it in a window created with WINDEV.
• Compilation warning: The warnings signal programming cases that may cause
unexpected behaviors.
• Compilation information: The information explains the compiler choices or
presents tips for improving the code.
• FUI errors: The GUI compilation errors indicate the possible problems detected
in your interfaces: images not found, truncated captions, ...
Window improvements
During this first test, you have noticed that:
• your window is too big,
• your window can be resized while it only contains two controls,
• the first name is displayed with the case used in the edit control. We are going to force the use of
an uppercase letter at the beginning of the word.
We are going to improve the interface of this window.
To reduce the window size in the editor:
1. Click the window: handles appear around the window.
2. Click the handle found at the bottom right and reduce the window size by keeping the left
mouse button down.
To prevent the window from being resized at run time:
1. Double-click the window. The description window is displayed.
2. In the "GUI" tab, uncheck "Resizable" (all you have to do is click the option).
3. Validate.
Notes
Tips for improving the interface and the ergonomics will be presented in a next
chapter.
Run the test of this window to see the result at run time.
Go back to the editor by closing the test window.
We are now going to force the use of an uppercase letter when typing and displaying the first
name.
Your first window was successfully created. In the rest of this lesson, we are going to discover new
WINDEV concepts.
Validate the message and close the test window (click the cross in the top right corner of the
window). The editor is redisplayed.
Close the "WIN_Edit" window displayed in the editor: on the "Home" pane, in the "General"
group, click "Close".
Close the project: on the "Home" pane, in the "General" group, expand "Close" and select
"Close the project".
Main concepts
WINDEV allows you to easily create an application. But what is an Application?
An application is a tool used to automatically perform tasks, actions. An application includes an
executable program (or a set of executable programs), libraries, data files, ...
An executable program is a file made of elements that can be directly handled by the user
(windows, printed reports, ...). It is started by the end user of an application.
To create an executable, WINDEV proposes to create a project. A project links and organizes the
different program elements. The executable program will be created from the project.
If your application is using data, WINDEV allows you to define the structure of the database via the
analysis. The WINDEV analysis contains the description of the files (also called "Tables" in several
databases). These files will contain the application data.
Notes
Describing the data files in the analysis does not mean that they are created. The
data files are physically created when running the application.
Project 1
Analysis
Project 2 Project N
Terminology
As already seen, a WINDEV project (linked to an analysis if necessary) is used to create an
application. Before we actually start working with WINDEV, let's go back to the vocabulary used
in WINDEV. Indeed, several terms are specific to WINDEV and they may not have the same
significance as the the ones used in the 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, "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 type the order details for example.
• Record: A record is sometimes called row. A file record corresponds to all the items defined for
the file.
The basics of
WLanguage
42 Part 2: The basics of WLanguage
Lesson 2.1. The variables
• What is a variable?
• The different types of variables
• The scope of variables
• The String type in details
• The Array type in details
In WLanguage, the " character (double quote) is the character used to delimit a
Notes
character string. In the above example, the doubles quotes are used to assign the
Doe value to the LastName variable.
The content of a variable can be read and handled: all you have to do is use the name given to the
variable in order to access it.
The following example is used to read and display the content of the Price variable on the screen:
Info(Price)
Use the type corresponding to the information that must be stored. Therefore,
you will optimize the memory and you will avoid calculation or process errors
when using variables in the WLanguage functions.
Most of these types of variables will be used in this tutorial. See the online help regarding the
relevant type for more details.
Other types are available like the arrays, the structures, the dates, the times, ...
Advanced variables are also available. These advanced types group all the
Notes
Global scope
Global means that the variable has an extended visibility in the code. The variable is visible
outside the location where it was declared. Several levels are available:
• Project and Set of procedures,
• Window, Mobile Window, Page, Report.
Local scope
Local means that the variable has a limited visibility in the code. The variable is visible in the
process where it was declared. This is used to restrict the use of the variable to the process.
Project
Global variables
Global procedures
GUI
(Windows, Pages, Mobile windows, Reports)
Global variables
Local procedures
Processes
Local variables
// Declaration of variables
Ctr is int
V1 is int
Res is numeric
// Assignment
Ctr = 10
V1 = 3
// Use of operators
Ctr = Ctr + 3 // Ctr is equal to 13
Ctr ++ // Ctr is equal to 14
Ctr -= 8 // Ctr is equal to 6
Ctr = Ctr * V1 // Ctr is equal to 18
Res = Ctr / 5 // Res is equal to 3.6
LastName is string
// Asssign a string variable
LastName = "Doe"
There is no need to declare the length of the string: this length automatically adapts when using
the variable.
To initialize a string variable with a text on several lines, use the following syntax:
<Variable Name> = [
<Text of Line 1>
<Text of Line 2>
]
Tip
For example:
MyString is string
MyString = [
Example of
multi-line string
]
LastName is string
// Asssign a string variable
// with the content of the EDT_NAME edit control
LastName = EDT_LastName
In addition to the main comparison operators, several powerful operators are used to manage the
extractions and concatenations in advanced mode.
Some examples:
• " + ": To concatenate strings
• " ~= ": To check the flexible equality
Specific WLanguage functions are used to perform various operations: search, extraction, size,
switch to uppercase characters, ...
Examples:
str is string
str = "WINDEV is a great tool"
// Extract a sub-string from left
Info(Left(str,6)) // Displays "WINDEV"
// Extract a sub-string from right
Info(Right(str,3)) // Displays "ool"
See the help about the character strings and about the functions for handling character strings for
more details.
Practical example
To handle the different concepts of this lesson, we are going to create different windows. These
windows will be created in the "WD My first windows" project.
Open (if necessary) the "WD My First Windows" project.
To do so, in the home window, click "Tutorial" and select the first project named "My first
windows (Exercise)".
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "My first windows (Exercise)".
3. Modify the content of the edit control (by replacing WINDEV by WD for example) and click
the button. The WINDEV word is not found.
4. Close the window.
3. In the edit control, type "WINDEV" in uppercase characters and click the "Compare two
strings" button. The WINDEV word is found.
4. Modify the content of the edit control (by replacing “WINDEV” by “windev” in lowercase for
example) and click the button. The WINDEV word is also found.
5. Close the window.
Declaration
The declaration of an Array variable is performed as follows:
For example:
arrString is array of strings
arrInteger is array of int
Example:
// Declares an array
arrDay is array of strings
Tip
// Initialization with
// the names of days of the week
arrDay = ["Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Sunday"]
Advanced arrays
Advanced arrays are also available: array with several dimensions, array of arrays, associative
array, array of structures, array of objects, ... See the online help (keyword: "Array") for more details.
• The IF statement
• The SWITCH statement
• Practical example
The IF statement
This statement is used to run an action or another one according to the result of an expression. If
the expression is checked, a process is run; if the expression is not checked, another process can
be started.
The IF statement can be used as follows:
Code sample: The following code selects a number at random and displays a message according
to the value.
Tot is currency
// Selects a number at random between 100 and 4000
Tot = Random(100, 4000)
IF Tot>2000 THEN
Info("The amount is greater than 2000")
ELSE
Info("The amount is less than or equal to 2000")
END
Note: Several code lines can be run during the process corresponding to a condition. In this case,
the following syntax must be used:
SWITCH <Expression>
CASE Value 1:
Process 1...
CASE Value 2:
Process 2...
...
CASE Value N:
Process N...
OTHER CASE
Process ...
END
Example: The following code retrieves today's date and displays a different message according to
its value. A specific message is displayed for the 1st and for the 15th of the month. In the other
cases, today's date is displayed.
D is Date
D = Today()
SWITCH D..Day // Checks the day of the date
CASE 1 : Info("Today is the first day of the month")
CASE 15 : Info("Today is the 15th of the month.")
OTHER CASE: Info("Today is: "+ DateToString(D))
END
Notes:
• If the code line "CASE 1:..." is run, the other code lines corresponding to the possible values are
not run.
• Several values can be grouped in the same case. The different values are separated by a
comma. For example:
Sub is int = 2
SWITCH Sub
CASE 1,2: Info("Case 1 or 2")
CASE 3: Info("Case 3")
OTHER CASE: Info("Other case")
END
Project used
To handle the different concepts of this lesson, we are going to create different windows. These
windows will be created in the "WD My first windows" project.
Open (if necessary) the "WD My First Windows" project.
To do so, in the home window, click "Tutorial" and select the first project named "My first
windows (Exercise)".
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "My first windows (Exercise)".
IF statement
In our example, a click on the check box must trigger the display of the Close button.
We are going to enter the WLanguage code associated with the check box.
We are going to enter the WLanguage code associated with the check box:
1. Select the Check Box control.
2. Press the [F2] key.
3. Type the following code in the "Whenever modifying CBOX_NoName1" process:
IF CBOX_NoName1=True THEN
BTN_Close..Visible = True
ELSE
BTN_Close..Visible = False
END
To handle the current control in one of the processes associated with it, you have
the ability to use the MySelf keyword.
Tip
3. Click the "Close" button: the window is closed and the window editor is displayed.
4. When pressing the [ENTER] key to go to the next line, the code editor automatically displays
the different possibilities of SWITCH:
SWITCH RADIO_Titles
// Mr
CASE 1
Info("You've selected Mr")
// Misses
CASE 2
Info("You've selected Mrs")
// Miss
CASE 3
Info("You've selected Miss")
// Other
CASE 4
Info("You've selected Other")
END
For example, the following code runs the process 2000 times:
Note: An increment step can be defined for the subscript via the STEP keyword. For example, the
following code runs the process 2000 times and the nCtr variable decreases from 10 to 10:
Counter is int
Counter = 10
LOOP
// Process to run
Counter = Counter - 1
IF Counter = 0 THEN BREAK
END
The LOOP statement and the FOR statement can have the same behavior: all you
have to do is use the syntax with exit according to the number of iterations:
LOOP (<Number of Iterations>)
...
Tip
END
Example:
LOOP(10)
// Process to run
END
For example:
Counter is int
Counter = 0
WHILE Counter<10
// Process to run
Counter = Counter + 1
END
Project used
To handle the different concepts of this lesson, we are going to create different windows. These
windows will be created in the "WD My first windows" project.
Open (if necessary) the "WD My First Windows" project.
To do so, in the home window, click "Tutorial" and select the first project named "My first
windows (Exercise)".
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "My first windows (Exercise)".
proposes to use the image catalog via the "Catalog" button. This catalog contains
hundreds of images, cliparts, ...
This code is used to modify the X coordinate of the Image control (..X property) in a loop from
1 to 300. At each loop turn, the X coordinate is increased by one pixel.
When typing conditional statements in the code editor, the different possible
syntaxes are proposed in a list by the code editor.
Notes
If you select one of these syntaxes, the structure of the statement is automatically
inserted into the code editor. All you have to do is type the code corresponding to
each part of the statement.
This code is used to modify the X coordinate of the Image control (..X property) until a
condition is true. In our case, this condition is as follows: the image position (..X property)
must correspond to the window width less the image width.
When a code line is too long to be displayed in the window of the code editor, you
Tip
Let's now create a last button used to move the image until it reaches the left border of the
window. To do so, we will be using the LOOP statement of WLanguage.
1. On the "Creation" pane, in the "Usual controls" group, click .
2. Click the location where the button will be created (on the right of the FOR button for
example).
3. Click the button that was just created. The text displayed in the button becomes editable.
Type the caption: "LOOP statement".
4. Press the [ENTER] key to validate the input.
5. Adapt the control size.
6. Display the processes associated with the button ([F2] key).
7. Enter the following click code:
This code is used to modify the X coordinate of the Image control (..X property). At each turn,
a condition is checked.
When typing this code, the LOOP statement may be underlined by a green line
and a warning may appear in the pane of compilation errors.
Notes
This warning reminds you that an exit statement must be found in the code of
the loop to avoid an infinite loop.
Window test
• Types of procedures
• Creating and calling a procedure
• Parameters of a procedure
• Result of a procedure
• Practical example
Types of procedures
Three types of procedures are available:
• Global procedure: can be used in all the processes of the project (declared in a set of
procedures).
• Procedure local to a Window, Page or Mobile Window: can be used in all the processes related
to the object where this procedure was declared.
• Procedure internal to a process: can only be used in the process where it was declared.
Scope of procedures
Notes
The procedures comply with the scope rules presented for the variables (see
“The scope of variables”, page 46).
Global procedure
To create a global procedure, you must:
1. Create (if necessary) a set of procedures (via the "Project explorer" pane, "Procedures" folder).
Give a name to the set of procedures.
2. Create a global procedure in the set of procedures (via the "Project explorer" pane,
"Procedures, Set name" folder). Give a name to the procedure.
3. Type the code of the global procedure. The procedure code has the following format:
Local procedure
To create a local procedure, you must:
1. Select the element associated with the procedure (window, page, ...).
2. Create a local procedure (via the "Project explorer" pane, expand the name of the element,
"Local procedures" folder).
3. Give a name to the procedure.
4. Type the code of the local procedure. The procedure code has the following format:
Calling a procedure
To call a procedure, use the name of the procedure (with the possible parameters that will be
passed to it).
Parameters of a procedure
What is a parameter?
A parameter is a value sent to a procedure during the call to the procedure.
The following example is used to call the Multiply10 procedure and to pass in parameter the value
that will be handled in the procedure:
Multiply10(50)
You have the ability to pass from 0 to several values in parameter to a procedure. These values
can have any type (like for the variables).
The parameter is specified in the procedure declaration in the format of a variable. For example,
for the Multiply10 procedure, the code of the procedure is:
PROCEDURE Multiply10(P)
P=P*10
To specify the role of the parameter in the procedure, you have the ability to
Notes
res is int
res = Multiplication(10, 50)
// Res is equal to 500
T is int
T = 12 // T is set to 12 before the call
Test_address(T)
// T is set to 24 after the call
To avoid modifying the value of the variable corresponding to the parameter, the parameters
must be passed by value. Passing parameters by value allows you to handle a copy of the
parameter value. If the procedure code modifies the value of the variable, the value of the variable
corresponding to the parameter is not modified.
To force a parameter to be passed by value to a procedure, the LOCAL keyword must be used in
front of the parameter name in the declaration of the procedure. This keyword indicates that the
following parameter will not be modified by the procedure.
Example:
• The code of the procedure is as follows:
T is int
T = 12 // T is set to 12
Test_value(T)
// T does not change
other parameters can be passed by value. All you have to do is used the LOCAL
keyword in front of each parameter passed by value.
When declaring a procedure, the optional parameters are the last parameters
(they are always specified after all the mandatory parameters).
In the following example, the Multiplication procedure is using an optional parameter, Nb2. This
optional parameter is indicated after the mandatory parameters, by specifying its default value. In
this example, the default value of the optional parameter is set to 10.
res is int
res = Multiplication(6)
// Res is equal to 60
In this example, the second parameter was not specified. Therefore, its default value will be used.
Result of a procedure
The procedures can return one or more results. The result can be typecasted. The RESULT keyword
must be used to return a value.
See the online help (keyword: "Result") for more details.
Project used
To handle the different concepts of this lesson, we are going to create different windows. These
windows will be created in the "WD My first windows" project.
Open (if necessary) the "WD My First Windows" project.
To do so, in the home window, click "Tutorial" and select the first project named "My first
windows (Exercise)".
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "My first windows (Exercise)".
Implementation
7. Display the next screen: give a name (COMBO_VAT) and a caption (VAT) to the control.
This code calculates the amount IOT by using the value selected in the Combo Box control
(returned by ..DisplayedValue).
Our window operates properly now. However, instead of using a formula 3 times to calculate the
price, a procedure can be used to perform this calculation.
Close the test window to go back to the code editor.
Creating and using a procedure
This code calls the Calc_IOT procedure to calculate the amount IOT. Two parameters are
passed in parameter: the price BT and the VAT rate. The result returned by the procedure is
assigned to the EDT_Price_IOT control.
Let's now run the window test:
1. Run the test of your window ( among the quick access buttons). Give a price BT. Select the
different values in the Combo Box control and click the "Calculate" button.
2. The amount IOT is displayed.
3. Close the test window.
Conclusion
This section allowed you to get familiar with the main concepts of WLanguage programming in
WINDEV. Several other features are available. Other ones will be presented later in this tutorial.
WLanguage is a very powerful language that allows you to develop applications that use:
• the Object-Oriented Programming (OOP),
• the MVP (Model View Presenter),
• a 3-tier programming,
• advanced types (XML, Email, ...), ...
See the online help regarding the relevant topic for more details.
• Questions/Answers
Question How to view the element to which the current process belongs?
To view the element corresponding to the current process, on the "Code" pane, in the "Navigation"
group, click "Go to the object" (CTRL + ALT + F2). The window containing the requested element is
displayed.
To print the current source code, click in the "Home" pane or press [CTRL] + [P].
The functions for performing searches or replacements (in the code, in the interface, ...) can be
accessed from the "Home" pane, in the "Find" group or in the "Find - Replace" pane (CTRL + F):
Then, you have the ability to define the different characteristics of the search to perform.
The code editor allows you to expand or collapse the WLanguage code. This feature is very useful
if your processes use a lot of structured statements (loops, conditions, browses, ...).
To collapse a code section, on the "Display" pane, expand "Collapse" and select "Collapse all" (or
press [CTRL] + [SHIFT] + * (on the numeric keypad)).
Only the comments remain visible. The associated code is displayed in a tooltip when the comment
line is hovered by the mouse cursor:
Press [CTRL] + * (on the numeric keypad) to expand the entire code. A click performed on the "-" or
"+" symbol allows you to collapse or expand the corresponding code section.
Press [F6] to display information (name and creation/modification date) about each code line.
In the code editor, to enable (or not) the numbering of code lines, on the "Display" pane, in the
"Help for edit" group, click "Display the line numbers" (shortcut: [CTRL]+[SHIFT]+[G]).
For the functions that require names of data files, controls, windows or reports, the assisted input
is used to display the list of project elements corresponding to the parameter of the function
currently typed.
Examples of assisted input for HReadFirst: the <Wizard> option is used to start a code wizard. This
wizard asks you questions regarding the use of the function and it automatically generates the
corresponding code.
A help page is associated with each WLanguage function and property. This help page can be
directly accessed from the code editor: to do so, press [F1] on the name of the requested function
or property.
• [F2] on the name of a control, class, procedure or report block displays the process of this object.
• [CTRL]+[F2] is used to go back to the initial process.
To move from a process to another one, press [F2] repeatedly. To go back to the initial process,
press [CTRL]+[F2] the same number of times.
• [CTRL]+[L] deletes the current line.
• [CTRL]+[D] duplicates the current line (or the selected lines) on the line below.
• [TAB] and [SHIFT]+[TAB] are used to manage the indent for the selected lines.
• [CTRL]+[/] converts the selected lines into comments, [CTRL]+[SHIFT]+[/] removes the
comments (Caution: [/] key on the numeric keypad).
• [CTRL]+[R] is used to automatically indent the code displayed.
All you have to do is use an advanced dialog box. These dialog boxes are used to manage:
• the directive questioning (Dialog): the user answers a question via buttons containing the
text of the action to perform.
• the immediate input (Input), by allowing the user to enter the requested value in the dialog
box.
See the online help (keywords: "Dialog" and "Input") for more details.
To check the different modes for communicating with the user:
1. Open (if necessary) the "WD My first windows" project: on the "Home" pane, in the "Online
help" group, expand "Tutorial" and select "My first windows (Answer)".
2. Open the "WIN_Dialog" window. This window presents the different dialog modes.
3. Run the test of this window ("GO" button).
4. Click the different buttons to check the different dialog modes.
5. Stop the test of this window and go back to the code editor to study the code of each button.
My first
database
88 Part 3: My first database
Lesson 3.1. Overview
In a next section, we will concentrate on the development of the elements (windows, reports, ...)
found in an application with data that will be developed from A to Z, from the interface creation to
the final distribution. You will see the main points for developing an application.
In this section, we are going to create a database used to manage orders.
The same type of database will be used in part 4 of this tutorial to develop a full application. The
database used is HFSQL Classic, the free database supplied with WINDEV. The HFSQL Client/
Server database will be presented later in this tutorial.
WINDEV can handle most of the database formats (nearly all of them). The most common formats
are:
• HFSQL, the database system supplied with WINDEV. The HFSQL database is available in
Classic mode or in Client/Server mode.
• Oracle, SQL Server, MySQL, xBase, SQL Azure, ...
• AS/400, Access, Sybase, Informix, ...
• Any database accessible in SQL language in Windows.
• Text (ASCII files).
Several methods can be used to access data:
• Native Connector (also called Native Access),
• OLE DB access,
• Direct ODBC access,
• ODBC access via OLE DB.
HFSQL
HFSQL is a database that is very powerful, very fast and very reliable.
HFSQL operates in Windows and Linux, on mobile devices (iOS, Android, Windows CE, Windows
10), on networks of any size and type, and it automatically manages hundreds of concurrent
accesses.
HFSQL can be freely distributed with your WINDEV applications.
OLE DB access
An access via OLE DB is an access that is using a multi-database access standard. This type of
access is based on MDAC (Microsoft Data Access Component).
Caution!
If you are using an OLE DB access, MDAC must necessarily be installed on the
user computers (version 2.6 or later).
Some databases may not be accessible via this method. If you want to use this type of access,
check whether an OLE DB driver exists.
The WLanguage SQL* and HRead* functions can be used with this type of access.
• Creating a project
• Creating an analysis
The lesson “Appendice 2. Using SQL data”, page 452 presents the operations
that must be performed to create a project and an analysis based on an SQL
database (via OLE DB or a Native Connector).
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 "WD My First Database". WINDEV proposes
to create this project in the "\My projects\WD My First Database" directory. You can keep this
location or modify it via the [...] button. For the project summary, type "The purpose of this
project is to manage the customers and their orders".
7. Click the "Database" step. We are now going to specify the information regarding the
database.
8. Select "Yes, create a new database" and validate. The wizard for analysis creation starts.
A corrected example can be accessed at any time to check the validity of the
operations performed.
To open this corrected project, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "My first database (Answer)".
2. You now have the ability to choose the types of databases used by the project. Select
HFSQL Classic (the database proposed by default with WINDEV).
To create the data files of this analysis, we will be using the different methods proposed by
WINDEV.
2. The list of preset data files is displayed. We are going to create the "Customer" file. In the
list of data files, select "Customer". Go to the next step.
3. The wizard proposes the list of items that will be included in Customer file. This list is very
impressive because it is used to manage several types of Customer files.
4. Check the following items: CustomerID, Company, LastName, FirstName, Address, ZipCode,
City, StateDep, Country, Phone, Cell, Email.
5. Validate the wizard.
7. The window for creating a new element is displayed. We are now going to create the data file
containing the orders.
To create a data file from the window for creating a new element:
1. Click "Data" then "Data file".
Notes
You also have the ability to create a data file from the data model editor: on the
"Analysis" pane, in the "Creation" group, click "New file".
In the wizard, the control "A record represents" is used to get an understandable
caption during the description of links between data files. A caption is
Notes
6. In the "Automatic identifier" area, keep "Automatic identifier on 8 bytes". If an automatic
identifier is defined on the data file, it means that the data file includes a unique key,
automatically managed by WINDEV.
To create the identifier (an identifier is a unique key), you have the ability to
create a numeric item whose type is "Automatic identifier".
Notes
7. Go to the next step and select the type of database associated with the data file. We are
going to work on HFSQL Classic data files. Go to the next step.
8. Click the green button to validate. The data file is automatically created in the analysis. The
description window of items is opened.
3. This item will be a key item (an index) in our data file: the keys are used to improve the
speed for accessing the data and for the sorts.
• For a database in SQL format, the engine is using the indexes at the best.
• For a sequential browse of a data file, all you have to do is specify the browse index (which
means the key).
• unique key: the value of this key will be unique in the entire data file (which
means in all the records found in the data file)
• key with duplicates: the value of this key can be found several times in the data
file.
5. You must also define the search direction of the key. The search direction is used to define
the default sort for this item. In our case, when a browse is performed on this key, the default
sort order will be "ascending".
We are now going to create the "Status" item that is used to find out the status of the order.
1. Position on a new table row. Enter:
• the name: Status
• the caption: Status of the order
• the type: Radio button, List box, Combo box. In the window that is opened, you have the
ability to select the type of control created by default for this item. It will be a radio button in
this case. Validate the window.
2. In the lower section of the screen, click the double arrow to display the parameters of the
control linked to the selected item.
The information entered here will be automatically used when creating the windows linked to
the data file. You find here the control type and the caption.
We are going to enter the following options in the "Content" tab:
• Click the "Content" tab.
• Click the "+" button to add the first option.
• The option 1 corresponds to Pending. Type "Pending" in the edit control found on the right.
4. Similarly:
• Position on a new table row and create the "TotalBT" item. This item is a "Currency" item.
• Position on a new table row and create the "TotalIOT" item. This item is a "Currency" item.
5. That's it, the description of the "Orders" file is over. Validate the description window of items.
6. The "Orders" file appears in the data model editor. You have the ability to enlarge the file
displayed. To do so, click the file, select the black handle at the bottom of the file and move
the mouse toward the bottom.
A CSV file is a text file that is using a specific format. This file contains data on
Notes
From the CSV file containing the data, WINDEV will create:
• the description of the data file in the analysis,
• the HFSQL data file with the data found in the CSV file.
To import a CSV file (or any other file) into the analysis, you also have the ability
Tip
to Drag and Drop the CSV file (from the Windows file explorer) to the data model
editor. This will be presented in the next paragraph.
8. Don't forget to check "The first row contains the names of the columns".
9. Go to the next step.
10. The structure of the data file that will be created is displayed. Keep the default options. Go
to the next step.
7. Validate the description window of items then the description window of the file.
Only the description of the "Product" file was imported into the analysis of our
project. The data found in the "Product" file was not imported into the project.
To handle the data found in the file that was just imported, in the file explorer,
Caution!
copy the "Product.fic", "Product.mmo" and "Product.ndx" files (found in the "\
Tutorial\Exercises\WD My First Database" directory) to the EXE sub-directory of
the project directory.
Note: To directly open the file explorer on the directory of your project, on the
"Home" pane, in the "General" group, click .
Creating links
All the file descriptions required by the application for account management have been created.
You also have the ability to directly enter the cardinalities of the link in the wizard.
Notes
6. Display the next wizard screen. The wizard proposes to create the "CustomerID" key in the
Orders file to store the customer corresponding to the order.
3. Go to the next step. The wizard proposes to create a relation file. Keep "Create the relation
file automatically" and go to the next step.
4. The wizard proposes the unique key of the Product file. Select "Reference". Go to the next
step.
5. Validate the creation of the key by going to the next screen.
6. Keep the default options regarding the integrity rules and go to the next step.
7. The wizard proposes the unique key of the Orders file "OrdersID." Go to the next step.
8. Validate the creation of the key by going to the next screen.
9. Keep the default options regarding the integrity rules and go to the next step.
10. Click the green arrow. The relation file is automatically created in the data model editor.
We are now going to modify the items of this relation file.
1. Click to display the description of the items found in the data file.
2. This file includes 3 items. Position the selection bar on the "Reference_OrdersID" item. This
item is a composite key.
This type of key is used to browse the data file according to complex criteria or to
perform specific searches on several items at the same time.
6. Validate the description of items (green button at the bottom of the screen) and the
description of the file.
The generation is automatically proposed when closing the data model editor while the
modifications have been performed.
You also have the ability to generate the analysis manually. That's what we are going to do.
To generate the analysis:
1. In the data model editor, on the "Analysis" pane, in the "Analysis" group, click "Generation".
2. The generation of the analysis is automatically started.
The descriptions of the data files found in the analysis have been modified.
To update the data files of the application, WINDEV automatically starts the procedure for
modifying the data files. This operation is used to update the data files (".fic" files) according to
their description in the analysis.
When your analysis is described and generated, you also have the ability to:
• Create a full application by RAD (Rapid Application Development). The application corresponding
to the analysis will be created according to this method in the next lesson.
• Create a full custom application. This method will be used to develop a full application based on
a database in part 4 of this tutorial. This application will be based on an analysis corresponding
to the one that was created in this part.
• What is RAD?
• Generating RAD
• Project test
WINDEV is supplied with several "RAD patterns" allowing you to generate several
Note
application templates. You also have the ability to create your own RAD patterns.
See the online help (keyword: "RAD pattern") for more details.
The windows, the reports, the queries and the code generated by RAD can be customized. You
also have the ability to modify the types of controls, the default values, ...
The RAD can also be used to generate several types of windows, it is the window RAD. The Window
RAD is available when a new window is created in your application.
Let's see how to use the Project RAD module.
the analysis items only. The code required for these windows to operate must be
written by the developer.
See the online help (keyword: "RID") for more details.
2. Select the pattern that will be used for the RAD generation: "Simple RAD" for example. Go to
the next wizard step.
3. All the data files found in the analysis will be taken into account:
Keep the Customer, Orders, PaymentMode and Product files only. Display the next screen.
6. Specify whether the Table controls generated in the application windows must be allow the
input or not. In our example, the Table controls will allow the user to enter new information.
Select "Yes: Allow the input in the Table controls...". Display the next screen.
7. Specify whether the user groupware must be used in the application. It will be presented
later in this tutorial. Select "No: Don't include the management of user groupware". Go to the
next step.
9. Go to the next step. The wizard for RAD generation is ended and the wizard for generating
the automatic menu starts.
The automatic menu is a help menu suited for your applications. This menu
Note
The different options proposed by the wizard for generating the automatic menu are as
follows:
When creating the menu '?', the option "? .. Help for AAF (Automatic Application
Features)" has automatically added into your application:
Notes
GUI errors may appear in the Compilation Errors pane. These errors signal
Notes
interface problems, especially in the reports (captions too long for example). To
correct these errors, the reports must be modified.
Application test
Let's now run the test of the generated application.
To run the application test:
1. Click among the quick access buttons. The application starts.
2. In the menu, select "Customers/Prospects .. List of Customers/Prospects".
3. The list of customers is displayed.
4. To add a new person, click the "New" button. An input form is displayed.
Full application
with data
126 Part 4: Full application with data
Lesson 4.1. Overview
Projects supplied
Example project
The creation of the project and analysis was presented in the previous section. We won't go back
to it. We are going to work with a project that already contains an analysis and pre-filled data
files. The analysis of the application is an improved version of the analysis that was created in the
previous section.
To open this project in WINDEV:
1. Close (if necessary) the current project in order to display the home window.
2. In the home window, click "Tutorial" and select the project named "Full application
(Exercise)".
Before we start developing the application, let's take a look at the analysis associated with the
"WD Full application" project.
If the "WD Full Application" project was not opened in the previous lesson:
1. Close (if necessary) the current project in order to display the home window.
2. In the home window, click "Tutorial" and select the project named "Full application
(Exercise)".
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "Full application (Exercise)".
created in this lesson. To open the corrected project, on the "Home" pane, in
the "Online help" group, expand "Tutorial" and select "Full application (With
windows)".
2. The new window is displayed in the editor. The backup window of the created element is
displayed.
3. In this window, specify the window title: "Menu".
4. The window name (that will be used in programming) is automatically deduced from the
window title. If this name does not suit you, you have the ability to modify it and to specify a
title that differs from the window name.
5. Validate.
Notes
This window was named "Menu" because it is the main window of our application.
It will be used as menu but it will also display information.
5. The wizard proposes the list of items found in the "Product" file. By default, all the items are
checked in order to be displayed in the Table control. In our case, we are going to display all
the items EXCEPT for the "ProductID" identifier that corresponds to the automatic identifier of
the data file.
Let's take a look at the control that was just created: the data is already displayed in the control,
even in the editor. This concept is called "Live data": the content of the data files found on the
development computer is used in the windows or reports handled in the editor. This feature is very
useful to define the size of controls found in a window for example.
Window test
We are now going to run the test of the window that was just created.
1. Click among the quick access buttons.
2. The window is automatically displayed with its data at run time.
3. You have the ability to scroll the products with the scrollbar (or with the keyboard arrows).
Some remarks:
• First of all, the Table control has the same aspect at run time and in the editor: this notion is
called WYSIWYG ("What You See Is What You Get").
• Small pictos appear at the top of columns:
• the double arrow indicates that the column can be sorted ("Reference" or "Caption" column
for example).
For example, click twice the "Caption" column: the data is displayed according to a
different order. An arrow on the left of the columns indicates that the column is sorted as
well as the sort direction.
• the magnifier indicates that a search can be performed in the column.
• A popup menu is available for the Table control and for each one of its columns. This popup
menu can be displayed:
• via a right mouse click on the column of the Table control.
• via a click on the arrow found at the extremity of column headers.
This popup menu is used for example to export the content of the Table control in Excel
format, to print, ...
In just a few minutes, we have presented some of the features that are automatically included in
the Table control. No programming is required to propose these features to your users. These
features are called "AAF" (Automatic Application Features).
Now that the list of products is displayed, you may want to modify a product. To do so, we are going
to create a window used to display the product details.
Close the window via the cross found at the top of the screen. The WINDEV editor is
redisplayed.
5. Different controls are automatically created in the window. These controls are
automatically linked to the corresponding item in the data file. To check this:
• Select the "Reference" control for example.
• Display the popup menu (right mouse click) and select "Description".
This tab shows that the current edit control is linked to the "Reference" item found in the
"Product" data file.
6. Close the description window.
7. Save the window.
Reposition the controls in the window and resize the window in order to get the following
interface:
Aligning controls
One of the first optimizations consists in aligning the controls and in giving them the same
size:
1. Select the "Caption" control then all the edit controls found in the window (keep the [CTRL] key
down while clicking the different controls for example). The first selected control will be used as
reference for the size of the other controls.
2. In the ribbon, display the "Alignment" pane of WINDEV. This pane contains all the alignment
options available for the controls.
If you don't known which alignment to choose, hover the different options
proposed by the "Alignment" pane of WINDEV. When an hovering option with the
mouse cursor, the controls selected in the window are automatically positioned
Notes
Managing anchors
2. At this time, the Table control occupies the entire window. Enlarge the window to the right:
• Keep the [SHIFT] key down.
• Enlarge the window via its sizing handles.
Notes
Pressing the SHIFT key allows you to ignore the anchoring options of controls
when resizing the window.
3. We are now going to create the button for viewing the product on the right of the table.
To create the button for viewing the product:
1. On the "Creation" pane, in the "Usual controls" group, expand "Button" (click the arrow found
below ).
2. In the list of preset buttons, click "Modify". The shape of the button appears under the
mouse. Then, click on the right of the Table control to create the button.
3. Right-click the button and select "Code" from the popup menu.
4. In the code window that is displayed, type the following code in the "Click" process:
Open(WIN_Product_form)
5. Let's study this code: Open is used to open the "WIN_Product_form" window. This function
was already presented in the first part of this tutorial.
6. Save the modifications by clicking among the quick access buttons.
7. Close the code window (click the cross in the top right corner of the code editor).
We are now going to modify the "WIN_Product_form" window to display the selected product in the
Table control.
Display the "WIN_Product_form" window in the editor: click the corresponding button in the
button bar.
To display the product data:
1. Display the processes associated with the window:
• Perform a right mouse click in the area found beside the window (called "Home area").
• Select "Code" from the popup menu that is displayed.
• The code editor appears.
2. Type the following code in the "End of initialization of WIN_Product_form" process:
// Assigns the content of items to the controls
FileToScreen()
FileToScreen is used to display in the controls the data found in the data file, for the current re-
cord. In our case, the current record will be the record selected in the Table control of the "WIN_
Menu" window.
3. Close the code window.
4. Save the window.
Display the "WIN_Menu" window in the editor: click the corresponding button in the button
bar.
Run the window test ( among the quick access buttons).
• In the list of products, click one of the products with the mouse.
• Click the "Modify the element" button.
• The detailed window of the product is displayed.
Close the windows by clicking the cross (x) in the top right corner of windows.
4. Right-click the button. Select "Code" from the menu that is displayed.
WINDEV proposes several code wizards that will generate the corresponding
Notes
code lines via simple questions. Don't hesitate to use them, you will avoid syntax
errors.
7. Keep all the default options proposed by the wizard and validate. The corresponding code is
automatically inserted.
sFile is string
This code is used to assign the selected file to the Image control found in the window.
9. Close the code editor (click the cross in the top right corner of the code window).
This feature will be checked when the management of modifications performed in the form is
completed.
Our window is using less than 10 controls and the benefit is already there; think of the
windows that use a lot more controls: a single code line performs all the assignments !
• HModify is used to update the data found in the data file for the current record.
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).
The modifications performed in the "Product form" window must be taken into account in the
Table control used to list the products. To do so, we are going to modify the code of the
"Modify" button in the "WIN_Menu" window.
1. Display the "WIN_Menu" window in the editor: click the corresponding button in the button
bar.
2. Select the "Modify" button and display the code editor ("Code" from the popup menu of the
button).
3. Modify the "Click" process as follows:
Open(WIN_Product_form)
TableDisplay(TABLE_Product, taCurrentSelection)
2. WINDEV asks you to select the first project window. In our case, this window corresponds to
"WIN_Menu". Select this window and validate.
The first project window corresponds to the first window that will be opened
when starting the application.
The first project window can be defined:
• during the project test.
Notes
3. In the list of products, select a product in the Table control (the first one for example) and
click the "Modify" button.
4. The details of the selected product are displayed in the form window.
5. Modify the price of 164.93 Dollars and type 200.00 Dollars, then click the "Validate" button.
6. When going back to the list of products, you will notice that the price was updated for this
product.
7. Display the project details again.
8. Click the "Modify" button below the image. The image picker is displayed. Select an image
and validate. The image is displayed in the form.
9. Click the "Cancel" button. The image modification was ignored in the data file.
10. Click the cross to close the application.
Adding a button
HReset(Product)
Open(WIN_Product_form)
TableDisplay(TABLE_Product, taCurrentRecord)
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 "Validate" button and select "Code" from the popup menu.
• In the "Click" process, replace the existing code by the following code:
ScreenToFile()
IF Product..NewRecord THEN
HAdd(Product)
ELSE
HModify(Product)
END
Close()
Let's study this code:
• ..NewRecord is used to find out whether the current record must be created.
• If HReset was called beforehand, the property returns True (case of a click on "New product")
and the record must be created by HAdd.
• Otherwise, the current record already exists and it must be modified by HModify.
• HAdd adds the record into the data file. This function takes the values in memory and writes
the content of file items into the data file itself. The indexes are immediately and
automatically updated. In this case, it is the "Product" data file that is updated.
The test code of the new record can be replaced by HSave. This function is used
to check whether the record is already found in the data file, and it allows you to
Notes
Several errors may occur when adding or modifying a record: duplicate error,
integrity error, password error, ...
WINDEV proposes several modes for managing these errors:
• the automatic mode: a specific window is displayed to the user whenever an
error occurs when managing the database records. This window allows the
Notes
3. Sort the elements by reference (click the header of the "Reference" column) and to two
added records appear.
Then, you will have the ability to browse the records found in the data file from the customer
displayed.
created in this lesson. To open the corrected project, on the "Home" pane, in
the "Online help" group, expand "Tutorial" and select "Full application (With
windows)".
click another tab pane: all the controls associated with the tab disappear.
• To resize the Tab control while ignoring the anchors defined for the controls
found in the pane, press the [SHIFT] key during the resize operation.
3. Click "Pane 2". The pane is displayed. Click "Pane 2" again. Enter the caption: "Finding
customers". Press the [ENTER] key to validate.
We are going to associate an image with each tab pane. To do so:
1. Display the description window of the Tab control (double-click the control for example). The
"General" tab of the description window is used to configure the characteristics of each tab
pane. The list of panes is displayed on the left. For each selected pane, its characteristics can be
modified in the right section of the screen.
2. In the description window, select the "List of products" pane.
4. We are going to associate an image with the tab via the image catalog of WINDEV.
5. Click the "Catalog" button. The window of the image catalog is displayed.
6. Select the "Flat Soft" theme in the "Theme" combo box, then type "Product" in the search
area. Click the magnifier to start the search.
Run the window test ( among the quick access buttons). Click the "Finding customers"
tab pane. The window is displayed with empty controls.
Exact-match search
To perform an exact-match search, we are going to select the name of the customer in a Combo
Box control. The "Find" button will be used to display the form of the corresponding person. A
single person corresponds to the selected name.
The Combo Box control will be positioned above the created controls. If your controls are too
close to the tab, they must be moved to the bottom. To do so:
1. Select all the controls found in the tab:
• Use the [CTRL] + A combination: all the controls found in the window and in the current pane
are selected.
• Press the [CTRL] key.
• Click the tab: only the controls found in the tab pane are selected.
2. With the mouse, move one of the selected controls to the bottom.
9. The Combo Box control will be linked to no item. Keep "No" and go to the next step.
10. Validate the next screen with the yellow arrow.
11. Give a name ("COMBO_Customer" for example) and a caption ("Sought customer" for
example) to the control.
12. Validate. Position the Combo Box control in the window (top left corner for example).
13. Select the Combo Box control and resize it (with the handles) in order for the full customer
name to be displayed.
Generic search
We are now going to perform a generic search. Instead of searching for the exact value that was
entered, we are going to search for all the elements that start with the value entered.
To perform this search, we are going to create an edit control that will be used to enter the sought
name and a button that will be used to perform this search.
To create the search control:
1. Display (if necessary) the "Finding customers" tab of the "WIN_Menu" window in the editor.
2. Create an edit control: on the "Creation" pane, in the "Usual controls" group, click .
3. In the window, click below the Combo Box control ("Sought customer"). The edit control is
created.
4. This control is named "EDT_Sought_name" and its caption is "Sought name".
HReadSeek is used to perform a generic search. In this example, the search is performed on
the "Customer" file and on the "FullName" item. The sought value corresponds to the value
entered in the "EDT_Sought_Name" control. This value is obtained by using the control name.
hIdentical constant.
Browsing forms
We are now going to add four buttons used to browse the different records of "Customer" file.
These buttons are "recorder buttons".
HReadFirst is used to read the first record of the data file, according to the key used for the
last search (FullName in our case).
The first step consists in creating the query used to select the records.
specified criteria.
This type of query is called a select query because the SELECT command is used
in SQL language.
Answer
created in this lesson. To open the corrected project, on the "Home" pane, in
the "Online help" group, expand "Tutorial" and select "Full application (With
windows)".
• In the window that is displayed, specify an ascending sort on the item and validate.
7. Give a name to the query: enter "QRY_FindOrders" instead of "QRY_NoName1" in the "Query
name" area:
8. Validate the description window of the query (green button at the bottom of the screen).
9. The backup window is displayed. Validate the proposed information.
10. The graphic representation of the query is displayed:
A popup menu is displayed when a right click is performed on the query result.
You have the ability to export the result to:
• an XLS file (Excel).
Notes
We advise you prefix the parameters of queries with the letter "p". Therefore, you
will be able to easily find them in the code editor.
Notes
To find a query parameter, all you have to do is type 'p' and the completion
feature of the code editor will propose all the parameters.
We are now going to define a condition on the payment mode. This item is not found in the
query result but a condition will be applied to it. To do so, the item will be included in the
query result and it will be made invisible so that it is not visible in the result.
1. On the left section of the description window of the query, in the "Orders" file, double-click the
"PaymentModeID" item. The "PaymentModeID" item appears in the list of query elements.
2. To avoid displaying this item in the result:
• Click found on the right of the item.
• In the menu that is displayed, select "Don't display".
3. To define a selection condition on the "Orders.PaymentModeID" item:
• Select the "Orders.PaymentModeID" item (in the middle of the screen).
• Expand the "Selection condition" button and select "New condition".
• In the window that is displayed, specify that the selection condition corresponds to a
parameter:
• Select "Is equal to".
• Select "the parameter".
• Specify the parameter name: "pPaymentModeID".
4. Validate the definition of the selection condition.
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 used to specify the parameters of this query, to run it and
to display the result.
7. We are going to associate an image to the tab via the image catalog of WINDEV. Click the
"Catalog" button. The window of the image catalog is displayed.
8. In the search area, specify "Search" and select the "Flat Soft" theme if necessary. Click the
magnifier to start the search.
9. Select, among the proposed images, the icon representing the binoculars and validate.
10. Keep the options found in the setting screen of the generated image and validate.
11. Validate the description window of the Tab control.
To create the Table control used to display the search result:
1. In the "WIN_Menu" window, click the "Finding orders" pane. The empty tab pane appears.
2. Create a Table control: on the "Creation" pane, in the "Data" group, expand "Table and list
box" and select "Table (Vertical)".
3. Click in the tab pane: the wizard for creating the Table control starts.
4. The Table control will be based on the "QRY_FindOrders" query (that was created
beforehand). Select "Display the data found in a file or in an existing query". Go to the next
wizard step.
5. Select the query that will be used as data source for the Table control:
• Expand the "Queries" group if necessary.
• Select the "QRY_FindOrders" query.
For better legibility, we are going to rename the captions of columns in the Table control.
1. Display the description of the Table control (double-click the control).
2. Click the "COL_OrdersID" column. The column title is displayed in the lower section of the
screen. Replace the "Identifier of the order" caption by "ID".
4. Click the "COL_Caption" column. Replace the "Caption" caption by "Payment mode".
5. Validate the description window of the Table control. The control is automatically updated
with the modifications performed.
6. Enlarge the ID, Date and Status columns in the Table control with the sizing handles of
columns.
7. Reduce the "Payment mode" column in order for all the columns to be displayed in the Table
control.
8. Save the window by clicking among the quick access buttons. We are going to check
the sizes of columns by running the window.
The Live data is not displayed in the controls that use a query as data source for
the following reason: the displayed data depends on the query result and it can
be known at run time only.
The test parameters have been retrieved as default parameters for the execution. We are now
going to modify the window in order for the parameters to be entered by the user, via controls.
4. Close the code editor (click the cross at the top right of the editor).
The radio buttons are also called "option box". They are used to select a single
option among the proposed ones.
How to differentiate between a radio button and a check box?
Notes
An easy way to remember: think of the old radios: a single frequency could be
selected via the button!
The radio button is used to select a single option.
MySource.pStatus = RADIO_Status
In this code, RADIO_Status is the name of the Radio Button control that was just created. The
value of this control is associated with the pStatus parameter expected by the query.
3. Close the code editor.
Before running the test, we are going to create a button used to re-display the content of the
Table control according to the value selected in the Radio Button control:
1. Create a Button control:
• on the "Creation" pane, in the "Usual controls" group, click .
• then, click at the top right of the tab pane.
2. Select the control and press the [ENTER] key on the keyboard. The caption of the button
becomes editable. Type "Find" and press the [ENTER] key on the keyboard.
3. Modify the style of the control:
• Display the popup menu of the control (right mouse click) and select "Choose a style".
• In the window that is displayed, press [CTRL F]. In the search control, type "BTN_Search".
• The style is automatically selected. Validate.
In this code, the taInit constant is used to re-run the initialization process of the Table control
(the process in which the parameters are passed to the query).
7. Close the code editor.
We are now going to check how the first parameter is passed:
1. Save the window by clicking among the quick access buttons.
2. Click among the quick access buttons.
3. Select the "Finding orders" tab if necessary.
4. Change the status of orders via the radio button and click the "Find" button. The content of
the Table control is modified.
Several payment modes can be used for an order: cash, check, ... The available payment modes
are stored in the "PaymentMode" data file.
We will be using a Combo Box control based on this data file to allow the user to select the
requested payment mode.
The "Combo Box" control is used to display a list of elements and to select an
element from this list.
Unlike a list box, a combo box is not expanded: it is expanded upon request or
when the cursor is positioned on the list.
Notes
The elements displayed in a combo box can be defined when creating the control
in the editor. These elements:
• are defined by programming.
• come from a data file or from a query.
by the code:
MySource.pPaymentModeID = COMBO_PaymentMode
In this code, COMBO_PaymentMode is the name of the Combo Box control that was just
created. The value of this control is associated with the pPaymentModeID parameter
expected by the query.
3. Close the code editor.
4. Save the window by clicking among the quick access buttons.
We are now going to check how the first two parameters are passed:
1. Click among the quick access buttons.
2. Select the "Finding orders" tab if necessary.
3. Change the status of orders via the radio button and modify the payment mode via the
Combo Box control, then click the "Find" button. The content of the Table control is modified.
3. Select the created control template and display its description ("Description" from the popup
menu).
4. In the description window, rename the control template. The new name is "CTPL_
ChoosePeriod".
5. Validate the description window.
6. Reposition and align the controls if necessary.
by
MySource.pStartOfPeriod = EDT_StartDate
MySource.pEndOfPeriod = EDT_EndDate
In this code, EDT_StartDate and EDT_EndDate are the names of the two edit controls found
in the control template. Their values are associated with the pStartOfPeriod and
pEndOfPeriod parameters expected by the query.
3. Close the code editor.
4. Save the window by clicking among the quick access buttons.
We are now going to check how the parameters are passed:
1. Click among the quick access buttons.
2. Select the "Finding orders" tab if necessary.
3. Define the different parameters of the search:
• Status of orders,
• Payment mode,
• Range of dates taken into account.
4. Click the "Find" button. The content of the Table control is modified.
• Blank
• Form
• Label
• Table
• Crosstab
• TreeView table
• Multicolumn report
• Mailing
• Form
• Composite
• Organizer or scheduler
• Gantt chart
We are now going to explain how to create the different types of reports in the "WD Full Application"
application.
A corrected project of the application is also available: on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "Full application (Answer)". In
this case, to follow the rest of the lesson, select the "Windows 32-bit executable"
configuration in the project explorer.
WINDEV AAF 22.PDF file. This file is automatically included in your application if
you choose the "Help for AAF" option when creating the automatic menu.
13. Run the window test: click among the quick access buttons.
• Select the "Finding orders" tab if necessary.
• Define the different parameters of the search:
• Status of orders,
• Payment mode,
• Range of dates taken into account.
• Click the "Find" button.
14. When the data is displayed in the Table control, click the print button or select the "Print"
option found in the popup menu of the Table control: the report that was just created is used
in both cases.
If you did not create the windows in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full application (With windows)".
Answer
A corrected project of the application is also available: on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "Full application (Answer)". In
this case, to follow the rest of the lesson, select the "Windows 32-bit executable"
configuration in the project explorer.
WINDEV proposes to create reports from several data sources: data files,
queries, controls, text files, ...
In most cases, we advise you to group the data to print via a query and to create
Note
a report based on this query. To add an information into the report, all you have
to do is add the corresponding item into the query.
The reports based on data files must be simple reports, which means reports
used to display data coming from a single data file.
The query editor will be used to create the base query of the report.
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 the "Select" option.
Indeed, this query will be used to select the records that will be printed in the report. Go to
the next step.
3. The description window of the query is displayed. To build the query, we are going to select
the elements that will be displayed in the result.
4. Double-click the items found in the analysis on the left of the description
window. The items taken into account are displayed in the middle of the screen.
We want to print in the report:
• the details regarding the customer. In the "Customer" file, double-click the FullName,
Address, ZipCode, City and Country items.
• the information regarding the order. In the "Orders" file, double-click the OrdersID and Date
items.
• the details regarding the product. In the "Product" file, double-click the Reference, Caption
and PriceBT items.
• the details regarding the order line. In the "OrderLine" file, double-click the Quantity and
TotalBT items.
• the details about the grand total of the order. In the "Orders" file, double-click the TotalBT
and TotalIOT items.
The order in which the items are inserted into the query is important. Indeed,
this order corresponds to the order used to display the data in the report. The
Note
At this time, this query is used to select all the orders and the corresponding order lines.
We want to select the data corresponding to a single order whose identifier is known. Therefore,
we are going to define the order number in parameter.
To manage the "Order identifier" parameter:
1. Select the Orders.OrdersID item (in the middle of the screen).
2. Expand the "Selection condition" button and select "New condition".
3. In the window that is displayed, we are going to specify that the selection condition
corresponds to a parameter:
6. Validate the description window of the query (green button at the bottom of the screen).
7. The backup window is displayed. Validate the proposed information.
8. The graphic representation of the query is displayed:
6. In the list of data files and queries, select the "QRY_OrderForm" query. Go to the next step.
• The items regarding the order will also be displayed in the "Page header" block. Indeed, this
information must not be repeated on each line of the order. For the OrdersID and Date
items, click the line corresponding to the item. In the "Block" column, expand the combo box
and select "Page header".
• Furthermore, we are going to modify the caption of the "OrdersID" item.
• Select the line containing the OrdersID item.
• Click the Caption column and enter "Order #".
• The items regarding the order lines will be displayed in the body of the report. These items
will be displayed on all the order lines of the order.
The following table presents the different assignments of items in the order presented in the
wizard:
Item Block
FullName Page header
Address Page header
ZipCode Page header
City Page header
Country Page header
OrdersID Page header
Date Page header
Reference Body
Caption Body
PriceBT Body
Quantity Body
TotalBT Body
TotalBT_Or Page footer
TotalIOT Page footer
Print margins
When choosing the print margins, don't forget to take into account the physical
Notes
margins of printers. The physical margins of the printer are margins where no
print is allowed. Furthermore, the physical margins differ according to the type
of printer.
Validate.
3. The report execution is displayed on the screen.
We are now going to define the caption of the option and its code.
1. Select the "Menu option" option.
2. Press the [SPACE] key on the keyboard: the option becomes editable. Type the new caption
("Print the order form") and validate.
3. Display the code associated with the option:
• Select the option.
• Display the popup menu (right mouse click) and select "Code".
4. Type the following code:
// Print preview
iPreview()
// Initializes the report query
iInitReportQuery(RPT_Order_form, ...
TABLE_QRY_FindOrders.COL_OrdersID)
// Starts printing the report
iPrintReport(RPT_Order_form)
In this code:
• iPreview is used to specify that the report print will be performed in the print preview.
• iInitReportQuery is used to specify the parameters expected by the query associated with
the report. In our case, the query expects the order number in parameter. This order number
is found in the COL_OrdersID column of the TABLE_QRY_FindOrders Table control for the
current row.
Last step: we are going to link the popup menu to the Table control.
1. In the "WIN_Menu" window, display the "Finding orders" tab.
2. Select the Table control and display its description ("Table description" from the popup
menu of the control).
3. In the "GUI" tab, expand the "Popup menu" combo box.
4. Check "Add a popup menu", select the "MENU_Order" menu and select "At the beginning" to
specify that the menu is placed before the system menu.
Print test
If you did not create the windows in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
Answer
5. In the list of data files and queries, select the "Customer" file. Go to the next step.
6. Define the search key of the file. In our case, the Customer file will be browsed according to
the full name of the customer. Select the "FullName" search key. Go to the next step.
7. We are now going to define the sort option of data in the report. By default, the wizard
proposes the item used as search key in the data file. As we want to create a report used to list
the customers by country and by state, we are going to add a sort on these two items.
• Validate.
9. To add a sort on the state:
• Click the "+" button to add a sort item.
• In the window that is displayed, select the Customer.StateProvinceRegion item.
• Validate.
10. Modify the order of sort items. the customers must be sorted by country, by region, then in
alphabetical order.
• The "Customer.Country" item appears in second sort item. Select this item and move it in
first sort item via the arrow buttons.
• The "Customer.StateProvinceRegion" item appears in third sort item. Select this item and
move it in second sort item via the arrow buttons.
Uncheck the CustomerID, Complement, Phone, Cell and Email items. Go to the next step.
16. This screen is used to define the report layout.
Print margins
When choosing the print margins, don't forget to take into account the physical
Notes
margins of printers. The physical margins of the printer are margins where no
print is allowed. Furthermore, the physical margins differ according to the type
of printer.
You have the ability to print the current page or the entire document by clicking the printer ("Print"
pane).
• Validate.
5. Display the code of the option and in the "Selecting the menu" process, type the following
code:
If you did not create the windows in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
Answer
3. Validate the description of the sum. The sum of "TotalIOT" was added into the list of query
result.
You will notice that the query editor of WINDEV creates the queries in everyday's
language (and also in SQL language).
Notes
This allows you to check whether your query performs the proper operations.
• For the series (values displayed in the Chart control): the Chart control will display a single
series corresponding to the total IOT calculated by the QRY_SalesEvolutions query.
• Double-click the "Sources of series" table.
• Type the caption: "Series 1".
• The source corresponds to: Browsing a file or a query,
• The data corresponds to the "Sum_TotalIOT" item in the QRY_SalesEvolutions query.
As for the Chart control, we are going to include the Pivot Table control in a new tab of the WIN_
Menu window.
Run the window test ( among the quick access buttons). Click the "Pivot table" tab then
the "Calculate" button.
CAUTION: The calculation time depends on the size of the database and on the
Notes
number of row and column headers. The result of the pivot table can be saved to
avoid re-calculating at each interrogation.
Click the "+" signs to expand the different columns and rows.
Stop the test. We are now going to improve this pivot table. Indeed, nothing indicates that one
of the numbers found in the cells corresponds to a quantity. We are going to use a specific
display mask for this value.
To follow this lesson, you must have followed the lessons of this part until lesson
Answer
See the "WD Email" example (complete example supplied with WINDEV) for
more details. This example can be accessed from the home window of WINDEV
(CTRL <).
The "Password" edit control appears in the editor with a bullet and an eye.
At run time, when the user types his password, the characters will be replaced
by bullets. A click on the eye will allow the user to see his password in clear and
Tip
to check it.
This feature can be disabled by programming if necessary. See the online help
for more details.
MyMessage is Email
MyMessage..Sender = EDT_Sender
MyMessage..Subject = EDT_Subject
MyMessage..HTML = EDT_HTML_Text
MyMessage..Message = HTMLToText(EDT_HTML_Text)
// Adds a recipient
Add(MyMessage..Recipient, ...
COMBO_Recipient..DisplayedValue)
This code is using an Email variable. The different properties of this variable are used to
define the characteristics of the email to send. This code associates the content of the
different window controls to the properties of the Email variable.
• the code for sending the email:
// Sends the email
IF EmailSendMessage(MySession, MyMessage) = False THEN
Error("Message not sent.", ErrorInfo())
ELSE
// Message sent
ToastDisplay("Message sent", toastShort, ...
vaMiddle, haCenter)
END
The email is sent by EmailSendMessage. All you have to do is pass in parameter the variable
containing the characteristics of the SMTP session and the variable containing the
characteristics of the email to send.
If the email is sent, a Toast message is displayed, indicating that the email was sent. A Toast
message corresponds to a furtive message.
• the code for closing the SMTP session:
// Closes the SMTP session
EmailCloseSession(MySession)
Formatting
modified:
• by specifying an automatic tab order: the first control in edit will be the
control found in the top left corner of the window, the second one will be
the one found immediately to its right or below...
• by specifying a tab order by selection.
In this code, OpenChild is used to perform a "non-modal" opening of the window: the user will
be able to write an email and to see the information displayed in the main window at the
same time.
If you did not create the windows in the previous lessons, you can follow this
Answer
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full application (Answer)".
To include the user groupware in the "WD Full Application" project:
1. On the "Project" pane, in the "Project" group, click "User groupware". The window for
configuring the user groupware is displayed.
If you (or the end user) is using Windows Vista (or a more recent operating
Note
7. In the "Files" tab, select "Enable the history of connections". This option allows the supervisor
to get information about the connected users.
To configure the user groupware, we are going to create a "Test_1" user and associate this
user with the "Tests" group. Then, we are going to configure the management of rights for the
group.
password, click the icon shaped like an eye: the password appears in
clear as long as the mouse button is pressed.
3. Click the "Save" button. The "Tests" group appears in the list of groups defined for the user
groupware.
Application test
We are now going to run the application test by using the "Test_1" login.
1. Run the project test ( among the quick access buttons). A login window is displayed.
2. Connect yourself as "Test_1" with the "Test_1" password. Validate.
3. The application starts. You will notice that the "New" and "Modify" buttons are grayed and
that the "Send an email" option is invisible.
If automatic tests are run in your application, the user groupware must be
configured in order not to use the login window. To do so, fill the "Automatic
Note
login in test mode" option in the "Runtime" tab of the window for configuring the
groupware.
2. The classes
3. The supercontrols (via the use of a dictionary)
4. The external components
5. The internal components
Let's present some cases in which the external components can be useful.
Teamwork
A developer creates and maintains an external component that is made available to other
developers. No risk of modifications "made by mistake"!
If you did not create the windows in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
Answer
• A component,
• ...
You have the ability to choose the requested configuration at any time and to
generate in a single operation all the elements for all the configurations of a
project.
6. Go to the next step and validate the creation of the configuration.
7. The new configuration automatically becomes the current configuration.
3. Select all the elements ("All" button) and go to the next step.
4. The wizard asks you to select the component elements that will be accessible from the
client application.
If the option "Allow the component to be translated" is checked, the specified component
elements can be translated from the application that is using the component.
This translation will be performed via WDMSG, independent module used to check out and
check in the project messages to translate.
In this example, don't check this option. Go to the next step.
7. Choose the component languages. Our example will contain the English language only. Go
to the next step.
8. The wizard proposes to manage the different component versions. In our example, the
component was just created.
Keep the default options. Go to the next step.
13. Go to the next step. The wizard will automatically generate the documentation about the
component. This documentation can be based on the comments inserted into your source
code.
14. Go to the next step. You have the ability to modify the generated documentation.
Don't do anything. Go to the next step.
15. You have the ability to create a help file associated with your component (CHM format).
This help file will be supplied along with the component. The users will be able to access it by
pressing F1 from the code of the component.
We will not generate any help file. Go to the next step.
16. The component will not be saved in the SCM. Go to the next step.
17. All we have to do now is give a physical name to our component.
If the component was created from the "WD Full Application (with windows)"
example, select the "EXE\CompoOrdersByCity" sub-directory then the
Notes
• On the "Details" tab, the description of the component as well as the help that was
automatically generated. This allows you to identify the re-usable elements of the
component.
The description of the component can be accessed at any time. All you have to
Notes
do is select the component in the project explorer and select "Description" from
the popup menu. In this case, you also have the ability to define the load mode
of the component.
We are now going to create a blank window to use the component.
1. Create a blank window.
• The window title is "Customers by city".
• The window name is "WIN_Customers_by_city".
• Validate the backup.
2. Display the code associated with the window ("Code" from the popup menu).
3. We are going to call the DataLocation function of the component in the "End of initialization"
process. This function expects in parameter the path used to access the data files handled by
the component. Enter the access path to the data found in the "WD Full Application" example.
DataLocation(...
"C:\WINDEV\Tutorial\Exercises\"+ ...
"WD Full Application\Exe\Windows 32-bit Executable\")
// Specify the path of YOUR data
sResultList is string
// Retrieves the list of customers and their orders
// for the specified city
sResultList = GiveOrdersByCity(EDT_City)
// If the list is not empty
IF sResultList <> "" THEN
// Clears the table
TableDeleteAll(TABLE_Result)
// Browses the results
FOR EACH STRING sACustomer OF sResultList SEPARATED BY CR
// Adds this customer to the table
TableAdd(TABLE_Result, sACustomer)
END
ELSE // If the list is empty
InfoBuild("No customer found for ""%1""",...
EDT_City)
END
Standard distribution
In this case, you must supply all the files required for your component to operate. These files are
created when generating the component (WDI, WDK and WDO files, images, other documents, ...).
These files will be manually copied from their source directory to the destination directory. The
WINDEV projects that use this component will find the dependent files in this destination directory.
List of files that must be supplied for a standard distribution:
• the files automatically generated by WINDEV (WDK, WDI, ...).
• the dependency files.
• the WDO file must be supplied if the component is using dependency files. This file contains
the references to the external files used in the component.
Close the "CompoUse" project: on the "Home" pane, in the "General" group, expand "Close"
and select "Close the project".
Open the "WD Full Application" project. Select (if necessary) the project configuration
corresponding to the component in the project explorer.
To create the setup, on the "Project" pane, click "Setup procedure".
The wizard for creating the setup of the component starts.
We won't go into details about the different setup modes of a component. Follow the instructions
given by the wizard. See the online help (keyword: "External Component, Distributing a component")
for more details.
• Overview
• Importing and consuming a Webservice
With WINDEV, these Web services can be used as client, via the SOAP protocol on HTTP (the
standard Internet protocol for transferring HTML pages), with the SOAPxx, DotNetxx and J2EExx
functions.
Regardless of the platform of the Web server (.NET, J2EE, ...), a Web service is accessible via the
SOAP protocol.
Notes
With WINDEV, you don't even have to be an expert in this field. A wizard takes
care of ("almost") everything!
Practical example
A Webservice specific to the Tutorial allows you to check the different operations that can be
performed on a Webservice.
Included in the "WD Full Application" project, this Webservice is used to interrogate a supplier
database to check the availability (stock) of a product from its reference.
In a first time, the Webservice will be imported into the "WD Full Application" project then it will be
used in the application to check the availability of the product from a Product form.
Importing a Webservice
If you did not create the windows in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
Answer
5. Validate the information window. The imported Webservice is found in the "Webservices"
folder of the project explorer.
4. Display the processes associated with the button ("Code" from the popup menu).
5. Type the following code in the "Click on BTN_InStock" process:
If you did not create the windows in the previous lessons, you can follow this
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
Answer
To display the project dashboard (if not already done), on the "Project" pane, in the "Project"
group, click .
The dashboard
The project dashboard includes several Widgets. Each Widget displays various information about
the project.
For example, the "Performances" Widget is used to start the performance profiler or to open the
last performance report.
The "Static audit and Compilation" Widget is used to quickly see whether the project contains
compilation errors.
You have the ability to enable (or not) a Widget, to add one or to delete one at any time.
To create an automatic test on a window, all you have to do is run the test of the window:
1. Open the "WIN_Menu" window in the editor.
2. On the "Automatic tests" pane, in the "Tests" group, expand "New" and select "Save a new
scenario".
3. In the window that is displayed, click "Start recording".
4. The test of the window is run.
5. Click the "Finding orders" tab.
6. Choose the "Credit card" payment mode.
7. Click the "Find" button.
8. Close the window via "Menu .. Exit" and confirm the end of the application.
This option may not be available if you did not follow the entire tutorial. In this
Note
The test is available and it was not run ( in front of the name of the test in the editor).
12. The test can be run at any time:
• Select the name of the test in the test editor.
• In the popup menu (right mouse click), select "Run".
13. The test is automatically run and the test editor displays the result in a new window (the
test was successfully run in our case).
14. Validate the test result and save the test if necessary.
The WLanguage functions used to run automatic tests are the EmulateXXX
Note
functions.
We are now going to perform a modification in our window and to run the test again. The
modification affects the "Find" button. We are going to gray it.
1. Display the "WIN_Menu" window if necessary.
2. In the editor, click the "Finding orders" tab and select the "Find" button.
3. Display the description of the "Find" button ("Description" from the popup menu).
4. In the "GUI" tab, select "Grayed".
5. Validate the description window of the control.
6. Save the window.
7. Go back to the test editor (click the corresponding button in the bar of opened elements).
8. Run the test again.
9. The result window of the test indicates that the test is in error. Validate this window.
10. Redisplay the "WIN_Menu" window in the editor.
11. Display the description of the "Find" button ("Description" from the popup menu).
Another feature of the test editor is the ability to modify or add WLanguage code in the test
scenarios. We are going to add code lines to check whether the Table control contains at
least one record.
1. Display the test editor if necessary (double-click "TEST_Menu" in the project explorer for
example).
2. Add the following code before the line "EmulateMenu("_Menu","OPT_Exit")":
// If the table control contains no record
IF WIN_Menu.TABLE_QRY_FindOrders..Occurrence = 0 THEN
// An error must be signaled
TestWriteResult(twrError, ...
"The Table control is empty after search")
END
If you did not perform the operations in the previous lessons, you can follow this
Answer
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full application (Answer)"
The telemetry allows you to get detailed statistics about the use of your
application by the end users. The telemetry returns various information
Note
about your deployed applications, giving you the ability to improve them.
See the online help for more details about implementing and configuring the
telemetry.
account" was checked when creating the executable, the elements found
in the patch will replace the elements found in the application library when
starting the application.
See the online help for more details.
Select "Automatic (recommended)" if necessary. This option is used to install the data files:
• in the directory of the application data (if the executable is installed in "Program files").
• in the executable directory.
11. Go to the next step.
Note
executable to operate.
The option "Framework DLL beside the executable" allows you to use the necessary libraries
only. These DLLs are copied into the executable directory.
The option "Framework included in the executable" allows you to distribute the executable
only (the DLLs being found in the executable).
The option "Common framework" allows you to use the framework common to all the WINDEV
applications installed on the computer. With this option, the framework is installed once only
on the computer (it can also be downloaded by Internet) and it is used by all the WINDEV
applications.
16. Select "Common framework" and choose "Common WINDEV framework".
Go to the next step.
17. This step concerns Windows Vista (and later). You have the ability to include a manifest for
a use in Windows Vista (and later).
For our example, check the option "Don't include a manifest for Windows Vista and later".
Go to the next step.
18. WINDEV proposes to perform a backup of the project. This backup is used to keep a
version of the project whenever the executable is created. In our case, select "No: don't save
the project" and validate the wizard.
19. The executable is created. It can be run immediately to check its operating mode. To do so,
click the "Run the executable" button.
That's it, the executable creation is ended. A lot of options to fill but after a first configuration of
your choices, you will be able to validate all the wizard steps from the beginning.
You also have the ability to click the steps specified in the wizard in order to
Note
reach a wizard screen directly. The default options of the other screens will be
automatically validated.
This option is used to create a help file in order to present the new features of the version to
the end users. During a first setup, this file can correspond to the help of the software.
Select "Create a documentation for the new features" and go to the next step.
6. You have the ability to define the elements that will be automatically included in the help
file. Keep the default options and go to the next step.
Installing an application
In the window for the end of setup creation, click the "Test" button. If this window was closed, run
the "Install.exe" program found in the directory of the setup program. The setup of the application
starts.
We are going to follow the different steps of the setup program for the "WD Full Application"
application.
1. If you are using an operating system corresponding to Windows Vista (or later), a window
requests the authorization to run the program. Validate this window.
2. Choose the language of the setup program and click "OK".
Overview
Several setup modes are available for a WINDEV application:
• Stand-alone setup:
This type of setup is used to create a single setup program.. This setup program will be run by
the end user on his computer.
To update the application, all you have to do is re-create a setup of the application. Then, the
end user will have to install this new program.
This is the type of setup that was just performed.
• Setup with automatic update:
This type of setup is used to automatically detect the updates when starting the application. If
an update is available, the user can perform this update immediately.
This type of setup is available both via network or via the Web. You also have the ability to
perform a multi-site setup.
We are now going to present the operating mode of a setup with update.
The diagram below presents the setup mode of an application that is using a local HFSQL Classic
database, with a network update.
The version of the reference application is automatically checked whenever the application is
started by the end user. If this version was modified (if the reference version was updated for
example), an update is automatically proposed for the final application.
Reference
version
Request
of setup
WinDev
application
Executable of
user setup
Database
Setup Run the Run the HFSQL Classic
Control Center
support setup user setup (Optional)
applications
(CD,DVD,USB...) multi-user (optional)
The diagram below presents the setup mode of an application that is using a HFSQL Client/Server
database, with an update by Internet.
Note: This type of setup can also be performed via the PCS CLOUD (if you have an account).
Multisite setup
The multi-site setup combines:
• a reference network setup deployed on a local network.
• an HTTP setup used to update the reference setup on the local network.
Reference
version
Request The user displays
for setup the download WinDev
Executable page Application
of user
setup
HFSQL
Client/Server server
Manta server
Manta Manager
"Reports and Queries" is free and it can be distributed with your applications
Notes
developed with WINDEV. See the license for more details about the distribution
and use conditions.
If you did not perform the operations in the previous lessons, you can follow this
Answer
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full application (Answer)".
To use "Reports and Queries" from your application, you must configure the project
associated with your application.
1. Open the "WD Full Application" example project if necessary: on the "Home" pane, in the
"Online help" group, expand "Tutorial" and select "WD Full Application (Exercise)". The project is
loaded.
If the reports have not been created in the "WD Full Application" project, open
Notes
the corrected project of the application: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "WD Full Application (Answer)".
4. Validate.
If you did not perform the operations in the previous lessons, you can follow this
Answer
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full application (Answer)"
Validate. A message proposes to synchronize the different project elements. Answer "Yes". All
the project elements opened in the editor (windows, reports, ...) are closed and the additional
languages are added to these elements.
Note: The captions that exist in the base language of the project are automatically copied into
the added languages.
To enter the shared information in several languages, let's take a simple example: the caption
of the control linked to the "Address" item of "Customer" file:
1. Select the Customer file.
2. Display the description of the items found in a data file ("Description of items" from the
popup menu of the file).
3. Select the "Address" item and display the parameters of the control linked to the selected
item (shared information). To do so, click the double arrow at the bottom of the screen .
4. In the "Caption" area, type the caption for the French language: "Adresse".
5. Validate.
To change the image of the bar used in the WIN_Menu window according to the runtime
language:
1. Open the "WIN_Menu.WDW" window.
2. The image of the bar is found in the template associated with the window. Therefore, the
associated window template must be opened:
• Click the "WD FullApplication" control and display the popup menu.
• Select "Open the template".
5. The window for managing the multilingual images is displayed. A different image can be
used for each language. This feature is very useful if you are using images containing text.
6. For our example, in the "French" area, select the "header-fr.png" file.
7. Validate. The "Multilingual value" caption appears in the "Image" area of the description
window.
2. To translate this type of message, position the cursor in the string "Exit from the application?"
and press [CTRL T]. You can also, on the "Code" pane, in the "Languages" group, expand
"Translate the strings" and select "Translate the messages".
4. This window allows you to translate all the messages of your program into all project
languages.
5. In the "French" area, type "Quitter l'application?" and validate.
6. The icon as well as a number appears in the code editor.
3. Specify:
• Whether the regional settings must be automatically enabled according to the language
used for the input. In this case, if the language requires a specific character set, this
character set will be automatically selected.
• The software or the site that must be used for the translation. You have the ability to use
WDDixio, translation dictionary supplied with WDMSG (see next page), a specific translation
software or site, or Google Translate (see the online help for more details).
• The supported languages.
4. When the translation parameters are defined, you have the ability to use the button
found in the different description windows of the project elements: this button allows you to
use the software defined for the translation.
Programming
Nation is used to change the runtime language of the project. The constants passed in parameter
allow you to specify the language to use.
The change of language performed by Nation is immediately effective.
• Overview
• The Source Code Manager
• Using the Source Code Manager
Principle of SCM
The Source Code Manager is used to store and share the projects and their elements.
The principle is as follows:
• A reference version of each one of your projects is found on a server. All these versions are
called "SCM database".
• Each developer has a local copy of the different projects on his computer.
LOCAL COPY
SCM server
Local Developer
project
Local network
LOCAL COPY
• Whenever a developer wants to modify a project element (window, report, query, ...), he
informs the SCM that he is becoming the temporary owner of this element. To do so, this
element will be checked out from the SCM database by the developer.
• This developer gets exclusive rights on this element: all the requested modifications can be
performed on this element.
• The other developers are still working on the copy of the reference version of this element
(found in the SCM database).
• When the modifications have been made by the developer, the checked-out element is
checked back into the SCM database.
Local
project
Local
N
4 project
CH
RO
N
IZ
Developer
AT
IO
Disconnected
N
Local
project
The SCM supports teamwork and it allows you to find out the history of all the modifications.
The SCM can also be used to manage and control the elements shared between several projects.
If you did not perform the operations in the previous lessons, you can follow this
Answer
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full application (Answer)"
We are now going to include the "WD Full Application.WDP" project in the SCM database:
1. On the "SCM" pane, in the "Project" group, click "Add the project". The wizard for adding
projects into the SCM starts:
The SCM database was not created yet. We are going to create one.
Note: We are going to create a "local" SCM database (on the development computer). The
operating mode would be similar for a network SCM database.
The SCM database can be in HFSQL Classic format (local or network) or in HFSQL Client/
Server format. We are going to create a SCM database in HFSQL Classic format.
Notes
If the SCM database is in HFSQL Client/Server format, then this SCM database
can be used remotely.
4. Select "Creating a database in network share mode" and specify the directory of this SCM
database ("C:\My Projects\Local SCM database" for example).
5. Validate the creation of the SCM database ("Create the database" button).
6. The SCM database is now created. We are going to include our project in this SCM
database.
7. Go to the next step.
windows, ...) are included in the SCM, the relevant elements can be shared
between the different projects. Therefore, the same element is checked in once
only into the SCM and the modifications are automatically applied to the other
projects.
In a real case, in order for other developers to work on a project found in the Source Code
Manager, they must retrieve a copy of this project locally.
To do so, the following operations must be performed:
1. Open your project from the Source Code Manager: on the "Home" pane, in the "General"
group, expand "Open" and select "Open a project from SCM".
2. Specify the location parameters of the SCM database and validate (this step is required
only if the current project in the editor does not belong to the SCM):
Note: If the project was already opened from the SCM, the SCM proposes to open the project as
usual or to overwrite the content (to retrieve the entire project).
This operation must be performed once only by each developer who is using the project.
The developer who added the project into the Source Code Manager (you in this case!) has no
operation to perform.
The method for opening a project managed by the SCM is identical to the method
Notes
for opening a project not managed by the SCM: all you have to do is open the
project (".WDP" file) corresponding to the local copy.
We are going to modify the project by asking to display the skin template on the system
windows:
1. Display the project description: on the "Project" pane, in the "Project" group, click "Description".
2. Click the "Style" tab.
3. Check "Apply the theme of skin template to the system windows".
4. Validate the description window of the project.
Several SCM windows appear:
1. First of all, the window for automatic project check-out is displayed. Indeed, we want to modify
a project characteristic so the project must be checked out.
2. The option "Automatically check the project back in at the end of operation" is used to
automatically check the project back in at the end of its modification. Keep this option.
3. Validate this window.
4. WINDEV proposes to recompile the project. Accept the full project recompilation.
5. The description window of the project is closed and the project is automatically checked
back into the SCM database.
The method for modifying a checked-out element (GUI, code, ...) is the same as the method for
modifying an element in a project not managed by SCM.
However, the modifications performed on a checked-out element are not visible to the other
developers.
If another developer runs the checked-out element, the element that is currently found in the SCM
database will be used.
This allows you to make an application evolve by keeping a steady version in the SCM database.
2. The automatic check-out is enabled during the first modification: all you have to do is move
a control to check the element out. You also have the ability to click the "Check out" icon found
in the ribbon ( ).
// Runs the click code of the button that modifies the image
ExecuteProcess(BTN_Modify, trtClick)
Merging code
Notes
You have the ability to compare an element to one of its earlier versions.
This allows you to compare the code in order to retrieve a code section
that was "lost" or accidentally deleted by another developer.
• access the history of the element found in the SCM database ("Properties" button).
• enter a comment about the modifications performed. By default, WINDEV proposes the
comment typed during the check-out.
• send a message to the other developers.
• check in the modifications made to the element while keeping the element checked out
("Keep the element checked out").
SCM administrator
The SCM administrator is used to directly handle the different projects included in the source code
manager.
It is used to:
• manage the SCM databases (creation, connection to a SCM database).
• manage the files and directories found in a project of the SCM database (add, delete,
rename, ... files and directories).
• manage the different files of the SCM database (check-in, check-out, share...).
• start some tools (options, maintenance, ...).
• show the history of an element.
• show the status of elements.
• perform backups.
• grant rights to the different SCM users.
• list the projects in which you are taking part in order to dissociate from them (if necessary).
See the online help of WINDEV (keyword: "SCM") for more details.
Conclusion
We have presented the main steps for developing an application.
WINDEV proposes several tools to optimize your applications. See “Project audits”, page 375 for
more details.
Managing
a HFSQL Client/
Server database
348 Part 5: Managing a HFSQL Client/Server database
Lesson 5.1. Introduction
• Principle of Client/Server
• Why switch an application to HFSQL Client/Server?
Client computer 1
WinDev application
Manta server
WinDev application
HFSQL
Client computer n Client/Server
databases
WinDev application
Don't forget to open this port on the firewall in order to connect to the HFSQL
server from another computer.
8. The wizard asks for the recipients of the notifications of HFSQL server. This information
is not required in this tutorial. Go to the next wizard step and confirm that the setting will be
performed later.
9. Install the HFSQL Control Center if this one is not already found or accessible from your
computer.
Caution!
10. Specify whether you want to take part (or not) in the product improvement by allowing us to
collect information regarding the use of product. This optional and anonymous collect allows
PC SOFT to improve the product features.
11. The setup is performed. By default, to connect to the server in administrator mode, use
the "admin" user without password.
Notes
You can also describe the connection to the HFSQL server by programming. See
the online help ("HDescribeConnection") for more details.
Overview
Switching a database from the HFSQL Classic mode to the Client/Server mode is the most
common operation.
WINDEV proposes several methods to perform this switch:
• perform this adaptation in the data model editor.
• perform this adaptation from the HFSQL Control Center.
To better understand the different steps, we are going to switch the application that was created
in Part 3 to Client/Server mode by using the first method, the data model editor.
If you did not perform the operations in the previous lessons, you can follow this
Answer
lesson by opening a corrected project: on the "Home" pane, in the "Online help"
group, expand "Tutorial" and select "Full application (Answer)".
• the server name (name of your computer for example) and the port number. Go to the next
step.
• the user name and password (leave this information empty to use the administrator). Go to
the next step.
• the database name ("WD Full Application" in our example). Go to the next step.
8. Type the connection name (keep the proposed name).
10. Click "Yes".
11. In the next step, select all the proposed files:
13. Select the data files that will be copied onto the server: in our case, all the data files found
in the EXE directory.
16. Generate the analysis: on the "Analysis" pane, in the "Analysis" group, click "Generation".
An automatic modification of data files is automatically performed. You have the ability to
cancel the automatic modification of data files if all the data files are updated.
17. The development project was successfully adapted. You may also have to adapt the
deployed application (if the deployed application is using HFSQL Classic files for example).
This operation is configured when creating the setup program of the application.
3. Validate the screen. The HFSQL Control Center is displayed. This start mode allows you to
see the different files linked to the analysis of the current project.
The Control Center lists the Client/Server data files found in the analysis linked to the current
project. No connection is established: the files are grayed.
5. To see the data found in the files, double-click one of the data files in the list on the left
("Orders" for example). If the HFSQL Control Center does not recognize all the connection
parameters, a connection window is used to perform the effective connection to the HFSQL
Client/Server server used. If this window is displayed, specify the password and validate.
6. The information about the selected data file that is using this connection is displayed in a
new tab:
• The "Description" tab gives information about the data files (file items, ...).
• The "Content" tab displays the records found in the data files.
The user rights specified in the HFSQL Control Center are granted for the
Caution!
Some users may not have the rights to write into some data files for example.
To run a simple test, we are going to create a user and allow this user to see the records found in
Customer file.
To directly connect to the database found on the server:
1. Expand the menu found at the top left of the HFSQL Control Center and select
"Connect to a HFSQL server".
2. The home window is displayed in the HFSQL Control Center.
3. The option "Connect to a HFSQL server" is selected by default. Specify the characteristics of
the server that was installed in the previous lesson and validate.
4. The characteristics of the HFSQL server are displayed:
• in the panel on the left, the name of the HFSQL server as well as the list of databases found
on this server appear.
• in the right section of the screen, a new tab is displayed, allowing you to see the
characteristics of the HFSQL server.
7. To create a new user, in the ribbon, in the "Users" group, click the "New" button. The screen
used to define the user characteristics is displayed.
• Account enabled: If this option is not checked, the user exists but he is not
enabled (users on holiday for example).
• Password expiration: A password can be valid for a given number of days only.
(configurable).
9. Validate the user creation. By default, no rights are granted to this user.
We are now going to grant rights to the user: the "Test" user can connect to the database and he
can read the Customer file.
5. Click the “Apply” button found at the bottom of the window (blue arrow). The rights become
effective.
6. Close the window for managing rights.
5. Click the "Apply" button found at the bottom of the window (blue arrow). The rights become
effective.
6. Close the window for managing rights.
The users and their rights can also be managed by programming with the
WLanguage functions. See the online help for more details.
Conclusion
The HFSQL Control Center is a tool for managing databases, allowing you to:
• stop or restart a server if a problem occurs,
• manage the users and their rights,
• reindex the data files if necessary,
• perform backups of the database.
The HFSQL Control Center is a redistributable tool that can be installed on the computers of the
users who are working with HFSQL Client/Server databases. The HFSQL Control Center must be
used by the administrator of the database.
If these options are checked, the next steps are used to configure the elements that will be
taken into account for the setup on end-user computers.
See the online help for more details.
Optimizing and
debugging
a project
372 Part 6: Optimizing and debugging a project
Lesson 6.1. Overview
Start WINDEV 22 (if not already done). Close (if necessary) the current project in order to
display the home window.
Open the "WD Optimization" project.
To do so, in the home window, click "Tutorial" and select "Optimize a project".
Tip: if the home window is not displayed, on the "Home" pane, in the "Online help" group,
expand "Tutorial" and select "Optimize a project".
Static audit
The static audit is a feature of the environment used to study the source codes of a project in
order to detect different problems and to propose improvements.
To start the static audit on the "WD Optimization" project:
1. On the "Project" pane, in the "Audit and performances" group, expand "Edition audit" and
select "Trigger the edition audit".
The static audit of the project can also be started from the project dashboard,
via the "Static audit and Compilation" widget.
You must:
• enable the Widget if necessary (click the link "Click here to re-enable").
• click the arrow.
Notes
2. The "WIN_UnusedWindow" window is never called. The window that lists the orphan
elements is used to:
• specify that the element is still used ("Mark as used" button). In this case, the window will
not be taken into account anymore during the audit. This option can be interesting when
using a test window specific to the development for example.
• delete the element if it is actually unused ("Delete" button).
• see the element ("View" button).
• find the use cases in the strings for example ("Search" button).
3. In our case, this "WIN_UnusedWindow" window is actually unused, click "Delete".
4. Close the window of orphan elements (click the cross in the top right corner).
In the window of static audit, click the "Refresh" button to update the audit report.
2. The wizard proposes to modify an analysis item by changing it into a key with duplicates.
3. We are going to apply this change: click the "Apply these modifications to the analysis"
button.
4. A window is displayed, asking you to confirm the modification of the analysis. Validate this
window.
5. The data model editor is opened and the modification is performed. A message indicates
that the analysis must be generated. Click "Yes" to confirm the generation of the analysis.
6. The application is using data so an automatic modification of data files is required. Validate
the different steps of the wizard for data modification (by keeping the default options).
7. The window of the static audit is automatically refreshed.
Let's see what happens at run time by starting the dynamic audit.
Dynamic audit
The dynamic audit is used to analyze the execution of the application. The audit is used to detect
problems such as:
• Excessive memory consumption,
• Slowness of algorithms used,
• Errors "hidden" at run time,
• ...
A dynamic audit can be performed in a test environment or on a live application.
The "WD Optimization" project contains a specific window triggering errors that can be detected by
the dynamic audit.
The dynamic audit and the project test will be started at the same time.
To start the dynamic audit on the "WD Optimization" project:
1. On the "Project" pane, in the "Test mode" group, expand "Test mode" and select "Debug the
project while the audit is enabled". The project test is run.
Note: The dynamic audit is automatically run whenever the application is started
by a project GO. A status report is automatically displayed in the dashboard:
• use a text file in the application directory. This solution allows you not to modify
the executable. All you have to do is create, in the directory of the executable, a
file named like the executable and whose extension is ".WX".
The audit generates a ".wdaudit" file, this file must be loaded in the development
environment in order to analyze the result.
See the online help (keyword: "Dynamic audit") for more details.
• Overview
• Starting the performance profiler
• Analyzing the result
In this case, only the code found between ProfilerStart and ProfilerEnd is analyzed. The result is
saved in a WPF file.
The performance profiler can also be started from the project dashboard, via the
"Performances" widget. You must:
• enable the Widget if necessary (click the link "Click here to re-enable").
• expand the button with arrow and select "Analyze the performances".
Notes
Let's take a look at the report window of performance profiler. The results are displayed in
several tabs:
• the "Summary" tab presents the ten longest processes.
• the "Mapping" tab presents a graphical view of main processes.
• the "Details" tab presents all the processes run during the application test (from the slowest
one to the fastest one).
• the "Calls" tab is used to see the details of the operations performed in a process.
Let's present these different tabs in our example.
• The "Summary" tab presents the ten longest processes. In our example, you can see that
the local procedure named "UpdateProductStock" takes more than 3 seconds to be run.
• Click the "Calls" button to display the details of the calls to the UpdateProductStock
procedure. Select the "Ping" line and click the "Code" button: the corresponding code line is
displayed in the code editor.
The slowdown is caused by the fact that the address specified for Ping is not accessible.
Let's check the operating mode of the application by optimizing this code:
1. Replace the code line containing Ping by the following code line:
// Checks the accessibility of provider server
Ping("www.google.com")
• Overview
• Using the debugger
Several methods can be used to start the debugger. See the online help (keyword:
Note
4. Click the "Process to analyze" button. The debugger starts. The current line is preceded by
a little arrow.
Let's continue our operations in the debugger. We are now going to run the
UpdateProductStock procedure step by step in the debugger.
1. To run this procedure step by step, press the [F7] key (or click the "Detailed step by step"
button in the ribbon).
2. The procedure code is displayed in the debugger.
We are now going to add an expression to monitor the evolution of its value in the "Debugger"
pane. This expression can have any type: variable, function, operation on variables, ... The
expression result is calculated and displayed.
This expression is used to perform a custom debugging. For example, you can find out the
content of a variable while it is being used in the application.
1. Press [F7] to run the different lines of the UpdateProductStock procedure until you reach the
line:
PROGBAR_Progress++
2. Hover "PROGBAR_Progress". The value displayed in the tooltip is 0.
3. Select "PROGBAR_Progress" in the code editor and display the popup menu (right mouse
click). Select "Add the expression to the debugger".
HModify(Product)
The [F8] key is used to run the code of the InterrogateSupplierDatabase procedure without
running it step by step in the debugger.
2. Click the following line with the mouse (caution: click inside the line and not in front of it):
IF HExecuteQuery(QRY_QuantityOrdered) THEN
3. Press the [F6] key (or click the "Run until cursor" button found in the ribbon).
4. The arrow indicating the line currently run moves until it reaches the code line where the
cursor is positioned. The code lines found before the cursor are automatically run.
We are now going to add a breakpoint and to run the code until it reaches the breakpoint:
1. Click in the hatched area with the mouse, in front of HModify. A breakpoint (red bullet)
appears.
2. Press the [F5] key (or click the "Continue" button found in the ribbon). The code is run until
it reaches the breakpoint. The arrow used to identify the current line moves until it reaches the
breakpoint.
396 Part 6: Optimizing and debugging a project
3. Click the breakpoint to remove it.
To end this test, we will be using an "Auto-stop" expression. An "Auto-stop" expression is used
to start the debugger as soon as a condition is checked or when the value of a variable is
modified. In our example, the debugger will be started as soon as the value of the progress
bar is set to 50%:
1. In the "Debugger" pane, select the "PROGBAR_Progress" expression that was added
beforehand.
2. Click the green circle.
3. Press the [F5] key to continue the test.
4. A message is displayed, indicating that the value of the "PROGBAR_Progress" expression
changed.
5. Validate.
6. In the "Debugger" pane, select the "PROGBAR_Progress" expression. Click the expression
again: the "Expression" column becomes editable. In the "Expression" area, add "=50". You will
get "PROGBAR_Progress = 50".
7. Press the [F5] key. The program continues to run. The debugger is started again when the
value of the progress bar is set to 50.
That's it, we presented the main features of debugger. To stop the test in the debugger, click
"End the test" found in the ribbon.
Advanced
programming
400 Part 7: Advanced programming
Lesson 7.1. Overview
• Overview
• How to open a training example
• How to open a unit example
Practical example
To simplify the presentation of different features, we will be using unit examples or training
examples supplied with WINDEV.
To open a complete example, a training example or a unit example from the home window:
1. Display the home window (CTRL + >).
2. In the home window, click "Open an example". The list of complete examples, training
examples and unit examples supplied with WINDEV is displayed. These examples are grouped
by type of example (complete, training, ...).
3. In the search area, you have the ability to type a keyword (type "Error" for example). Only the
examples containing this word are listed.
4. To open an example, all you have to do is click the link found in the window.
5. For the complete and training examples, the current project is automatically closed and the
sample project is opened.
6. For the unit examples, the associated window is opened in the current project.
Operating mode
Two operations are performed when an error is detected by a WLanguage function:
• a return value of error is returned by the function (fOpen returns "-1" if the specified file was
not opened for example).
• the error is detected by WLanguage (the ErrorDetected variable is set to True) and the error
details are returned by ErrorInfo.
This second operation can be automatically managed by the error management of WINDEV.
Implementation
The automatic management of errors can be configured:
• in the code editor: all you have to do is click the "If error: by program" link in the code editor:
To understand the different error cases, we will be using a training example supplied with
WINDEV.
1. Close the current project if necessary. The home window is displayed.
2. In the home window, click "Open an example". The list of complete examples, training
examples and unit examples supplied with WINDEV is displayed.
3. Type "Error" in the search area. Only the examples containing this word are listed.
4. Select the "WD Auto Error Management" project. The project is loaded.
Overview
The external files are also called text files or files with direct access. In most cases, this type of file
contains text but it can also contain binary information such as images, sounds, ...
In this lesson as in the entire WINDEV documentation, we will be talking of external files.
WINDEV allows you to handle the external files by programming. The WLanguage functions can be
used to create, read... external files. All the functions can easily be identified: they start with the
letter "f".
The notion of "record" does not necessarily exist in an external file. To handle an external file, you
must know its structure, which means how the data is organized inside the file.
The CSV files are text files that use a specific structure. Therefore, they can be handled like the
text files.
The .INI files are also text files that use a specific structure. Two specific functions are used to
handle them: INIRead and INIWrite.
Practical example
Handling directories
Several WLanguage functions are used to handle the directories and their files.
Practical example
Open (if necessary) the training example named "Handling directories" and run the test of the
corresponding window.
This window groups the operations that can be performed on the disks and directories:
• create a directory,
• find out the current directory,
• check the existence of a directory,
• list the directories,
• copy and create a directory, ...
See the online help (keyword: "External file") for more details.
Overview
XML (Extensible Markup Language) is a markup language, which means a language that presents
information enclosed in tags. XML is a metalanguage that is used to invent new tags to isolate the
elementary information that may be found in a Web page.
XML is used to structure a document containing data. A HFSQL data file containing several items
and records can be exported to an XML file for example (XML* functions).
WINDEV supports:
• the files in XML format via a native access supplied with WINDEV. See the online help for
more details.
• the export to XML (TableToXML, TextToXML, HExportXML)
• the import of XML data (HImportXML)
• the use of an XML document via the advanced XMLDocument type and via the WLanguage
functions starting with XML.
The XML file can also be handled in the code editor directly. You must:
1. Drop the XML file from the file explorer to the project explorer, "XML and XSD descriptions"
folder.
2. Drop the XML file from the project explorer to the code editor. The xmlDocument variable is
automatically created as follows:
<Variable Name> is xmlDocument, description = <Document Name>
3. You now have the ability to access the variable nodes by their names. These names are
automatically proposed by the mechanism for automatic completion of the code editor.
Open the unit example named "Reading and writing in XML format".
Run the test of "WIN_XMLOperations" window. This window is used to:
• create an XML file. This file is created by the XML functions.
We won't go into details about all the features proposed by the XML functions.
See the online help for more details.
Go back to the editor and study the code of the different buttons.
Notes
We won't go into details about all the features proposed by the XLS functions and
the advanced types. See the online help for more details.
• Overview
• Drawing a line in dynamic compilation
Example
The dynamic compilation will be presented via the unit example named "Dynamic compilation".
The "Dynamic compilation" window explains how to dynamically compile WLanguage code (stored
in string format), run the procedure that was dynamically generated and process the possible
runtime errors.
To run the test of this window:
1. Open the unit example named "Dynamic compilation".
2. Run the test of "WIN_DYNAMIC_COMPILATION" window.
4. Press the [CTRL] + [F2] keys. The click code of the "Run" button re-appears in the code
editor. In the rest of this code, you can see that the function that is dynamically compiled is run
by Execute.
Practical example
The management of events will be presented via the unit example named "The Event function".
Open the unit example named "The Event function".
Optional processes proposed by WINDEV
Several optional processes are proposed for each element (window, control, ...).
To add an optional process:
1. Display the processes linked to the List Box control found in the window of the unit example:
• Select the List Box control.
• Press the [F2] key.
• The code editor is displayed.
This toolbar presents the main available optional processes. To identify the processes, hover
the different icons.
3. To add a process, click the corresponding icon. The corresponding process is automatically
displayed in the code editor.
4. To display the full list of available optional processes, all you have to do is click "...".
5. To add a process, all you have to do is check the corresponding box and validate this
window. Add the "Key Pressed" event for example.
Windows events
To manage more "specific" events, you have the ability to use the WLanguage Event function. This
WLanguage function is used to associate a WLanguage procedure to a Windows event.
Notes
To use the Event function, you must be familiar with the Windows programming,
especially the Windows events.
See the online help of WINDEV (keyword: "Value of constants for the Windows API") to find out the
list of Windows events.
Run the test of "WIN_Event_Function" window. This window detects whether the list is
handled by the mouse or by the keyboard.
1. Click the List Box control with the mouse.
2. Use the mouse to move the selection bar.
3. A message is displayed, specifying whether the mouse or the keyboard was used.
PROCEDURE MouseOrKeyboard()
// The _EVE.wMessage variable contains the message number
SWITCH _EVE.wMessage
// Keyboard
CASE WM_KEYDOWN
// Message indicating that the keyboard is used
STC_SelectionType = "Selection with the keyboard"
STC_SelectionType..Color = LightRed
// It's the mouse
CASE WM_LBUTTONDOWN
// Message indicating that the mouse is used
STC_SelectionType = "Selection with the mouse"
STC_SelectionType..Color = LightBlue
END
Example
WINDEV is supplied with several unit examples allowing you to understand the
Example
• Overview
• Server application
• Client application
WINDEV is supplied with a training example allowing you to understand the use
of sockets: "WD Using sockets". This example can be accessed from the home
window of WINDEV (CTRL <).
Exchanging data
When two computers are using the same socket, a communication stream is established between
these two computers. These two computers can read and write character strings on the socket.
Note: To avoid locking the applications, the incoming messages are managed by a specific thread
in most cases.
To read and write on the socket, the WINDEV server application must use SocketRead and
SocketWrite.
426 Part 7: Advanced programming
Caution: To perform a read operation, a write operation must have been performed beforehand.
For example:
1. The client computer writes into the socket: it sends a request to the server.
2. The server performs a read operation on the socket in a thread. As soon as a message is
received, the message is processed by the server.
3. If a response to the message is required, the server identifies the client computer
(SocketClientInfo) and sends a response to it.
Client application
A client application of a socket server connects to a standard server in order to exchange
information via a socket.
Example: A client WINDEV application can connect to a standard news server on Internet.
The steps for creating a client application are as follows:
1. Connecting to the server.
2. Exchanging data.
3. Ending the communication.
Exchanging data
When two computers are using the same socket, a communication stream is established between
these two computers. These two computers can read and write character strings on the socket.
Note: To avoid locking the applications, the incoming messages are managed by a specific thread
in most cases.
To read and write on the socket, the WINDEV client application must use SocketRead and
SocketWrite.
Example test
Let's study the code of the different buttons that have been used.
First of all, we are going to study the processes performed by the socket server (computer A).
1. Display the code of the "Create" button found in the "Computer A" area:
• Select the "Create" button.
• Press [F2] to display the processes.
2. In the "Click" process, you will notice the presence of SocketCreate that is used to create
the socket. Close the code editor.
3. Display the code of the "Get" button found in the "Computer A" area:
• Select the "Get" button.
• Press [F2] to display the processes.
4. The following code is used in the "Click" process:
EDT_SentenceReceivedFromComputerB = ...
SocketRead("ComputerA", False, 2000)
IF EDT_SentenceReceivedFromComputerB <> "" THEN
Info("Message received from the IP address # "+...
SocketClientInfo("ComputerA", SocketAddress))
END
You will notice the presence of SocketRead that is used to read the socket that was created
beforehand. The message read is immediately displayed in the "EDT_
SentenceReceivedFromComputerB" control. Close the code editor.
You will notice the presence of SocketWrite which is used to send a message onto the socket
to which computer B is connected. Close the code editor.
Note: In this lesson, we have seen a "simple" communication between a server and a client
computer: the client sends messages and the server processes the messages. You have the ability
to create more complex applications.
You have the ability to establish a communication between two applications, both client and
server. In this case, the management of threads becomes very important to manage the send
operations and the responses.
The unit example named "The FTP functions" presents the operations that can be performed on
the files found on an FTP server.
Open the unit example named "The FTP functions". This example presents the main features
that can be used on an FTP server.
Display the code of the "Connection" button found in the "WIN_FTP" window:
1. Select the "Connection" button.
2. Press [F2] to display the associated code:
Note: You also have the ability to specify the port number for connecting to the FTP server ("21" by
default) as well as the connection mode ("True" for a "passive" connection, "False" for an "active"
connection). See the online help (keyword: "FTP, Functions") for more details.
Sending a file
To send a file to an FTP server, all you have to do is use FTPSend.
Let's see a code sample that can be used:
// When connecting to the server with FTPConnect, we have
// retrieved the connection number in the gnConnectionID variable
// Transfer the "C:\MyDocuments\File.DOC" file to
// the "Temp" directory found on the server.
bResult is boolean = FTPSend(gnConnectionID, ...
"C:\MyDocuments\File.DOC", "/Temp")
Pay great attention to the case (uppercase/lowercase characters) for the name
of directories on the server. Indeed, some FTP servers operate under UNIX and
are "case sensitive", which means that the case is taken into account for the
Caution!
3. In the example, the procedure called is used to display the files found in a trace window.
PROCEDURE FTPFileListCallBack(sFileName,nFileSize
<useful>,sAttribute,sModifDate <useful>,sModifTime <useful>)
// Is it a file or a directory
IF sAttribute = "D" THEN
// Directory or sub-directory
Trace("Directory: "+sFileName)
ELSE
// File
Trace("File: "+sFileName)
END
IF YesNo(No, ...
"Do you want to close the connection to the FTP server ?")=Yes ...
THEN
// Disconnect from the FTP server
FTPDisconnect(gnConnectionID)
IF ErrorOccurred THEN
// Error while closing the connection
Error("Unable to close the FTP connection",ErrorInfo())
RETURN
END
// The connection is ended
Info("The connection to the FTP server is ended")
END
Other FTP functions are available but we won't go into details about them in this tutorial. They are
mainly used to:
• create, delete, modify directories on the FTP server,
• create, delete, modify files on the FTP server,
• retrieve information about a directory and/or a file,
• ...
See the online help (keyword: "FTP, Functions") for more details.
The classes
A class contains the description of a data structure (the members) and the procedures (methods)
that handle the members.
Therefore, a class defines a type of data and its behavior.
The objects
A class is used to create objects. Each created object owns the members described in its class
and it can be handled via the methods of its class. An object is defined as an instance of the class.
When the class is declared, all you have to do is associate an object with a class in order for the
object to be handled by all the methods of this class.
The members
A member is a data (or parameter) of the object.
The methods
A method is used to act on the object, to modify its members for example.
A method is a procedure. Its operating mode is similar to the one of the standard procedures of
WLanguage.
Concept of inheritance
The inheritance is used to include the characteristics of an existing class (base class) in a new
class (derived class). The inheritance allows you to create a new type of data from a known type in
order to add features to it or to modify its behavior. Therefore, the base class will not be modified.
A class can inherit from a class: it becomes a sub-class of this class.
The objects found in a derived class can access all the methods, all the members and all the
properties of the ancestor classes ; it is as if the methods, the members and the properties of the
ancestor classes were part of the derived class.
Data encapsulation
The data encapsulation is used to ensure that the data belonging to the object is not accidentally
modified by functions (methods) external to the object.
This allows you to prevent the user of an object from accessing some or all of its members. The
members whose access is forbidden are called private members.
These private members can only be accessed from the methods designed for this purpose in the
class.
Example
Let's take a simple example to apply these concepts:
• Let's consider the PERSON class.
• Florence is an instance of the PERSON class.
• The last name, first name and date of birth can be members of the PERSON class.
• The Age[] method can be a method of the PERSON class. It would calculate the age according to
the "date of birth" member and according to todays' date (returned by DateSys).
• Inheritance: A contact can be either a person, or a company.
• PERSON could be a class derived from CONTACT.
• COMPANY could be a class derived from CONTACT.
To illustrate these concepts, we will be using the training example named "WD Simple OOP".
1. Open the training example named "WD Simple OOP".
2. Run the test of this example.
3. Click the different buttons corresponding to the animals in order to add them.
4. Stop the example test to go back to the editor.
Note: We won't go into details about the syntax of OOP but we will present a simple example of an
object-oriented program. See the online help (keyword: "OOP, Class") for more details.
Declaring a class
WINDEV allows you to easily declare the classes from the project explorer. To create a class:
1. In the project explorer, select the "Classes" folder.
2. Display the popup menu of this folder (right mouse click) and select "New class".
3. In the window that is displayed, specify the class name (TestTUT for example) and validate.
4. To display the code of the class in the code editor, double-click its name in the project
explorer.
PROTECTED
// Name of Image control used for the drawing
m_sNameImageControlForDrawing is string
// List of savanna animals
m_arrTheAnimals is array of cAnimal dynamic
END
"cSavanna" is the name of the class.
"m_sNameImageControlForDrawing" and "m_arrTheAnimals" are members of the class.
The "PROTECTED" keyword is used to specify that these members can only be handled from a
code of the class or from a code of a derived class.
WINDEV allows you to easily declare the classes from the project explorer. To create a
method:
1. Right-click your class found in the project explorer.
2. Select "New method" from the popup menu.
3. In the window that is displayed, specify the name of the method and validate.
4. Enter the code of the method in the code editor.
RESULT True
// Savanna object
gclTheSavanna is cSavanna(IMG_Landscape..FullName)
3. The different classes used by the "WD Simple OOP" project are found in this diagram.
We won't go into details about the use of UML language with WINDEV. See the online help
(keyword: "UML") for more details.
Appendices
444 Part 8: Appendices
Appendice 1. Vocabulary
AAF
Abbreviation of Automatic Application Features.
Alignment
Method for organizing the controls in a window or in a page. For example, centering a control in a
window, set several controls to the same width, ...
Analysis
Describing the structure of data files (or tables) and their relationships.
Anchoring
Mechanism used to define the positioning or resizing rules in order for the window or page content
to automatically adapt when a window or a browser is resized.
Application RAD
Fast development method of a program from a program template.
Assignment
Operation that consists in assigning a value in a variable or in a control. For example:
// Assign the value MOORE to the CustomerName variable
CustomerName = "MOORE"
Class
Element defined in Object-Oriented Programming (OOP). A class groups methods (actions) and
members (data).
Classic
Type of access to a HFSQL file. A HFSQL file is a Classic file when it is directly accessed in its
directory.
Client/Server
Type of access to a HFSQL file. A HFSQL file is a Client/Server file when it is accessed by
connecting to a server containing this file via the HFSQL engine.
Control template
Container of one or more controls (with processes) that can be indefinitely re-used in windows or
pages.
Database
Element containing the program data. The data is organized in files or tables.
Data binding
Method that is used to associate a graphic element of the GUI to a data found in a variable, an
item, an array...
Deployment
Action that consists in installing a program on the user computer or on a server.
Editor
Program that is used to create a project element (window editor, page editor, ...)
Event programming
Type of programming. A user action on a window or on a page induces a code to run. The code of
the action to run is typed in the event representing the user action.
For example, the “Button click” event corresponds to a mouse click performed by the user on this
button.
External component
Software brick that is used to export one or more business rules in order to re-use them.
File
Element that constitutes a database. A file is used to store the data entered in a program.
For example, a CUSTOMER file will contain the customer information that was entered in a
program.
Synonym: Table
GUI
Abbreviation of Graphical User Interface. Description of windows or pages that constitute a
program. This is what the user will see when using the program.
Index (file)
Synonym: key
Integrity constraint
Rule to respect associated with a file item in order to insure the consistency of data in a database.
Item
Element that belongs to the structure of a data file or table (found in an analysis). For example, a
CUSTOMER file can include the FirstName and LastName items.
Internal component
Container that groups elements found in a project (window, page, query, report, class, ...) in order
to allow and simplify a share with another project.
Key
Characteristics of a file item. A key item is used to optimize the searches and the sorts in a data
file.
Synonym: index
Link in an analysis
Describes the nature of the relationship or the common point between 2 analysis files. From a
link, consists in describing the integrity rules that must be respected when writing into the relevant
files.
Synonym: Relationship
Live Data
Mechanism that consists in displaying real data coming from the database when creating the GUI.
This mechanism is used only if the element is linked to the data file.
Local
Corresponds to the scope in memory of a variable or procedure. A local element can only be
accessed in the process where it was defined. The opposite is global.
Member
Variable belonging to a class.
Method
Procedure belonging to a class used to act on the data (members) of the class.
Popup
Type of window (or page). A popup is a window (or a page) that is opened on top of another window
(or page). You can still see the content of the window (or page) underneath while performing the
input in the popup.
Popup menu
Drop-down menu containing the possible actions depending on the location where the right
mouse click was performed and on the type of element onto which this right click was performed.
Private
Variable or procedure that can only be used in the current element.
Procedural programming
Type of programming. In procedural programming, we define functions that call each others. Each
function or procedure is associated with a specific process that can be divided into sub-processes
until we get basic functions.
Procedure
Project element containing the code of a process to run.
Project
Element that groups all the elements that constitute a program or a site. A project contains for
example an analysis, pages, reports, queries, ...
Project code
Code run when starting a program or a site.
Project configuration
Description of the output format of a project: Windows executable, Linux, JAVA, ...
Public
Variable or procedure that can be used from all the elements.
Query
Element written in SQL language that is used to access (in read-only or in read/write) the content
of a relational database.
RAD
Abbreviation of Rapid Application Development
Fast development method of a program from an analysis (description of data files).
Report
Project element that defines a print to perform.
Report block
Element constituting a report. For example, a Page Header block, a Page Footer block, a Body
block.
Report template
Container representing a standard report that can be applied to a report or to several project
reports.
SCM
Abbreviation of Source Code Manager. Tool for organizing, sharing the source codes of projects,
managing rights, ...
Style
Element used to describe the graphic style of a control found in a window, in a page or in a report.
A style includes for example a type of font, the size of characters, the color of characters, etc.
Style sheet
Contains the list of styles used in a project.
Structure
Type of variable that includes several sub-variables.
Table
Type of variable that contains several values. The values can be accessed via a subscript. The [ ]
characters are used access the array elements.
Table (file)
Element that constitutes a database. A table is used to store the data entered in a program. For
example, a CUSTOMER table will contain the customer names and addresses that have been
entered in a program.
User groupware
Tool for describing the access rights to the GUI for the users of a program or site. For example,
prevent a user from being able to click a "Delete" button according to his login or to his group.
Variable
Element used to store a program value in memory. Several types of variables are available. Each
type corresponds to the nature of the value that will be stored. For example, a string variable to
store the name of a person, a currency variable to store an amount.
Webservice
Program installed on a Web server whose processes are accessible via the Web.
Window template
Container representing a standard window that can be applied to a window or to several project
windows.
XML
Language for organizing data in order to normalize and simplify the exchange of data (mainly used
in the exchanges with the Webservices).
• Creating a project
• Creating an analysis
This lesson is intended to the users with a good knowledge of SQL databases.
Notes
Some operations to perform on the SQL database will not be presented in details
tools (MySql, Oracle, SQL Server, ...). The image directory is used to get the
images of the Product file.
3. Run the SQL script files on the SQL server.
Your SQL database is ready for this lesson.
3. 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 "sqldatabase".
4. The different wizard steps are specified on the left of the wizard. These steps can be clicked
directly. The other screens in the "Description" step being not fundamental, click "Charters"
directly.
5. This step is used to define the programming charter. Don't modify the suggested options.
Go to the next step via the arrows found at the bottom.
6. This step is used to define the style book. Select "Elegant". Go to the next step via the
arrows found at the bottom.
2. You now have the ability to choose the types of databases used by the project. Select OLE
DB (or the SQL database use if you own the corresponding Native Access).
Note: The Native Access are listed first.
6. In our case, choose "Access the data in its current format directly". Go to the next step.
7. Select the tables (files) to import.
8. Validate and end the wizard. The tables are imported and viewed into the data model editor.
The generation is automatically proposed when closing the data model editor while the
modifications have been performed.
You also have the ability to generate the analysis manually. That's what we are going to do.
To generate the analysis:
1. In the data model editor, on the "Analysis" pane, in the "Analysis" group, click "Generation".
2. The generation of the analysis is automatically started.
When your analysis is generated, the data can be handled like the HFSQL data. There is no
difference. You can:
• Create a complete application by RAD (Rapid Application Development). See “Lesson 3.4. The
full RAD”, page 118 for more details.
• Create a complete custom application. See part 4, page 127, for more details.
This course has discussed a wide range of topics, but not all the features of WINDEV, far from it!
You are now familiar with the main concepts.
You can also explore the examples supplied with WINDEV: some are simple and only address
one topic while others are more complex. These examples will show you the different aspects of
WINDEV. 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 proposes several other features not presented in this tutorial:
• HTTP and telephony functions
• creation of skin templates...
• nested reports, queries with parameters...
• dynamic compilation, calls to DLL, external languages...
Conclusion 459