Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Programming
Tome1_2.book Page 2 Vendredi, 28. mai 2010 5:50 17
Remember to visit our site (www.windev.com) on a regular basis to find out whether upgraded versions are
available.
This documentation is not contractually binding. Modifications may have been made to the software since
this guide was published. See the online help.
All product names or other trademarks mentioned in this publication are registered trademarks of their respective owners.
© PC SOFT 2010: This publication may not be reproduced in part or in full without the express consent of PC SOFT.
Tome1_2.book Page 3 Vendredi, 28. mai 2010 5:50 17
SUMMARY
1. SETUP 45
1.1 Required configuration ...............................................................................................................45
1.1.1 Configuration required for installing WinDev ..................................................................................... 45
1.1.2 Configuration required to install WebDev ......................................................................................... 45
1.1.3 Configuration required to install WinDev Mobile ............................................................................... 45
1.2 Installing WinDev, WebDev or WinDev Mobile .........................................................................45
1.3 Configuring the Web servers ....................................................................................................46
1.4 Register yourself ........................................................................................................................46
1.5 Electronic key .............................................................................................................................46
1.6 Compatibility with the earlier versions ......................................................................................46
2. THE PRODUCTS 47
2.1 Overview ....................................................................................................................................47
2.1.1 WinDev........................................................................................................................................... 47
2.1.2 WebDev.......................................................................................................................................... 47
2.1.3 WinDev Mobile................................................................................................................................ 47
2.2 User friendly editors ..................................................................................................................47
2.3 The WLanguage ........................................................................................................................47
2.4 Choosing a programming language ........................................................................................48
2.5 The database ............................................................................................................................48
2.6 Developing multi-user or single-user applications ...................................................................48
2.7 Team application development ................................................................................................49
2.8 Distributing applications and sites ............................................................................................49
Programming
2. THE PROJECT 58
2.1 Overview ....................................................................................................................................58
2.2 Creating the project ..................................................................................................................58
2.2.1 Creating a WinDev project ................................................................................................................58
2.2.2 Creating a WinDev Mobile project .....................................................................................................58
2.2.3 Creating a WebDev project ...............................................................................................................59
2.3 Project dashboard and diagram .............................................................................................. 60
2.3.1 Dashboard ......................................................................................................................................60
2.3.2 Project graph ...................................................................................................................................60
2.4 Characteristics of the project ....................................................................................................60
2.4.1 The project file .................................................................................................................................60
2.4.2 The project’s directory ......................................................................................................................60
2.4.3 The elements of the project ..............................................................................................................61
2.4.4 The project task list ..........................................................................................................................61
2.4.5 Time management ...........................................................................................................................62
2.5 Project operations ..................................................................................................................... 62
2.5.1 Archiving a project ...........................................................................................................................62
2.5.2 Restoring a project...........................................................................................................................62
2.5.3 Duplicating a project........................................................................................................................62
2.5.4 Copying or deleting a project ............................................................................................................62
2.5.5 Renaming a project..........................................................................................................................62
4. THE ANALYSIS 67
4.1 Overview .................................................................................................................................... 67
4.2 Creating a LDM (Logical Data Model) ...................................................................................... 67
4.2.1 Creating an analysis (or LDM)...........................................................................................................67
4.2.2 Adding a file to an analysis...............................................................................................................67
4.2.3 Creating an item ..............................................................................................................................68
Tome1_2.book Page 5 Vendredi, 28. mai 2010 5:50 17
5. QUERIES 77
6. THE WINDOWS 78
6.1 Overview .................................................................................................................................... 78
6.1.1 Window skin template......................................................................................................................78
6.1.2 Languages supported in a window....................................................................................................78
6.2 Creating a window ................................................................................................................... 78
6.2.1 Creating blank windows ...................................................................................................................78
6.2.2 Creating the project windows by RAD ................................................................................................78
6.2.3 Creation of standard RAD, RID windows............................................................................................79
6.2.4 Importing a window from a non-WinDev application (WinDev only) ...................................................79
6.2.5 Internal window ...............................................................................................................................79
6.2.6 Window based on a template ...........................................................................................................80
6.3 Simple window operations ....................................................................................................... 80
6.3.1 Opening a window ...........................................................................................................................80
6.3.2 Modifying the size of a window..........................................................................................................80
6.3.3 Save and copy a window ..................................................................................................................80
6.3.4 Importing and exporting a window ....................................................................................................80
Programming
8. THE REPORTS 89
8.1 Report types ...............................................................................................................................89
8.2 Creating a report .......................................................................................................................89
9. REFERENCE A SITE 90
9.1 Referencing principles ...............................................................................................................90
9.2 Referencing or not a static or AWP page of a site ...................................................................90
9.3 Referencing a page and entering its keywords .......................................................................90
Programming
10.3 Running the test of a WinDev project and debugging it on the user computer ..................... 95
10.3.1 Configuring the remote computer ...................................................................................................95
10.3.2 Running and debugging the executable on a remote computer ........................................................95
10.3.3 Debugging an executable that is already running on a remote computer ..........................................96
10.4 Run the test of a WebDev project ........................................................................................... 96
10.4.1 Testing the project from the editor ..................................................................................................96
10.4.2 Processes run ................................................................................................................................96
10.4.3 Directory of the data files used for test ............................................................................................97
10.4.4 Stopping the test ...........................................................................................................................97
10.4.5 Testing the project from the WebDev administrator..........................................................................97
10.4.6 Differences between running the test of a site from the editor and from the test page of the administrator........... 97
10.4.7 Testing a project from a test server..................................................................................................97
10.4.8 Stress test / Regression test...........................................................................................................98
10.5 Testing a remote WebDev site ................................................................................................98
10.5.1 Configuring the remote WebDev application server .........................................................................98
10.5.2 Starting and debugging a site on a remote application server ..........................................................98
10.5.3 Debugging a site currently used on a remote application server .......................................................98
10.6 Testing a WinDev Mobile project ............................................................................................ 99
10.6.1 Testing a project in simulator mode (on the development computer) ...............................................99
10.6.2 Testing and debugging on the Pocket PC connected to the development computer ..........................99
10.6.3 Testing a project directly on the Pocket PC connected to the current computer .................................99
10.6.4 Command line ...............................................................................................................................99
10.6.5 Using functions for handling CEDB databases.................................................................................99
10.6.6 Directory of the files used for test....................................................................................................99
10.6.7 Stopping the test of a project ...................................................................................................... 100
10.7 Testing a window ...................................................................................................................100
10.7.1 Testing the window from the editor............................................................................................... 100
10.7.2 Stopping the test of a window...................................................................................................... 100
10.7.3 Managing the passwords (analysis or file) ................................................................................... 100
10.8 Testing a page ........................................................................................................................100
10.8.1 Testing the page from the editor .................................................................................................. 100
10.8.2 Stopping the test of a page ......................................................................................................... 101
10.8.3 Managing the passwords (analysis or file) ................................................................................... 101
10.9 Tracing a project .................................................................................................................... 101
Programming
11.7.4 Starting the login window/page from one of the windows of the application or from one of the pages of
the site................................................................................................................................................................ 113
11.7.5 Defining menu rights ................................................................................................................... 113
11.7.6 Configuring the data files of the user groupware ........................................................................... 114
11.7.7 Reinitializing the data files specific to user groupware .................................................................. 114
11.7.8 Modifying the data files used by the user groupware..................................................................... 114
11.7.9 Managing the analyses ............................................................................................................... 114
11.8 Functions for managing the user groupware ......................................................................... 114
10
11
12
13
1. INTRODUCTION 163
1.1 Some characteristics of WLanguage ........................................................................................ 163
1.2 Server code and browser code programming ........................................................................ 164
2. VARIABLES 165
2.1 Simples types ........................................................................................................................... 165
2.1.1 Principle ....................................................................................................................................... 165
2.1.2 Types of variables.......................................................................................................................... 165
2.1.3 Declaring a simple type ................................................................................................................. 166
Programming
14
3. OPERATORS 191
3.1 Overview ................................................................................................................................... 191
3.2 Logical operators ..................................................................................................................... 191
3.2.1 Overview....................................................................................................................................... 191
3.2.2 Rules............................................................................................................................................ 191
3.2.3 Notes ........................................................................................................................................... 191
Programming
15
16
17
18
19
20
21
22
23
24
25
26
27
3. COOKIES 379
3.1 Overview ..................................................................................................................................379
3.2 What is a cookie made of? .....................................................................................................379
3.3 WebDev and the management of cookies .............................................................................379
3.3.1 Available elements........................................................................................................................ 379
3.3.2 Writing a cookie on the user’s machine .......................................................................................... 379
3.3.3 Reading a cookie from the web user’s computer............................................................................. 380
4.2.4 Configuring the Linux application server to manage the validity period............................................. 381
28
6. AJAX 384
6.1 Overview ..................................................................................................................................384
6.2 Automatic and immediate AJAX ............................................................................................384
6.2.1 Overview....................................................................................................................................... 384
6.2.2 Processes that can use AJAX automatically .................................................................................... 384
6.2.3 Elements and characteristics that can be automatically used by AJAX............................................. 385
6.2.4 Specific features........................................................................................................................... 386
6.3 Programmed AJAX ................................................................................................................. 387
6.3.1 Overview....................................................................................................................................... 387
6.3.2 Functions for AJAX management.................................................................................................... 387
6.3.3 Procedures that can be called by AJAX........................................................................................... 387
6.3.4 WLanguage functions useless in AJAX............................................................................................ 388
9. JSON 395
9.1 Overview ..................................................................................................................................395
9.2 Getting information in JSON format .......................................................................................395
9.2.1 Operating mode............................................................................................................................ 395
9.2.2 Example for using JSONExecute..................................................................................................... 395
9.2.3 Example for using JSONExecuteExternal......................................................................................... 396
9.3 Creating pages that return JSON data ...................................................................................396
9.3.1 Case of a page called by the JSONExecute function........................................................................ 396
9.3.2 Case of a page called by the JSONExecuteExternal function............................................................ 396
Tome1_2.book Page 29 Vendredi, 28. mai 2010 5:50 17
29
PART 7 - COMMUNICATION
1. COMMUNICATION 399
1.1 Communication with WinDev/WebDev ...................................................................................399
1.2 Communication with WinDev Mobile ......................................................................................400
30
4. GOOGLE 418
4.1 Managing the Google contacts ................................................................................................418
4.1.1 Overview....................................................................................................................................... 418
4.1.2 How do I manage the Google contacts? ......................................................................................... 418
4.1.3 How do I retrieve a Google contact?............................................................................................... 418
4.1.4 How do I modify or delete the Google contacts? ............................................................................. 418
4.1.5 Functions for managing the Google contacts.................................................................................. 419
4.2 Managing Google calendars ...................................................................................................419
4.2.1 Overview....................................................................................................................................... 419
4.2.2 How do I manage a Google calendar?............................................................................................ 419
4.2.3 How do I retrieve a Google calendar and its elements?................................................................... 420
4.2.4 How do I add, modify or delete events in a Google calendar? ......................................................... 420
4.2.5 Functions for managing the Google calendars................................................................................ 421
4.3 Using the service for managing the Google Picasa photo albums .........................................421
4.3.1 Overview....................................................................................................................................... 421
4.3.2 How do I proceed?........................................................................................................................ 422
4.3.3 Functions for managing the Picasa albums .................................................................................... 423
Programming
31
6. SALESFORCE 435
6.1 Using the Salesforce service ....................................................................................................435
6.1.1 Overview....................................................................................................................................... 435
6.1.2 How do I proceed? ........................................................................................................................ 435
6.2 Salesforce functions ................................................................................................................435
Programming
32
33
34
35
36
37
38
39
40
41
PART 9 - APPENDICES
42
mat ................................................................................................................................................605
5.9 Limits for xBase files ...............................................................................................................605
5.10 Limits regarding the libraries .................................................................................................606
5.11 Limits regarding the executables ...........................................................................................606
5.12 Limits regarding the setup program * ...................................................................................606
INDEX 613
Programming
Tome1_2.book Page 43 Vendredi, 28. mai 2010 5:50 17
PART 1
Overview of
WinDev, WebDev,
WinDev Mobile
Tome1_2.book Page 44 Vendredi, 28. mai 2010 5:50 17
Tome1_2.book Page 45 Vendredi, 28. mai 2010 5:50 17
45
1. SETUP
1.1 Required configuration
1.1.1 Configuration required for installing Win- sites)
Dev • Windows NT 4 or later or Linux
46
When installing WebDev, the following servers are auto- FrontPage FrontPage Personal Web Server
matically configured for WebDev: Microsoft server supplied with Front-
Page
Web server Detail
Apache Version 1.3.X. and 2.0.X
Omnihttpd 1.0 Omnicron server, supplied at no extra Free Web server supplied by the Apache
cost with WebDev. Group
Part 1: Overview of WinDev, WebDev and WinDev Mobile
47
2. THE PRODUCTS
2.1 Overview
2.1.1 WinDev applications.
The product addresses all the needs of a professional
48
Here are the main characteristics of WLanguage: guage, but not required.
•intuitive and fast to learn. •transparent event management.
•close to your usual language (C, Basic or Pascal). •procedure management.
•English syntax (French available). •support for dialog with other programs via DDE or
•support for encapsulating processes associated with OLE Automation.
windows (or pages). •calls to Windows API functions.
•"object oriented" programming available in WLan- •availability of a debugger to trace programs.
Part 1: Overview of WinDev, WebDev and WinDev Mobile
WinDev and WinDev Mobile are stand-alone programs. 2. using the usual programming language (C++,
They let you create and distribute applications and data- Cobol, Pascal, …) only: the windows and files are
bases without needing any additional modules. managed using the usual programming language via
WinDev and WinDev Mobile can be used from a 3GL: the WinDev interface, the program is compiled using
•Java the language’s compiler.
3. by mixing WLanguage and the usual program-
•C, C++, VB for Windows ming language: some processes are described in
•Turbo Pascal Windows derivatives WLanguage, others are managed in the usual pro-
•Fortran for Windows gramming language via the WinDev interface. The
•Cobol for Windows program is compiled by the language’s compiler.
•FoxPro for Windows 4. you can create a DLL from a 3GL and use it from
WLanguage.
•and other Windows languages (contact us)
If you do not have specific constraints we recommend
An application can be developed depending on the deve- that you develop using only the WLanguage. You will
loper’s choice or on the application constraints: develop faster and the maintenance of your application
1. in WLanguage only: object processing is totally will be easier.
described in the code editor and the executable pro-
gram is created by WinDev.
WinDev and WinDev Mobile enable you to create applica- If no specific lock is described in the program, the lock
tions that work on a network or on a single computer. management is done automatically.
The WLanguage functions manage the concurrent file WinDev and WinDev Mobile also enable you to develop
accesses. Depending on the developer choice, they can Client/Server applications.
block files or records in "read-only" or in "read/write"
mode.
Tome1_2.book Page 49 Vendredi, 28. mai 2010 5:50 17
49
50
Part 1: Overview of WinDev, WebDev and WinDev Mobile
Tome1_2.book Page 51 Vendredi, 28. mai 2010 5:50 17
PART 2
Creating an
application, a site
Tome1_2.book Page 52 Vendredi, 28. mai 2010 5:50 17
Tome1_2.book Page 53 Vendredi, 28. mai 2010 5:50 17
53
54
55
56
WebDev15.exe
.. WinDev 15 .. WinDev 15".
•2nd method: In the task bar, select "Start .. Run", •3rd method: Directly click the WebDev 15 shortcut
then enter the full access path of the WinDev15.EXE on the Windows desktop.
file (possibly followed by the name of the element to Each time WebDev is started (regardless of the method
open). used), a new instance of WebDev is opened.
For instance, the following line opens the "C:\My
Project\My window.WDW" window: 1.5.3 Running WinDev Mobile
C:\WINDEV15\Programs\WinDev15.exe There are several ways of starting WinDev Mobile:
"C:\My project\My window.WDW"
•1st method: In the task bar, select "Start .. Programs
Note: After WinDev has been launched once, the fol- .. WinDev Mobile 15 .. WinDev Mobile 15".
lowing line is enough to start WinDev: •2nd method: In the task bar, select "Start .. Run",
WinDev15.exe then enter the full access path of the
WD15Mobile.EXE file (possibly followed by the name
•3rd method: Directly click the WinDev 15 shortcut on of the element to open).
the Windows desktop. For instance, the following line opens the "C:\My
Each time WinDev is started (regardless of the method Project\My window.WPW" window:
used), a new instance of WinDev is opened. C:\WINDEVMOBILE15\Programs\’
WD15Mobile.exe "C:\My project\My win-
1.5.2 Running WebDev dow.WPW"
There are several ways of starting WebDev: Note: After the first time you run WinDev Mobile, the fol-
•1st method: In the task bar, select "Start .. lowing line lets you start WinDev Mobile:
Programs .. WebDev 15 .. WebDev 15". WD15Mobile.exe
•2nd method: In the task bar, select "Start .. Run",
then enter the full access path of the WebDev15.EXE •3rd method: Directly click the WinDev Mobile 15
file (possibly followed by the name of the element to shortcut on the Windows desktop.
open). Each time WinDev Mobile is started (regardless of the
For instance, the following line opens the "C:\My method used), a new instance of WinDev Mobile is ope-
Project\My page.WWH" page: ned.
C:\WebDev15\Programs\WebDev15.exe
"C:\My project\My page.WWH"
Tome1_2.book Page 57 Vendredi, 28. mai 2010 5:50 17
57
58
2. THE PROJECT
2.1 Overview
The first step in creating a new application consists in racteristics specified when creating the project can be
creating a project. modified later.
When declaring a project, you are asked several ques-
tions in order to build the project you want. All the cha-
one.
To create a project: 14. Validate the wizard. The created project beco-
1. Select "File .. New .. Project". The wizard for pro- mes the current project.
ject creation starts. Notes:
2. Specify the different options of the project:
- the name and location. These options cannot be • If you have requested the creation of a database, the
modified. The project corresponds to a ".WDP" corresponding wizard automatically starts.
file. This file can be opened by WebDev and Win- • If you have requested the use of the source code data-
Dev Mobile. All the objects associated with the base, the wizard for adding a project to the source
project will be created in the specified directory. database automatically starts.
- the description by summarizing the project’s • The information provided can be modified in the pro-
goal. This description is used in the project docu- ject description ("Project .. Project description").
mentation.
3. Specify the documents attached to the project. 2.2.2 Creating a WinDev Mobile project
4. Choose the type of generation for the project, To create a project:
that is what type of application will be generated by 1. Select "File .. New .. Project". The wizard for pro-
the project. ject creation starts.
5. Specify the project’s platform. 2. Specify the different options of the project:
6. To optimize the choices offered by the environ- - the name and location. These options cannot be
ment, specify: modified. The project corresponds to a ".WPP"
- the number of planned computers, file. This file can be opened by WebDev and Win-
- the number of planned sites, Dev. All the objects associated with the project
- the number of planned users, will be created in the specified directory.
- the requested level of speed/security. - the description by summarizing the project’s
7. Specify the dates of your project. goal. This description is used in the project docu-
8. Specify whether the project will be used by seve- mentation.
ral developers. You can use the developer groupware 3. Specify the documents attached to the project.
or the source code manager (SCM) to share the pro- 4. Choose the type of generation for the project,
ject. that is what type of application will be generated by
9. Select the programming charter. The program- the project.
ming charter lets you automatically add a prefix to 5. Specify the runtime platform of your application.
variables, control names, window names, … The "Advanced" button enables you to enter (or
10. Select the style book. detect) the characteristics of the runtime platform.
11. Select the default size of the user screens. These characteristics can be modified and they will
12. Specify the supported languages. These lan- be automatically taken into account when creating a
Tome1_2.book Page 59 Vendredi, 28. mai 2010 5:50 17
59
new window. - static site: the site will only contain static pages.
6. To optimize the choices offered by the environ- The data displayed in these pages will be fixed
ment, specify: once for all.
- the number of planned computers, This type of site requires no deployment engine
- the number of planned sites, when it is installed at the host.
- the number of planned users, - dynamic WEBDEV site: the site can contain static
- the requested level of speed/security. pages, dynamic pages or semi-dynamic pages.
7. Specify the dates of your project. The data displayed in the pages changes accor-
8. Specify whether the project will be used by seve- ding to the request performed by the Web user.
ral developers. You can use the developer groupware This type of site enables you to work with a data-
or the source code manager (SCM) to share the pro- base (enter and view orders for instance).
ject. This type of site requires a deployment engine
9. Select the programming charter. The program- when it is installed at the host.
ming charter lets you automatically add a prefix to - semi-dynamic site: the site only contain static
variables, control names, window names, … pages or semi-dynamic pages. The data dis-
10. Select the style book. played in these pages will be fixed once for all.
11. Specify the supported languages. These lan- This type of site requires no deployment engine
guages will be proposed by default as soon as an when it is installed at the host.
option found in a control, a window, a report, ... can - dynamic PHP site: the site will contain PHP pages
be translated. Also select the default runtime lan- or static pages. The data displayed in the PHP
guage. This language will be used to view the project pages may come from a MySQL database. This
at run time. type of site requires a PHP engine in order to be
12. Specify whether the project is associated with run.
60
61
•the directory of each language supported by the 2.4.3 The elements of the project
project (WebDev only): US, FR, … The project is made of windows/pages, reports, queries,
A directory is created for each language supported by sets of procedures, …
the project. This directory contains the HTM pages
corresponding to the directory language. To get the project element list, select "Project .. List of
project elements".
•the compiled code directory: <Project Name>.CPL.
This directory contains the compilation files of the This option enables you to:
various project elements (".WB*" and ".WC*" •add to your project elements belonging to projects
files). When sharing the project development, a that are accessible from your computer. The corres-
directory of compiled files is created for each develo- ponding files will not be moved in your project’s
per. directory.
•the backup directory of the project’s elements: Bac- •delete elements from your project. The correspon-
kup ding files are not physically deleted.
This directory contains all the backup files of the pro- To quickly find an element in your project, press "CTRL +
ject’s elements (".BK*" and ".TK*" files). E" from any editor.
•the directory of the project’s tasks: Tasks
This directory contains the files of the tasks to per- 2.4.4 The project task list
form on the project. Each project can be associated with a task list. This list is
•the developer groupware directory: Groupware used to inform the developers about the modifications
This optional directory contains the elements that that must be made to the project.
were checked out from the project. The status of These modifications can affect:
these elements corresponds to their status before •a process in the code of the entire project,
62
Note: the display of tasks in the "Task list" pane is not on).
synchronized with the code. For example, if the "// To To view the summary table, select "Project .. Time mana-
do: Manage bar code" comment line is deleted, the cor- gement .. Time passed on the project elements".
responding task in the "Task list" pane is not deleted To enable/disable this time management, select/dese-
automatically. lect the "Enable the tracking of time spent on project ele-
ments" option in the "Project" tab of the project
2.4.5 Time management description ("Project .. Project description").
The total time spent by each developer is calculated for
each project element (windows/pages, reports, and so
63
64
•UML package: divides and organizes the diagram’s •UML package: divides and organizes the diagram’s
representation (the same way a directory organizes representation (the same way directories organize
files). Each package can contain classes and rela- files). Each package can contain actors and use
tionships. cases.
Via the generation of a class diagram, WinDev enables
you to create the structure of the WinDev/WebDev clas- 3.2.3 Object diagram
ses used in your application. An object diagram represents a set of objects and their
relationships at a given time.
3.2.2 Use case diagram
An object diagram is used to show a context (before or
A use case diagram is used to view the behavior of a sys- after an interaction between objects for instance).
tem in such way that:
An object diagram contains the following elements:
•the user can understand how to use each element.
•object: represents the instance of a class.
•the developer can implement these elements. Note: If a class diagram is open, you can create an
A use case diagram contains the following elements: object from a class found in this diagram (drag and
•Actor: represents the role of the application’s users. drop from the "UML Analysis" pane).
For example, a person who works in a bank will be the •composite object: visually represents an object
loan manager. If this person has an account in this made of other objects. For instance: a window that
bank, he will also play the role of the Customer. contains scrollbars, buttons, …
•Use case: describes a sequence of actions perfor- •link: presents the relationships among the various
med by the application. For example, Place an order, objects.
Enter an order, Create a new customer form, …
Part 2: Creating an application, a site
65
66
67
4. THE ANALYSIS
4.1 Overview
When a project uses data files, this project must be asso- •2nd method: Create the Conceptual Data Model
ciated with an analysis. An analysis enables you to des- (CDM), then automatically create the analysis from
cribe the structures of the data (files, items, and so on) the CDM.
used in your project. These operations are detailed in "Creating the CDM"
Two methods are available to describe an analysis: on page 77 and "Generating the LDM from the CDM"
•1st method: Create the analysis directly (i.e. the on page 80.
Logical Data Model - LDM). This chapter presents both methods.
This operation is detailed in the "Creating a LDM"
paragraph on page 71.
68
identical and remote databases. See ’Data replica- Solution 2: From Windows explorer
tion’, page 578, for more details about replication. Directly drag the file description from Windows explorer
4. The created file becomes the current file. The file and drop it in the data model editor.
item description window is automatically opened. It
enables you to describe the file’s items. 4.2.3 Creating an item
To import a preset file description: To create an item:
1. Select "Insert .. File". 1. Double-click the file where the item must be crea-
2. Check "Select a description among the preset ted. The file item description window comes up.
files". 2. Click the first empty row in the table of items.
3. Choose the preset file. This file will be imported 3. Specify the name, the caption and the type of the
into the current analysis. This file can be modified item directly in the table.
later. 4. In the right part of the screen, specify the details
4. Select the file items to keep. These items can be about the new item (type, size, default value, sort
modified later. direction, etc.).
5. Specify whether links must be automatically sou- 5. In the bottom part of the screen, specify the
ght. If this option is checked, the items with the same details about the shared information.
name will be linked. 6. Validate the description of the item.
6. The imported file is automatically inserted into Note: you can also create an item using the metatypes
the current analysis. offered by WinDev/WebDev. To do so, click the "+M"
Note" To modify a file or a file’s items, select the file and button to the right of the table. The list of available meta-
enable the following option: "File structure .. Descrip- types comes up.
tion" or "File structure .. Items".
Part 2: Creating an application, a site
69
70
71
To manage a complement link, the key of the Product file Shared link with a 1,N - 0,1 cardinality
is copied into the Details file. To ensure the maximum With this type of link:
cardinality of 1, it remains a unique key. The uniqueness •each owner has at least one member (a supplier has
of this key prevents from inserting more than one record at least one product).
in Details for a record of Product.
•a member may have no owner (a product may have
The owner file is Product, the member file is Details. no supplier).
Shared link
For a shared link, a same record in a file (Supplier) can
be shared by several records in another file (Product).
To manage a shared link, the key of the Supplier file is
copied into the Product file. It becomes a multiple key to Shared link with a 1,N - 1,1 cardinality
increase the speed of integrity check. With this type of link:
The owner file is Supplier, the member file is Product. •each owner has at least one member (each supplier
Depending on the cardinality, we can distinguish has at least one product).
between four types of shared links: •each member has a single owner (each product has
•Shared link with a 0,n - 0,1 cardinality a single supplier).
•Shared link with a 0,n - 1,1 cardinality
•Shared link with a 1,n - 0,1 cardinality
•Shared link with a 1,n - 1,1 cardinality
Shared link with a 0,N - 0,1 cardinality
72
sis are automatically created in the specified direc- keeping the [Ctrl] key down.
tory.
6. The renamed analysis is not automatically asso- 4.4.6 Moving the display of the LDM
ciated with the current project. To move the display of a LDM:
7. In the Windows explorer, delete (if necessary) the
1. Open the LDM in the data model editor.
directory of the source analysis.
2. Press the [Alt] key.
4.4.4 Associating a LDM with a project 3. Modify the position of the LDM while keeping both
the left mouse button and the [Alt] key down.
To associate a LDM with an existing project:
73
74
rent CDM in the project. 1. Open the CDM in the data model editor.
2. Press the [Alt] key.
4.8.3 Modifying the display of a CDM 3. Modify the position of the CDM while keeping both
the left mouse button and the [Alt] key down.
A zoom factor can be specified to reduce or enlarge the
display of the current CDM.
75
4. The association is automatically deleted from the 1. Select the association to rename.
CDM. If relationships were pointing to this associa- 2. Select "Association .. General Information". The
tion, these relationships are also deleted. description of the association is displayed.
3. Modify the name of the association and validate
4.10.3 Renaming an association the association description. The association is auto-
To rename an association: matically renamed.
76
Notes: tions" in the options for generating the LDM from the
- The deletion of entities, relationships or associations CDM. In this case, the files of the LDM contain only
is not taken into account when generating a CDM into the items of the corresponding entity in the CDM after
a LDM. the conversion.
- The deletion of an entity’s properties can be taken
into account by clearing "Keep the LDM modifica-
77
5. QUERIES
A query lets you select the type of data to extract. This See the "Report and query editor guide" for more
selection is performed according to a specified descrip- details.
tion (criteria, restrictions, etc.).
The extracted data can be viewed in a window, a
report, …
78
A window’s purpose is to display, present or enter infor- - Create a window from the analysis description (with
mation. This information can come from data files in an its code or not).
analysis, from external files, from queries, ... - Create standard windows.
WinDev offers several solutions to create a project’s win- - Create windows based on a template, …
dows: Regardless of the method used, the window can be modi-
- Create a blank window with the wizard. fied after its creation: you can add, modify or delete con-
- Build all the application’s windows from the analysis trols and modify the window’s characteristics.
description.
See ’Controls’, page 251, for more details about handling
a window’s controls.
6.1 Overview
6.1.1 Window skin template 6.1.2 Languages supported in a window
To standardize the overall look of your project, WinDev A window can manage up to 20 languages. The langua-
offers several preset interfaces. ges supported in a window are the ones selected in the
Part 2: Creating an application, a site
These preset interfaces correspond to the skin templates window description ("Language" tab).
of the project. The captions, notes, messages, ... can be entered in the
By applying a skin template to your project, all the win- selected languages.
dows and reports of your project will have the same look. In the editor, the default language is the one specified in
the window description or in "Display .. Language dis-
To apply and/or modify the skin template applied to a played".
window, use "Windows .. Applying a skin template".
When running the project, the language applied is the
Note: you can create your own skin templates. See the one selected in the project’s description ("Project .. Pro-
online help for more details. ject description").
See ’Multilingual applications and sites’, page 325, for
more details.
79
80
81
82
in the window editor. This window corresponds to the 6.4.4 Opening files after a system lockup
selected version. The name of this new window has To avoid problems when a system lock occurs (power
the following format: <Window Name><Date and outage for instance), WinDev can automatically restore
Time of Version Backup>. the open windows in the editors ("Tools .. Options of
Tip: This new window can replace the original window. To WinDev .. General .. Backup for automatic restore").
do so, close the original window and save the new win-
dow under the same name as the original window. Cau- When this system is enabled:
tion: All the versions of the source query will be lost. •an automatic backup of the open windows is regu-
larly performed at specific time intervals (every 10
6.4.3 Deleting a version minutes by default).
Deleting the useless versions reduces the size of the •when re-opening a window after a system lockup, a
".WDW" file corresponding to the window. restore window is displayed. This window offers to
retrieve:
To delete a version of the current window: - the window as it at was during the last backup per-
1. Select "File .. Versions". The screen displaying formed by the developer.
the window’s versions comes up. - the window automatically saved by WinDev.
2. Select the version to delete.
3. Click the "Delete" button. The selected version is The selected version is automatically opened in the
automatically deleted from the version management window editor. The unselected version is available in
window. This deletion will be effective the next time the version management window ("File .. Versions")
the window is saved. and it can be opened at any time.
Part 2: Creating an application, a site
Tome1_2.book Page 83 Vendredi, 28. mai 2010 5:50 17
83
To define the interface of a WebDev site, you need to and framesets of a project:
define pages and framesets: - by creating blank pages and framesets with the
• pages enable you to display a coherent set of informa- wizard.
tion (images, texts, animations, etc.) and objects - by creating preset pages and framesets with the
(buttons, links, etc.) allowing users to use your site. wizard.
• framesets let you display simultaneously several - by creating all the pages and framesets of the site
pages in a single browser window. from the description of the analysis.
Each frameset is made of frames to which you can Regardless of the method used, the pages and framesets
attached site pages. can be modified after they’ve been created: you will be
Framesets define your site’s style. able to add, modify, or delete controls, modify the cha-
WebDev offers several solutions for creating the pages racteristics of the page and frameset.
7.1 Overview
7.1.1 Page types the data.
WebDev lets you create several types of pages: In the project editor, static pages are displayed on a dark
84
Static WebDev site: the Dynamic WebDev site: the selected languages.
WebDev engine is not WebDev engine is requi- In the editor, the default language is the one specified in
required. red. the page description or in "Display .. Language dis-
played".
Note: WebDev also lets you create dynamic PHP sites. When running the project, the language applied is the
This makes it easy to build a small site, hosted for free at one selected in the project’s description ("Project .. Pro-
a large Internet provider. ject description").
See ’Applications and multilingual sites’, page 325, for
more details about multilingual sites.
85
7.2.2 Creating preset pages requested information in the different screens of the
To create a preset page: wizard (these screens depend on the selected type
1. Select "File .. New .. Page". of page).
2. Choose the type of page to create. This page can 4. Validate the creation of the page.
be:
7.2.3 Creating the project pages by automatic
•R.A.D. Dynamic: This page will allow records from site building (R.A.D.)
one or more files to be viewed and/or modified.
For dynamic sites, the project’s pages can be created
•R.A.D. Semi-dynamic: This page will allow records automatically in one operation from the analysis descrip-
from one or more files to be viewed. tion, by automatically building the site (RAD).
•R.I.D.: This page will allow records from one or See the online help for more details about pages created
more files to be viewed and/or modified. Only the through RAD.
interface of the page is generated. The code
needs to be written by the developer. To create the dynamic site through RAD.:
•Blank/Template: Lets you create a blank page 1. Select "Workshop .. Full Application RAD".
using the selected page template. Caution: To use this option, the project must be
•Internal page: Lets you create internal pages that associated with an analysis that has been genera-
will be used in "Internal page" type controls. Inter- ted at least once.
nal pages enable you to included a page (and its 2. Select the RAD pattern to use.
code) into another page’s control. 3. Select the files used for the generation.
4. Select the main files that will be the entry points
•Frameset: lets you create different types of frame-
into the application (mainly, these files will be used
sets. Each frame will need to be associated with
to set up the menu options).
86
7.3.4 Modifying the tab order The tab order only applies to controls managed by the
The tab order of page controls is the order in which the [Tab] key. You can define whether a control is managed
controls take focus when the user presses the [Tab] key. by the [Tab] key in the "Details" tab of the description
By default, the tab order corresponds to the order in window of each control.
which the controls have been created. The [F5] key (or "Page .. Tab order .. Edit") lets you see
the tab order of all the controls found in a page.
To modify the tab order, select "Page .. Tab order .. Edit"
and use the arrows on the right.
87
The selected version is automatically opened in the version management window ("File .. Versions") and
page editor. The unselected version is available in the it can be opened at any time.
88
4. Validate. The selected file and all the objects lin- sor turns into a double arrow, keep the left mouse
ked to the frameset (image file, etc.) are imported button down while resizing the frame.
automatically in the directory of the current project 3. Release the left mouse button. The resize opera-
and added to the list of project components. tion is performed.
To export the current frameset:
1. Select "File .. Export ... To a directory". 7.6.6 Adding a frame
2. Select the directory where the data files must be To add a frame:
exported to. A checkmark is displayed in front of the 1. Click inside a frame.
file corresponding to the current frameset. 2. Select "Frame .. Vertical split" or "Frame .. Hori-
Note: This list is made of the file name, file descrip- zontal split".
tion (if there’s one), the actual location of the file. The selected frame is divided. You have the ability to
3. Validate. The frameset file and all the objects lin- resize the two new frames.
ked to the page (image file, etc.) will be copied auto-
matically into the specified project directory. 7.6.7 Deleting a frame
To delete a frame:
7.6.5 Modifying the dimensions of a frame 1. Click inside the frame to delete.
To modify the dimensions of a frame: 2. Select "Frame .. Delete the frame".
1. Click inside the frame that must be modified. The The remaining frames are automatically resized to
sides of the selected frame turn red. occupy the available space.
2. Hover the border to resize. When the mouse cur-
Part 2: Creating an application, a site
Tome1_2.book Page 89 Vendredi, 28. mai 2010 5:50 17
89
8. THE REPORTS
Reports allow you to extract data from a file based on one This chapter only presents the report types and how to
or more criteria and to present this data in the format you create a report.
want. See the "Report and query editor Guide" for more
Some examples of reports: an invoice, labels for a details about reports.
mailing, a list of customers, …
90
9. REFERENCE A SITE WB
91
92
10.2 Running the test of a project and debugging it on the development com-
puter WD
10.2.1 Overview 10.2.2 Running the test of the current project
Running the test of the entire WinDev project is used to and debugging it
simulate the start of the application by the executable. To test a project from the editor, select "Project .. test
This enables you to run the test of the entire application, mode .. debug the project" ([Ctrl] + [9] key combina-
even if its development is not finished yet. As soon as a tion). The editor is automatically minimized and the pro-
problem occurs in the execution of the project, the ject is run.
debugger can be started to identify and fix the problem. When running the test of the project, the following pro-
WinDev offers a complete set of application tests that cesses are run before the first project window is opened:
can be run from the development computer: • declaration of classes,
• Running the test of the current project and debugging it • initialization of the project,
in the editor. • declaration of the global variables of the first window,
• Running and debugging the executable corresponding • initialization of the first window,
to the current project.
• initialization of the controls found in the first window,
• Debugging an executable that is already running on the
development computer. • taking focus (first window),
Note: The project test can be run regardless of the current • entering the first control of the first window (if this con-
trol has an entry process).
element in the editor.
Tome1_2.book Page 93 Vendredi, 28. mai 2010 5:50 17
93
To configure the test mode, select "Project .. Test Mode .. To debug an executable that is already started:
Configure the test mode". Different parameters are used 1. Open the project associated with the executable
to: in the editor.
• Run the test of a project by specifying a command line, 2. A breakpoint can be included in the code that trig-
• Run the test of a project by specifying a runtime direc- gers the debugger.
tory, 3. Select "Project .. Test mode .. Debug the executa-
ble that is already running".
• Run the test of a project with a manifest (in Windows 4. The window that opens lists all the WinDev execu-
Vista only) tables currently running. Select the executable to
• Run the test of a project by using the rights granted to debug.
another user. This setting is used to check the opera- 5. Validate. The debugger is linked to the executable
ting mode of the application by simulating the UAC run.
mechanism in Windows Vista.
10.2.5 Starting the debugger and stopping the
10.2.3 Running and debugging the executable test
on the development computer Several methods can be used to start the debugger while
Some problems can only be reproduced when running running the test of the project :
the test of the executable in real-use conditions. This test • Pressing [Ctrl] + [Pause]. The action performed once
mode enables you to debug an executable once it is ins- the [Ctrl] + [Pause] key have been pressed (click on a
talled on the development computer. button, …) will start the debugger. This method can be
In this case, the code run comes from the libraries (and used before performing a click on a button for ins-
not from the code found in the elements found on the tance.
94
Directory of the files used for test of the application for all the users on the same
To configure the data files used when running the test of computer. In Windows XP/Vista, this directory
the application in the editor: uses the format: "C:\Documents and Set-
1. Display the project description ("Project .. Project tings\All Users\Application Data\<Company
description"). Name>\<Application Name>
2. In the "File" tab, select the location of the test - <DirUserGlobal>: Standard data directory
files: shared by several applications for a specific
•EXE directry of the project or current directory: the user. In Windows XP/Vista, this directory uses
data files are located in the EXE subdirectory of the the format: "C:\Documents and Set-
project. tings\<User>\Application Data
•Specified directory: the data files will be located in - <DirCommonGlobal>: standard data direc-
the specified directory. tory shared by several applications for all the
•Directory of the application data (recommended users of the same computer. In Windows XP/
for Windows XP and Vista): this directory is diffe- Vista, this directory uses the format:
rent if the data is common to all the users or if the "C:\Documents and Settings\ All
data is specific to each user. Users\Application Data
Note: if your application uses user groupware, you can •in a directory selected through the picker ([…]
also configure the location of the data files for the user option).
groupware. This setting is performed via "Workshop .. Vista manifest
Configure the user groupware .. "Files" tab. See ’User If Windows Vista is your operating system, WinDev gives
groupware’, page 113, for more details. you the ability to run the test of your application by using
Part 2: Creating an application, a site
95
Caution: Right management only applies to drives using 2. In the "Other user account" tab, specify the cha-
the NTFS file system. For the FAT32 file systems, the racteristics of the user: Name, password, domain.
management of rights is not taken into account. 3. The next test of the application will be run with this
To run the tests by using another user account: user.
1. Create (if necessary) one or more users on your Note: you cannot use a Administrator manifest with a
computer. New users can be created in the Windows local user that belongs to the administrator group.
control panel ("User accounts" option).
10.3 Running the test of a WinDev project and debugging it on the user com-
puter WD
WinDev offers several methods for testing a project and To debug a WinDev application on a remote computer,
debugging it on the development computer. However, in WDDebug must be configured by the end user:
some cases, you may have to debug on the end-user • "Allow to remotely debug the applications currently
computer (connected by network or by Internet). running" must be checked in order to be able to debug
From your office in London, you have the ability to debug an application currently running. The list of WinDev
an application running in Taiwan. The debug operation is applications currently running is displayed. The appli-
performed without having to go anywhere, directly on the cation to debug must be selected from this list.
configuration of the user. • "Allow to remotely start and debug an application"
Two features are available: gives you the ability to remotely start and debug the
• Running and debugging the executable on a remote specified application. In this case, the full name of the
96
10.4.1 Testing the project from the editor The test cannot be run if the Web server is not star-
Running the test from the editor allows you to test: ted.
•the features of the site, •WebDev administrator (WD150ADMIN.EXE).
The administrator enables you to manage the con-
•the use of the site under different browsers. nections to the Web server and to configure the Web-
The test of a project can be run regardless of the current Dev sites.
element in the editor. Note: a project test can be started from the adminis-
Different types of test trator test page ("Sites" tab of WD150ADMIN, "Test
page" button).
To test a static site from the editor, select "Project .. Test
•the WebDev engine (WD150AWP.EXE).
Part 2: Creating an application, a site
Mode .. Test project from the home page" (or ). The WebDev engine is used to manage the requests
The editor is automatically minimized and the browser made by the Web users from their browser and to
specified in the WebDev options comes up ("Tools .. return the corresponding dynamic HTML page.
WebDev options .. Web") and the home page is dis- Note: the WebDev engine is started only if the project
played. contains dynamic pages.
You can also connect to a site to debug the connection, •The Internet browser.
or to debug the current connection to a site. The Internet browser is used to display the HTML
pages of the WebDev site.
To test a dynamic site from the editor, select "Project ..
Test mode .. Test Project" (or , or [Ctrl] + [F9]). 10.4.2 Processes run
The editor is automatically minimized and the browser Here are the processes executed when stating a project’s
specified in the WebDev options comes up ("Tools .. test:
WebDev options .. Web") and the first page of the site is • Test of a static site or of the static section of a static +
displayed. dynamic site: the following processes are run:
To test a static + dynamic site from the editor: •load the first page (browser code)
•to test the static part of the site: performs the ope- •enter the first control of the first page if this control
rations corresponding to the test of a static site. has an entry process (browser code)
•to test the dynamic part of the site: perform the • Test of a dynamic site or of the dynamic section of a
operations corresponding to the test of a dynamic static + dynamic site: the following processes are run:
site. •declaring the classes
Note: To test a site with a specific browser, select "Pro- •initializing the project
ject .. Test browser" and select the browser you want. The
default browser is defined in the options of WebDev •declaring the global variables of the first page (ser-
("Tools .. WebDev Options ", "Web" tab). ver code)
•initializing the controls found in the first page (ser-
Dynamic site: Starting ver code)
The following modules are automatically started when •loading the first page (browser code)
testing a dynamic WebDev site: •entering the first control of the first page if this con-
•The Web server installed on the computer and confi- trol has an entry process (browser code)
gured for WebDev when WebDev was installed.
Tome1_2.book Page 97 Vendredi, 28. mai 2010 5:50 17
97
10.4.3 Directory of the data files used for test WD150Admin - WebDev administrator").
To configure the data files used when running the test of 2. Click the "Test" button ("Connection" tab).
the site in the editor:
1. Display the project description ("Project .. Project 10.4.6 Differences between running the test of
description"). a site from the editor and from the test page of
2. In the "File" tab, select the location of the test the administrator
files: Several differences can be noticed between these two
•Current directory: the data files will be located in test methods:
the EXE subdirectory of the project. • Rights granted on the server:
•Specified directory: the data files will be located in •When the test is run from the editor, the rights of the
the specified directory. WebDev site correspond to the rights of the user who
runs the test of the site.
10.4.4 Stopping the test •When the test is run from the test page, the rights
To stop the test, several methods are available: used correspond to the rights of the user configured
-1st method: on the Web server. These rights may be more restric-
Close the site whose test is in progress. WebDev dis- tive: some actions may not be allowed (deleting files
plays the editor that was currently used at the begin- from the server for instance).
ning of the test. • Managing the programming errors:
-2nd method: •During the test from the editor, the programming
- Use the task bar or use [Alt] + [Tab] to return to errors are displayed in a dialog box and the debugger
the editor. is automatically started.
- Confirm the stopping of the test. WebDev displays
98
•A Web server (the Omnihttpd server is provided with -2nd method: (recommended)
WebDev "Development version"), Connect to the site by entering the following Internet
•The TCP/IP protocol. address:
To run the test of the project from a test server, several http://<Test server IP address>/WD150AWP/
methods are available: WD150AWP.EXE/CONNECT/<Project Name>
-1st method:
Start the WebDev administrator ("Tools ..
10.4.8 Stress test / Regression test
WD150Admin - WebDev administrator") and click The WDTestSite tool lets you perform stress tests:
the "Test page" button ("Configuration" tab). WDTestSite lets you start several simultaneous connec-
tions to a dynamic WebDev site.
Each connection perform a set of actions in the WebDev
site (preset scenario).
For more details about WBTestSite, see the online help.
WebDev offers several methods for testing and debug- 3. Select "Project .. Test mode .. Connect to a site
ging a site on the development computer. However, in and debug the connection".
some cases, you may have to debug the site directly on 4. In the window that opens, enter:
the end-user computer. •the name or IP address of the remote WebDev
From your office in London, you have the ability to debug application server
Part 2: Creating an application, a site
a site running on a Web server in Taiwan. Debugging is •the main debugging port
done without having to go anywhere, on the final configu- 5. Click the "Refresh" button. The names of the sites
ration directly. that can be debugged are displayed.
Two features are available: 6. Select the requested site and validate.
• Starting and debugging the site on a remote applica- 7. The site is started in debug mode on the develop-
tion server. ment computer. You can handle the site and monitor
• Debugging a site currently running on a remote appli- the code run via the debugger (by inserting break-
cation server. points in the sections of code that cause problems
for instance).
For these two features, a specific configuration of the
remote computer is required. 10.5.3 Debugging a site currently used on a
remote application server
10.5.1 Configuring the remote WebDev appli-
cation server To debug a site already started on a remote application
server:
To debug a dynamic WebDev site on a remote application 1. Open the relevant project in WebDev.
server, you must: 2. Check the configuration of the remote server.
• open the main port and the session ports if a firewall is 3. Select "Project .. Test mode .. Debug an existing
used. The main port is port 27270 by default and the connection".
ports of sessions are ports 27280 to 27289 by default. 4. In the window that opens, enter:
Indeed, the communication with the remote WebDev •the name or IP address of the remote WebDev
application server is done via sockets. application server
The ports used can be modified in the WebDev applica-
tion server ("Configuration" tab of the administrator). •the main debugging port
5. Click the "Refresh" button. The names of the sites
• authorize remote debugging on the WebDev applica- that can be debugged are displayed, with the identi-
tion server. To do so, check "Allow remote debugging" fier of the connected client.
in the "Configuration" tab of the administrator. 6. Select the requested site and connection and
validate.
10.5.2 Starting and debugging a site on a 7. The project is in debug mode.
remote application server
To run and debug a site on a remote application server:
1. Open the relevant project in WebDev.
2. Check the configuration of the remote server.
Tome1_2.book Page 99 Vendredi, 28. mai 2010 5:50 17
99
Two types of project test are available on Pocket PC: 10.6.3 Testing a project directly on the Pocket
•Test on the development computer: this test per- PC connected to the current computer
forms a simulation of the Pocket PC on the develop- To test a project directly on the Pocket PC, select "Project
ment computer. During this test, no connection to a .. Test mode .. Run the project test (pocket)" ([Ctrl] +
Pocket PC is required. This test allows the use of the [F9]). The editor is automatically minimized and the pro-
debugger. However, this test being run on a PC and ject is run.
not on a Pocket PC, the application may behave diffe- If the project’s executable program has not been created,
rently in some ways. See the online help for more the executable program creation wizard is started auto-
details about these differences. matically. During the following tests, the options speci-
•Test and debug on the Pocket PC connected to the fied in the executable creation wizard are automatically
development computer. This test allows the use of applied.
the debugger while being directly run on the Pocket
PC. 10.6.4 Command line
•Test directly on the Pocket PC currently connected to To run the test a project using a command line, this com-
the PC. In this case, the executable corresponding to mand line must be specified via "Project .. Test Mode ..
the project is created and copied directly to the Poc- Configuring the test mode ([Ctrl] + [Shift] + [F9]).
ket PC. The debugger is not available. The different elements of the command line will be
passed in parameter to the current program.
10.6.1 Testing a project in simulator mode (on
the development computer) Reminder: these parameters can be known by program-
100
10.7.1 Testing the window from the editor 10.7.2 Stopping the test of a window
To test a window from the editor: Several methods can be used to stop the test:
1. Open the window to test. -1st method:
2. Select "Code .. Test the window" ( , or [F9]). Close the application whose test is currently running.
The editor is automatically minimized and the win- WinDev displays the editor that was used when the
dow is run. test was started.
When running the test of a window, the following pro- -2nd method :
cesses are run: - Go back to the editor with the taskbar or with
[Alt]+[Tab].
•Declaration of classes
- Confirm the stopping of the test. WinDev displays
Part 2: Creating an application, a site
•initialization of the project the editor that was used when the test was started.
•declaration of the global variables of the current
window 10.7.3 Managing the passwords (analysis or
•initialization of the controls found in the current file)
window No password is requested when running the test of the
•initialization of the current window window, regardless of whether the window is associated
•the current window takes focus with a password-protected analysis or with a password-
protected file.
•entry in the first control of the current window (if
this control has an entry process) The necessary passwords must be specified by program-
ming in the initialization code of the project:
When the test is run, all the features of the window can be
run. You will have the ability to open other windows for • If the window uses a file from a password-protected
instance. analysis, this password must be specified in HOpenA-
nalysis.
Note: to test a window that expects one or more parame- • If the window uses one or more password-protected
ters, a default value must be given to the parameters in files, this password must be specified in HPass.
their declaration. A WLanguage error occurs when running the window test
if the passwords are not specified in the initialization
code of the project.
10.8.1 Testing the page from the editor •Loading the current page (Browser code)
To test a page from the editor: •entering the first control of the first page, if this
1. Open the page to test. control has an entry process (browser code)
2. Select "Code .. Run the page test" ( , or [F9]). • When starting the test of a dynamic or semi-dynamic
The editor is automatically minimized and the page is page, the following processes are run:
run. •Declaring the classes (server code)
Processes run when starting the test of a page: •Initializing the project (server code)
• When starting the test of a static page, the following •Declaring the global variables of the current page
processes are run: (server code)
Tome1_2.book Page 101 Vendredi, 28. mai 2010 5:50 17
101
•Initializing the controls found in the current page the editor that was currently used at the beginning of
(server code) the test.
•Initializing the current page (server code)
•Loading the current page (Browser code)
10.8.3 Managing the passwords (analysis or
file)
•entering the first control of the first page, if this
control has an entry process (browser code) No password is requested when running the test of the
page, regardless of whether the page is associated with a
During the test, all the features of the page will be run. password-protected analysis or with a password-protec-
You will be bale to open other pages for instance. ted file.
Note: to test a page that is expecting one or more para- The necessary passwords must be specified by program-
meters, you need to give a default value to the parame- ming in the initialization code of the project :
ters.
• If the page uses a file from a password protected ana-
10.8.2 Stopping the test of a page lysis, this password must be specified in HOpenAnaly-
sis.
Several methods can be used to stop the test :
-1st method : • If the page handles one or more password-protected
Close the page being tested. WebDev displays the files, this password must be specified in HPass.
editor that was currently used at the beginning of the If the passwords are not specified in the initialization
test. code of the project, a WLanguage error occurs when run-
-2nd method : ning the test of the page.
- Go back to the editor with the taskbar or with
[Alt]+[Tab].
- Confirm the stopping of the test. WebDev displays
102
103
104
105
10.10.6 Optimizing a process •The list of functions that call the selected process.
Once the process to optimize is chosen, the performance •The selected function (with the number of calls to this
profiler enables you to find out the details of the opera- function and the total processing time).
tions performed. •The list of functions called by the selected function.
To display the details of the operations performed in a The list of functions called enables you to improve the
process: search for the process to optimize. Indeed, you have the
1. Select the process to optimize in the "Summary" ability to view the different functions called as well as the
tab. processing time of each function.
2. Display the corresponding calls: All the processes that contain WLanguage code (named
•double-click the function. "Developer code") can be optimized.
•click the "Details" button. A double-click performed on one of the functions found
The displayed screen is split in three sections: in this list enables you to view the details of the proces-
ses called by this function.
106
• Regression test: WebDev site. Each Web user runs a set of operations
The regression test consists in checking the operating (scenario) simultaneously.
mode of a WebDev site between two updates. The • Comparing different servers:
regression test consists in checking whether a scenario WDTestSite is used to compare the speed of different
performed with a previous version of the site still ope- servers. To do so, run the same scenario on different
rates properly once the site has been updated. servers and compare the execution time of this scena-
• Running the test of a site in multi-user mode: rio.
The test of a site in multi-user mode is used to check • Optimizing the processes created in WLanguage:
whether concurrent accesses to the data files are WDTESTSITE is used to compare the execution time of
managed properly. This test consists in simulating the a scenario before and after the WLanguage code was
simultaneous connection of several Web users to a optimized.
107
11.1 Overview
An application, an Internet or Intranet site need to define • salesmen can see the price list, place orders and
the role of the different contributors. It is often necessary manage the new customers.
to define several access levels according to the users. • sales directors have access to all the options.
Indeed, all the users do not have the same responsibili-
ties or the same requirements. Their ability to use some To manage these access levels in your WinDev applica-
of the application features can be customized. tions or in you WebDev sites, all you have to do is include
the user groupware in your application or in your site. In
Let’s take a simple example: when implementing a sales just a few mouse clicks, a standard application can be
management application, the application offers the fol- changed into an application that manages several
lowing features: access levels. This feature can be easily implemented in
• See the price list a WinDev application or in a WebDev application.
• Modify the price list When starting the application or the site, the manager
• Enter the orders will be able to create users (identified by their login and
• Enter the customers. password) and to give them access to some features of
The accesses differ according to the user. Some exam- the site or application.
108
109
110
111
Configuration Details window (GPWlConfigurationDe- This page is available in custom mode only.
tails.WDW) This page allows the supervisor to manage the Web
This window is available in custom mode only. This win- users, the groups and the rights.
dow allows the supervisor to configure for each window
the rights granted to a user (or to a group) on all the con- Configuration detail page
trols, groups of controls and menu options found in the (GPWConfigurationDetails_WB.WDW)
window. This page is available in custom mode only.
This pages allows the supervisor to configure for each
Configuration Choice window (GPWConfiguration- page the rights granted to a Web user (or to a group) on
Choice. WDW) all the controls, groups of controls and menu options
This window is available in custom mode only. This win- found in the page.
dow allows the supervisor to copy a configuration that
was previously defined (for a user or for a group). Configuration choice page
(GPWConfigurationChoice_WB. WDW)
Configuration Form window (GPWConfigurationForm. This page is available in custom mode only.
WDW)
This page allows the supervisor to copy a configuration
This window is available in custom mode only. that was previously defined (for a user or for a group).
This window allows the supervisor to create a user or a
group. Configuration form page (GPWConfigurationForm_WB.
WDW)
Connection History window (GPWConnectionHistory. This page is available in custom mode only.
WDW)
This page allows the supervisor to create a user or a
This window is available in custom mode only.
112
directory for the common data files. mode) are created in a subdirectory of your project
• When creating the setup program, you can allow the (EXE\GPW_<Project Name> directory).
users to configure the location of these files ("Additio- • When creating the setup program, you can allow the
nal modules" pane). Therefore, a common directory users to configure the location of these files ("Additio-
can be selected for several applications that manage nal modules" pane). You have the ability to select a
the user groupware. specific directory for the rights files of the application.
• If "Manual Run" is selected, gpwOpen is used to start • If "Manual Run" is selected, gpwOpen is used to start
the login window or page of the user groupware as well the login window or page of the user groupware as well
as to customize the directory of the data files for user as to customize the directory of the data files for user
groupware. Regardless of the directories specified groupware. Regardless of the directories specified
when creating and installing the application, this direc- when creating and installing the application, this direc-
tory will be taken into account if it is specified. tory will be taken into account if it is specified.
Note: if no specific configuration is performed, the user Note: if no specific configuration is performed, the right
data files (HyperFileSQL Classic mode) will be created in data files will be created in a subdirectory of the executa-
a subdirectory of the executable’s installation directory ble’s installation directory named \GPW_<Project
(or of the library’s installation directory in the case of a name>.
WebDev site) named \GPW_<Project name>.
113
11.7.2 User groupware and multilingual appli- Depending on the user’s name, you have the ability to
cation open a given window/page.
If your application is a multilingual application, you need Example:
to manage this feature also in the windows/pages of the If gpwGetUserInfo(…
user groupware. By default, the windows/pages of the gpwLogin) = "FP" THEN
user groupware support English and French. Open("Win_Management")
To use the user groupware in a multilingual application, ELSE
you need to: Open("Menu")
1. Configure the user groupware as follows: END
•all the user groupware windows must be included
in the application.
11.7.4 Starting the login window/page from
one of the windows of the application or from
•the "manual launch" option must be selected. one of the pages of the site
2. Translate the different windows/pages of the user
groupware. By default, the windows/pages for When the user groupware is included in an application,
managing the user groupware are provided in you can choose whether the user groupware will be auto-
English and in French. To translate these windows or matically started or not. This option can be modified at
pages into other languages, all you have to do is any time.
translate the different captions, ... (by using the By default (automatic start), the login window/page is
WDMSG tool if needed to extract the messages to the first window/page of the application. It is run with the
translate). initialization code of the project.
Note: WDMSG is an optional tool of WinDev/Web- In some cases, you need to open a configuration win-
Dev/WinDev Mobile that can extract and reinsert all dow/page before the login window/page. To do so, you
114
11.7.6 Configuring the data files of the user •If only the user files are deleted (GPWUserConfigura-
groupware tion and GPWUser), only the supervisor will be able to
Two types of data files are used by the user groupware: start the application.
•data files of users. •If the rights files are deleted (GPWElementConfigura-
tion, GPWConfiguration and GPWElement), all the
•data files of rights. users will have all the rights on the entire application.
The location of these data files can be configured: See ’Data files’, page 118, for more details about the
•when including the user groupware for running the types of files managed by the user groupware.
tests.
•when creating the executable 11.7.8 Modifying the data files used by the user
•when installing the application (by the person that groupware
performs the setup) The structure of the data files specific to the user grou-
•by programming. pware cannot be modified.
Note: these files contain confidential data, therefore they
See ’Data files’, page 118, for more details. are encrypted.
11.7.7 Reinitializing the data files specific to 11.7.9 Managing the analyses
user groupware
If a specific analysis is opened while configuring the user
To reinitialize the user groupware data files, simply delete groupware, gpwInitAnalysis must be re-run (used to
the data files specific to user groupware (user file and open the analysis of user groupware).
right file). These files are automatically re-created when
the application is started. Note: at run time, you cannot open several analyses at
Part 2: Creating an application, a site
115
116
117
reports), ... In this case, the runtime contexts will be •For each component element, specify whether this
identical. element must be accessible from the project that
uses the component. If the element is accessible,
When should I allow the component to handle the data the developer (of the project that uses the compo-
files of the host application? nent) will be able to use the element like any other
For example, if the application contains a main applica- project element. See ’Visibility of a component’,
tion and some options supplied as components. In this page 131, for more details about the elements to
case, the components handle the data files of the main make visible or not.
application. •Specify whether the version number of the compo-
Note: if the component is authorized to handle data files nent must be changed (modification of a compo-
and if it has its own analysis, the component’s analysis nent). See ’Modifying a component’, page 129, for
will be ignored. The component will use the analysis of more details about managing the different versions
the host project. of a component.
In our example, when developing a component, this com- •If needed, specify the component’s information:
ponent can be associated with the analysis of the main Owner, name, copyright, ... The information will be
application. Therefore, there is no need to use the exter- visible:
nal declarations to handle the data files. Furthermore, - when the component is included in a WinDev or
the automation completion will be available in the code WebDev project.
editor. - in the description of the component displayed
from the "Wizards, Examples and Components"
Management mode of the skin templa- pane ("Description" from the popup menu of the
tes on the component elements component).
118
- WebDev compatible only: the component can <ComponentName>.WDI Interface of the component. This
only be used in WebDev projects. file contains:
- WinDev and WebDev compatible: the component - a help for using the component
only be used in WinDev and WebDev projects. when it is checked in
- the elements required for using
•Specify the physical name of the component. This the component in the project (com-
name will be assigned to the files corresponding to pilation information, and so on)
the component.
3. Validate. The component is generated. The fol-
lowing files are created in the EXE directory of the Attention: Generating the component can take some
current project: time if the component contains a lot of accessible ele-
ments.
<Component- This file contains all the WinDev
Name>.WDK elements to distribute
(windows, reports, …).
This file is required when deploying
applications that use the compo-
nent.
Part 2: Creating an application, a site
119
12.3.4 Distribution via a setup procedure •from the list of components generated from the
The distribution of components via a setup procedure project ("Workshop .. Component .. List compo-
consists in supplying a setup program to the users of the nents generated from this project" "Setup" but-
WinDev component. This program installs all the files ton).
required for using the component in the directory speci- 2. In the different planes of the wizard, specify:
fied by the user. •the setup media of the component
This setup mode is used to automatically manage: •the languages proposed in the setup procedure
• the WDO file and the setup of specific files (data files, •the default setup directory of the component
and so on) used by the component. •the optional modules to install. You have the ability
• the setup of specific tools (MDAC, ODBC driver for to modify the list of files that will be distributed with
HyperFileSQL, etc.) the component. The WDO file will be automatically
• the automatic update of the data files used by the created from this list.
component (if necessary). •…
• the uninstall program of the component. By default, the files required for installing a component
To propose a setup procedure for a component: are created in the INSTALL COMPO subdirectory of the
1. Create the setup procedure of the component: project.
•directly using "Workshop .. Component .. Create Reminder: When creating the setup program of an appli-
the setup procedure of a component". cation, the necessary files are created in the INSTALL
directory of the project.
120
the element is displayed in the code editor. • at anytime, in the description of the components inclu-
This documentation presents the parameters required ded in the project ("Workshop .. Component .. List of
for using the element (input/output parameters, …). components imported into the project"). The "Des-
• use the element based on the information specified in cription" button lets you get some information and the
the documentation as if the element belonged to the documentation of the component.
project: Caution: if an element from your project and an element
•to open a window, use Open and pass (if necessary) from the component have the same name, you need to
the parameters expected by this window. prefix the component’s element with the component’s
Open(ComponentWindow … name in order to use it.
[, Param1, …
Param2]) 12.4.3 Updating a component
When a new version of a component is available, simply
•to print a report: use iPrintReport and if needed,
install the new files of the update into the setup directory
pass the parameters expected by this report.
of the component (depending on the setup mode used).
iPrintReport(ComponentReport … See ’Distributing a component’, page 125, for more
[,Param1, … details about the various setup modes of a component.
Param2])
When opening a project that uses this component, the
•to call a procedure: use the usual syntax. change of component version will be automatically
ComponentProcedure(Param1,Param2) detected and a project update will be offered. We recom-
mend that you recompile the project.
•to use a class: declare a variable of the same type as
the class. Note: you can force the update of a component from the
Part 2: Creating an application, a site
121
tion/site.
Two methods can be used to update a component on the
end-user computers: 12.5.2 Share a component among several
1. Recompiling the host project applications/sites (on the same server)
Recompile the application that uses the component Several applications (or sites) installed on the same
and redistribute the application/site with the com- computer can use the same component. To share the
ponent. In this case, no version problem or compati- component among these applications (or sites) and
bility problem will occur. The recompilation is avoid duplicating the component, perform the following
required in the following cases: operations:
•New features have been added to the component 1. Copy the component files to a directory:
and they must be taken into account. •the <ComponentName>.WDK file
•The parameters of some procedures have been •the other component files (if necessary)
modified. 2. In each directory of the applications/sites that
•Incompatibility between the new version and the use the component:
earlier versions of the component. •Delete <ComponentName>.WDK and the files
•… required by the component.
2. Distributing the .WDK file directly •Create a <ComponentName>.INI file. This file has
Provide an upgraded version of the component the following structure:
(.WDK file) to the end users without recompiling the [General]
project. Location = <Directory in which the compo-
In most cases, this possibility applies when: nent files are available>
122
12.6.2 Regenerating the modified component: This compatibility mode is automatically managed. If
managing compatibility between different ver- the version of the component installed with the appli-
sions cation/site is older than the one used by the applica-
tion/site, the application/site will not work.
Whenever a modification is performed, the component
must be regenerated in order to take the modifications • backward compatibility: using a new version of a com-
into account (change the interface of a window or a page ponent with projects compiled with an older version
for instance). can be forbidden. Therefore, the projects must be
recompiled in order to use the new version of the com-
To regenerate the modified component: ponent.
1. Start the component generation:
•via "Workshop .. Component .. Generate the com- Backward compatibility
ponent".
•directly from the description window of compo- WinDev/WebDev always automatically checks the ver-
nents ("Generate" option. sion number of the components to insure that the version
of the component used in the deployed application/site
The wizard for generating the component starts.
is greater than or equal to the one used when the appli-
2. In the "Compatibility of deployed component"
cation/site was developed.
screen, WinDev checks the modifications made to
the component. Example: The project has been compiled with version
•If the modifications make the component incompa- 1.00C of a component. The version 1.00C is the refe-
tible with the previous versions , a screen comes up. rence version. This means that the applications/sites
Synchronize the version numbers ( ). that use this component will work only if the component
Display the next plane to continue with the compo- version is greater than or equal to the reference version.
Part 2: Creating an application, a site
nent’s generation.
The following cases can occur:
•If the detected modifications do not make the com-
ponent incompatible with the previous versions , no • First case: deployed applications/sites use an version
specific action is required. Display the next plane to of the component (".WDK" file) that is older than ver-
continue with the component’s generation. sion 1.00C. An error will occur when loading these
applications/sites.
12.6.3 The different types of compatibility
• Second case: deployed applications/sites will work if
Definition they use the component in the expected version.
The management of the compatibility is linked to the ver- • Third case: deployed applications/sites will also work
if the component is compiled with a higher version than
sions of a component. Indeed, if modifications have been
the expected one (in the case where the new version
made to the component, the deployed applications that
only fixes bugs).
use the component may encounter runtime problems if
they are not in phase with this component. Forward compatibility
The management of compatibility is an important step in WinDev/WebDev automatically detects incompatibilities
the modification of a component. There are two types of between two versions of the same component when
compatibility: generating the component. If differences are found, Win-
• Backward compatibility: the version of the component Dev/WebDev offers to modify the "number of the last
used (.WDK file) to compile applications/sites using compatible version". This number is the version number
this component must always be greater than or equal from which the applications/sites that use the compo-
to the current version used in deployment. nent will be allowed to work.
Tome1_2.book Page 123 Vendredi, 28. mai 2010 5:50 17
123
Example: A project that used version 1.00C of the com- version of the component. The component (.WDK file)
ponent has not been recompiled with the new version can be directly distributed to the end users.
1.00E of this component. Version 1.00E of the compo-
nent is installed on the deployment computers. • Second case: the component has been modified to
add a parameter to a procedure for instance. When
The following cases can occur: generating the component, the "number of the last
• First case: this component has been modified only to compatible version" has been modified.
correct some bugs. When generating the component, In order for the applications/sites to work properly, the
the "number of the last compatible version" has not projects must be recompiled with the new version of
been modified. the component. Otherwise, the applications will refuse
In order for applications/sites to work properly, the to work in order to avoid problems due to potential
projects do not need to be recompiled with the new incompatibility with the new version of the component.
124
How do I access the documentation of If the member or the method is public (default
a component? case) in the component, the member or the
The general overview of the component is automatically method will be public in the project that uses
the component.
displayed when the component found in the "Wizards, If the member or the method is protected in the
Examples and Components" pane is hovered by the component, the member or the method will be
mouse cursor. protected in the project that uses the compo-
nent.
The technical documentation of the component is availa- If the member or the method is private in the
ble: component, the member or the method will not
• when including a component in a project ("Workshop .. be accessible in the project that uses the com-
ponent.
Component .. Import a component into the project").
• at anytime when double-clicking the icon of the com- Window/Page No access to the The global variables of
window/page the window/page can-
ponent found in the "Wizards, Examples and Compo- not be handled.
nents" pane or via the "Description" option of the
If these variables must
component’s popup menu. be handled, procedures
• at anytime, in the description of the components inclu- for reading or modifying
ded in the project ("Workshop .. Component .. List of the global variables of
components imported into the project"). The "Des- the window/page must
be included in the com-
cription" button lets you get some information and the ponent.
documentation of the component.
If the procedure has no access attribute in the
The documentation specific to an element of the compo- component, this procedure is invisible in the
nent can be displayed: project that uses the component.
Part 2: Creating an application, a site
125
Analysis The analysis can be included (or not) in the • the name of the file. This file will be sought in the cur-
component. No visibility option can be defined. rent directory of the component.
The analysis will always be invisible. For example:InitialState.INI
Caution: if an analysis is included in the com-
ponent and if a password has been defined for • a file name that uses a relative path.
this analysis, you need to include the project The possible syntaxes are:
with the component. •Directory\FileName.xxx to specify a subdirectory of
Query The queries can be included (or not) in the the current directory
component. No visibility option can be defined. •.\FileName.xxx to specify the current directory
The queries will always be visible.
•..\FileName.xxx to specify the parent directory
12.7.3 The WDO file For instance: \RadioButtonComponent\InitialS-
tate.INI
When generating the component, two files are automati-
cally created in the EXE directory of the current project: This file will be used when the component is included in
the project. The paths specified in the WDO file must cor-
<Component- Contains all the elements to distri- respond to the path where the files are installed on the
Name>.WDK bute (windows, pages, reports, and
so on) with the component development computer of the component.
When including the component, the tree structure speci-
<Component- Interface of the component. This file fied in the WDO file will be stored and reproduced in the
Name>.WDI contains:
- a help for using the component
EXE directory of the project. See ’Using a component in
when it is checked in an application or a site’, page 126, for more details.
- the elements required for using the Example: the "Postal code" component uses a data file
component in the project (compila-
named "Cedex" )Cedex.fic and cedex.ndx files). In the
126
ponents" pane contains the following elements: (double-click the component’s name or icon, or select
the "Description" option of the component’s popup
• Components: these components come with your Win- menu).
Dev/WebDev product. Note: the "General" tab of the component description
• Custom components: the list of custom components lets you get general information about the component.
corresponds to the following components: • import the component (Drag and drop the component
•generated from WinDev/WebDev into the project editor, or select the "Import" option of
•imported from WinDev/WebDev the component’s popup menu.
•selected via the <Browse> or <Find> option • remove the component from the list (custom compo-
The custom components are displayed regardless of nent only): allows you to only keep the useful compo-
the WinDev/WebDev user. nents in the "Wizards, Examples and Components"
pane.
Tome1_2.book Page 127 Vendredi, 28. mai 2010 5:50 17
127
13.INTERNAL COMPONENT
13.1 Overview
An internal component is used to group several project can be debugged directly from the project that uses it.
elements. This grouping allows you to: Difference with a classic component: an internal compo-
• Organize a project: you can create internal compo- nent allows you to include all the elements of the compo-
nents to group the elements of a project by feature set nent in the interface of the project containing the internal
for example. component. All the "public" elements of the internal
• Share elements among different projects: elements component can be handled directly in the editor.
found in an internal component can be shared among When using a standard component, the "public" ele-
several projects via SCM. See ’Sharing internal compo- ments of the component cannot be handled directly. To
nents (via SCM)’, page 136, for more details. modify the standard component, the corresponding pro-
One of the benefits of the internal component compared ject must be opened.
to a standard component is that the internal component
128
Tip: an internal component does not have any global 13.2.3 Internal component and analysis: case
declaration code. A set of procedures can be used to ini- of the full autonomy
tialize the internal component. An internal component can be linked to its own analysis.
In this case, the project that includes the internal compo-
13.2.2 Modifications performed during the nent can have several analyses:
creation
• the analysis of the project
When creating an internal component, the following ope-
rations are performed: • the analysis of the internal components. This analysis
is defined when creating the internal component. It can
• A subdirectory named like the internal component is also be selected from the description window of the
created in the project. internal component.
• The different elements assigned to the internal compo- The elements generated by RAD for the internal compo-
nent are grouped in the directory of the internal com- nent will be generated in the directory of the internal
ponent. The files corresponding to the project elements component. If the analysis of the internal component is
are physically moved. modified, a new generation by RAD will automatically
• A WCI file is created in the directory of the internal propose to generate the elements corresponding to the
component. This file contains the list of the component modifications.
elements.
The internal components can be shared among the pro- automatically included in the project. A subdirectory
jects via SCM. named the same as the internal component is crea-
ted in the local project (on the development compu-
To share an internal component via SCM, the project con- ter). This directory contains all the component
taining the internal component must be found in SCM. elements. This subdirectory is also created in the
You can: directory of the project in the SCM database.
• create the internal component from a project found in Notes:
SCM. The internal component will be automatically
found in SCM. • "Workshop .. Internal component .. Import an internal
component into the project .. From a file" lets you copy
• import a project containing one or more internal com- the content of an internal component into a project.
ponents into SCM. The internal components will be The elements are not shared.
automatically included in SCM.
• You can also use an internal component found in SCM
13.3.2 Using an internal component found in from the window for managing the internal compo-
SCM nents ("Workshop .. Internal component .. Manage the
internal components of the project").
To use an internal component in a project found in SCM:
1. Select "Workshop .. Internal component .. Import 13.3.3 Handling a shared internal component
an internal component into the project .. From
SCM". The project file is automatically checked out if Whether the internal component is shared or not, the
necessary. operations that can be performed on the internal compo-
2. The window for adding an internal component is nent are identical.
displayed. The list of internal components found in Caution: when the internal component is shared, by
the SCM is displayed. You have the ability to view she default, all the developers using SCM can directly modify
shares already performed for each available compo- the internal component and its attributes. You can limit
nent. the modifications by applying a management of rights to
3. Select an internal component and validate. the internal components and to its files.
Tome1_2.book Page 129 Vendredi, 28. mai 2010 5:50 17
129
14.PROJECT DOCUMENTATION
WinDev, WinDev Mobile and WebDev enable you to print documentation can contain all the characteristics of
various documentations detailing all the elements (win- the project.
dow, page, report, data file, item, etc.) of the project. To •"File .. Print the documentation". The documenta-
print these documents, select: tion contains the characteristics of the current ele-
•"Project .. Print the project documentation". The ment (window, page, report, query, and so on).
130
14.1.3 Cover of the documentation the wizard for creating the project documentation.
The project documentation can include a cover page
used to present the project. This cover page can contain 14.1.4 Edit mode of the documentation
the following elements: The documentation can be:
•caption of the application/site, •printed,
•title of the documentation to print, •exported to a RTF document or to an XML file,
•image of the cover, exported to an HTML file (an Internet browser must
be installed on the current computer),
•information about the company.
•exported to a text file.
The information printed on the cover is directly entered in
To specify the print areas of the current graphic repre- 14.3.2 Print format
sentation: If the print format is modified (from A4 to A3 for example
1. Select "Display .. Print areas". Some borders in the properties of the printer), the documentation
representing the areas that can be printed in the pages can be adapted to the new format. To do so:
documentation are displayed in the current editor. 1. Define the print areas.
2. Reduce the display of the graphic representation 2. Display the formatting options of the documenta-
("Display .. Zoom" or [Ctrl] + mouse wheel) in order tion ("File .. Documentation layout").
3. Select "Adapt the size of the print areas for the
to view the entire chart. opened documents".
3. With the mouse : 4. Print the documentation.
- moves these borders to the requested location
by keeping the mouse button down (the mouse
cursor is black).
Tome1_2.book Page 131 Vendredi, 28. mai 2010 5:50 17
131
Once your application is entirely described (windows, you do not need to start WinDev to run the application.
reports, and so on), you must create the corresponding Once the executable is created, you can deploy the appli-
executable program. cation on the end-user computers by creating the setup
The executable program (".EXE" file) can be run directly: program.
132
It can be created in a separate file (".WDL" default. To optimize the time it takes to copy the files
extension) or added to the executable. to the Pocket PC, you may choose not to copy the
Including the library in the executable program large files (marked in red).
presents the benefit of having only one file to 6. Validate the copy and run the executable on the
install or update, but it increases the size of the Pocket PC. The wizard is done.
".EXE" file.
•the error message that will be displayed when 15.2.1 Splash screen
a programming error occurs. A splash screen is added automatically to each applica-
•the use of patches for updates. In this case, all tion created with WinDev Mobile. The size of this splash
you have to do is copy the file corresponding to screen depends on the platform used by the project.
the patch into the executable directory. .
•the project languages to include in the execu-
table. 15.2.2 Smartphone: Creating executable with
•the files found in the library (if there is one). file copy
•the version information. This information will When starting the application after the executable is cra-
be displayed in the "Version" tab of the pro- ted, a dialog box comes up to warn the user that an exter-
perty window of the executable (accessible nal program is attempting to launch an application: "This
from Windows explorer). The version number program comes from an unknown source that may not be
can be incremented automatically each time trust worthy. Do you want to start the program?"
the executable is created. This dialog box must be validated in order to run the
•the type of framework (DLL file) to install on application.
the Pocket PC. To not see this message on the Smartphone, contact the
•whether the executable must be saved in the Smartphone’s vendor.
reusability center. Note: you can also get a numeric signature for your appli-
•whether a project backup needs to be done. cation. Contact the Smartphone supplier for more
3. The executable is created on the development details.
computer.
4. Specify whether the executable must be copied
Tome1_2.book Page 133 Vendredi, 28. mai 2010 5:50 17
133
16.1 Overview
WinDev enables you to generate Java applications 16.1.2 Why develop a Java application with
without even knowing the Java language. As with all Win- WinDev?
Dev applications, the application is developed in WLan- You have developed a WinDev application for Windows
guage. and you want to make this application accessible inde-
pendently of the operating system? Generate a Java
16.1.1 What is a Java application? application so that users working with Mac OS for ins-
A Java application is entirely compiled in Java. If this tance will also be able to use your application.
application handles a database, this database must This way you can share your network applications.
have a JDBC driver (MySQL, Oracle,…). This driver is spe-
cific to each database (it can be downloaded from the 16.1.3 Principle for generating a Java applica-
website of the database publisher). tion with WinDev
Access to a HyperFileSQL database is performed natively
As mentioned above, you do not need to know the Java
(in Windows and Linux only) via the SQL functions of language to develop a Java application with WinDev. You
WLanguage. No additional driver is required. develop your application in WLanguage, like any other
A Java application corresponds to a ".jar" file and it WinDev application, then when compiling the project, the
134
16.2.3 Test of a Java project in the editor • use Java compiler to create and compile the Java files
When testing a Java project ( ), the project is compi- needed for the application
led and run under Windows. The project is not compiled • create a Java archive that can be run directly:
in Java. •a classic java application
To run the Java application, you need to run the ".Jar" file •a Java applet
located in the EXE directory of your project. •a Java Web Start application
16.2.4 Compiling a Java project in WinDev • use the project windows from your own Java source
files. In this case, the corresponding Eclipse project
The compilation of a Java project is used to: can be generated.
• identify the programming errors found in the WLan-
guage code To create the Java archive simply start the executable’s
creation ("Workshop ... Java .. Generate Java archive").
• view the controls, processes, WLangage functions not A wizard helps you to create your java archive then.
available in Java. These errors appear in purple in the
"Code" pane. 16.2.6 Deploying a Java application
See the online help for more details about the WinDev
elements that are not available in a Java application. As for any application, WinDev enables you to create a
setup program for a Java application. This setup proce-
dure is available for Windows only. The setup program will
Note: as indicated in the ’What is a Java application?’, be an executable and it will be used to install the neces-
page 141, you need to install the Sun J2SDK on the deve- sary files as well as the Java runtime (JRE). For the other
lopment computer in order to compile your project in platforms, your files will have to be deployed manually.
Java.
To start the setup creation wizard, select "Workshop ..
Part 2: Creating an application, a site
135
17.1 Overview
WebDev enables you to generate PHP sites without even large number of PHP engines are available on the Inter-
knowing the PHP language. The site can be developed net. You need to download one and install it. For ins-
completely in WLanguage, like a classic WebDev site. tance, you have EasyPHP (http://www.easyphp.org/).
However you can enter your own PHP code (server code). This engine is used for example purposes, you can use
any PHP engine.
17.1.1 What is a PHP site? Note: PHP version 4.3.2 (or later) is required. A MySQL
A PHP site is compiled in PHP. If this site uses a database, database is required. The PHP sites generated by Web-
access to this database is done through an ODBC driver Dev can also be used by the PHP servers version 5.
(MyODBC, ODBC for Oracle, etc.) or through native
access for MySQL. 17.1.2 Why develop a PHP site with WebDev?
The ODBC driver is specific to each database (and can be For some sites (especially small ones), it may be useful to
found on the database publisher’s site). develop these sites in PHP in order for them to be hosted
A PHP site is made of ".php" pages and requires a PHP at no extra cost. Now you can do this with WebDev.
engine to run. Note: the number of WLanguage functions that can be
To compile (in PHP) a WebDev PHP project, you need to used in a PHP project is limited in this version. This num-
136
When developing an application, one of the important • in the available setup modes (single computer or
steps consists in deploying this application on the user network)
computers.
This chapter briefly describes the different types of setup
WinDev optimizes this deployment by offering a large offered by WinDev and their specificity.
number of choices:
See the online help for more details about the creation of
• in the setup media the setup program.
• in the tools used to create the setup program
Internet X (recommen-
ded)
CD ROM X X (recommen-
ded)
Autorun possible
Setup media
In-house X X (recommen- X
network ded)
Diskettes X (recom- X
mended)
Tome1_2.book Page 137 Vendredi, 28. mai 2010 5:50 17
137
138
18.2.1 Creating a setup program To install an update of your application, all you have to do
To create a setup program allowing you to: is run the setup program of the update on the end-user
computer. The application files modified by the update
• deploy a WinDev application, you can: are replaced.
- use the wizard for creating the setup program directly
from WinDve ("Workshop .. Create the setup proce- Setup with automatic update
dure"). This wizard enables you to create the diffe-
rent types of setup programs easily. To install your application:
- use WDINST ("Tools .. WDINST - Setup editor"). This 1. Start your setup program on the server. The files
editor enables you to customize the setup program. required by the reference application are installed in
the specified setup directory. The reference applica-
• provide other files, you need to use the setup program tion corresponds to a client setup program.
creation wizard started from the WDINST setup editor
2. Run the client setup program from each user com-
("File .. New" from WDINST).
puter. The files required by the client application are
Reminder: To start the WDINST setup editor, select
installed in the specified setup directory.
"Tools .. WDINST - Setup editor".
To install an update of your application:
18.2.2 Installing a WinDev application 1. Start your setup update on the server. The files of
the reference application modified by the update are
Standard, compact or MSI setup replaced. These replaced files can be saved.
To install your application, all you have to do is run the 2. When the application is started from a user com-
setup program of the application on the end-user compu- puter, the application update is automatically offe-
ter. The files required by the application are installed in red.
the specified setup directory.
Part 2: Creating an application, a site
Tome1_2.book Page 139 Vendredi, 28. mai 2010 5:50 17
139
Creating the setup program allows you to deploy an WinDev Mobile enables you to create a full setup pro-
application on the end-user computers. gram. This setup program can be used to install:
The creation of the setup program is used to specify all • a WinDev Mobile application.
the parameters required for installing and for using your • other files. Installing goodies for instance (images,
WinDev Mobile application. videos, …).
140
When developing a dynamic site, one of the important the server’s settings.
phases consists in deploying this site on a Web server (at
an Internet Service Provider or on an Intranet). Notes:
Two deployment methods are available: • For each Web server that hosts WebDev sites, the host
•remote deployment (through FTP): recommended must own a WebDev Application Server license.
when the server is not directly available. • The setup program is created by selecting "Workshop
•deployment via physical media (CD, and so on): .. Create the setup procedure".
recommended when the server is easily accessible. To deploy a static site, see ’Deploying a static site, a
•deployment via package: recommended when the semi-dynamic site or a PHP site’, page 155.
server is not easily accessible and if you do not know
during the development steps (description of the data- 1. Install the WebDev application server on the Web
base, description of the pages, compiled source codes, server (if not already done).
and so on). The HTML pages and the images are not 2. Install your WebDev site by running the Install pro-
included in the library. The implementation of a library is gram provided with your installation.
automatic when creating the setup program. Note: you can also create a setup via independent phy-
Once the library has been created, the setup program sical media, containing the installation for the WebDev
creation wizard starts. You can choose to perform: application server limited to 10 connections. This solu-
tion is ideal for proof-of-concepts presented on a lap-
• a setup through FTP (remote setup) top.
In order to perform a remote installation, the host must
have: • a deployment package :
1. Created and configured your FTP account on the ser- A deployment package is an executable containing all
ver. the elements required to deploy a WebDev site. This
2. Created and configured your WebDev account on package can then be run from any computer to install
the server the Web site on the server machine by FTP.
The host must provide you with a login and password To create this type of setup program, you do not need
for these accounts. to know the configuration of the FTP account or the
WebDev account found on the Web server.
• a setup using physical media :
The wizard enables you to create a setup program for
your site. This setup program must be supplied to your
141
•Server address (the name of a computer accessi- you’ll be able to connect to it either by using the
ble through the network, an IP address or an Inter- right address, or through a static page with a link
net address) pointing to the site. If this option is not checked,
•Settings of the WebDev account (the user name the site can be enabled via the remote administra-
and password). tor.
•Settings of the FTP account (the user name and 4. Configuring the site. These options let you confi-
password). gure the site’s connection options as soon as it is
installed.
To easily identify the server’s configuration for a These parameters can be modified if necessary:
future update, name the server. This name will be
displayed (followed by the server address) in the •by the deployment administrator found on the ser-
window where you choose the setup type. ver.
•by the remote administrator, that can be used by
2. The files to install. By default, the wizard selects the site manager.
the library, the data files, the images and the HTML
pages. 5. If an update of the analysis has been performed,
select the automatic data file modification during
3.Setup configuration: choose the type of remote the installation.
setup to perform: Note: if this option is chosen, the update will be offer
•Immediate update: during the installation.
The site’s files are compressed and transfered Special case: if the data files found on the server are
immediately on the Web server (the Web server in HyperFile 5.5 format, they need to be migrated to
must be accessible from the installation compu- HyperFileSQL Classic format. This migration must be
ter). The WebDev site is installed automatically on performed only when the site is first updated.
142
143
the layout with the "Customize" button. 11. Generate the setup program:
4. Your site’s files. An information window indicates the possible pre-
Note: library, HTML, Java, JavaScript and image files sence of files with long names. If you are installing
are selected by default. on a network drive, check that:
5. the appendix files: •the network drive supports long names,
• The license (txt format file) will come up when •the network drive does not modify the case of the
starting the setup program. file names.
Note: if the license is not validated by the person 12. Once the creation of the setup program is done,
performing the setup, the setup will be canceled. WebDev offers to:
•The "readme" file: this file can be in different for- •directly test the setup program.
mats (txt, htm, doc, hlp, pdf, ec.). Regardless of the •open Windows explorer directly in the setup pro-
selected format, the user must have a software gram directory.
allowing him to view this file.
•An executable to run at the end of setup. Caution: 13. Perform a backup of your site.
remember to include the linked files with the exe- We recommend that you keep a backup of the
cutable (DLLs, parameter files, other executables, source corresponding to an installed version of your
etc.). site.
Note: you can select a license file and a "ReadMe"
file for each setup language. 20.4.2 Installing the dynamic site on a Web
6. If an update of the analysis has been performed, server (physical media)
select the automatic data file modification during If you are installing your site through a hosting service,
the installation. you usually have two options:
144
3. Choose the setup language: a setup wizard starts. WebDev administration tool to check that there is no
Go to the next plane. current connection and to stop the sites (check
4. The setup program automatically detects whether "Locked Site" in the "Sites" tab).
one or more of the following Internet servers are ins- 7. Install an ODBC driver for HyperFileSQL if pro-
talled on the computer: grams not developed with WebDev must access the
•OmniHTTPd: Omnicron server provided with Web- HyperFileSQL files of the site that will be installed
Dev (does not support Windows NT), (optional step).
•IIS Version 2 to 6 (Microsoft Internet Information 8. The summary of the setup is displayed:
Server): Microsoft server provided with FrontPage •Go to the next screen to start the installation.
and with Windows NT and Windows 2000, •To modify some parameters in the previous win-
•Netscape Enterprise Server 4: Netscape server for dows, click "Previous".
Windows NT Server.
9. The setup is done:
•Microsoft FrontPage Server (FrontPage Personal
Web Server): Microsoft server provided with Front- •Click the offered address to test your WebDev site
Page, locally. This option can be used only if the Web ser-
ver was configured automatically.
•Apache Version 1.3.x to 2.x: free Web server provi-
ded by the Apache Group. •Click "Copy" to get the offered address. See the
’Taking a dynamic site live’ paragraph, page 153,
Three cases may occur: for more details.
•Case 1: your Web server is not listed: select "Other •Click "Done" to complete setup.
server". See the online help for more details about 10. Configuration of web server:
the server configuration.
Part 2: Creating an application, a site
145
For example, for 20 parallel connections, you must plan •Virtual memory: 84 MB (20 MB for the connections
for: and 64 MB for the NT server).
•RAM: 67.8 MB (7.8 MB of RAM for this site, 60 for the
NT server).
146
21.1 Overview
When developing a static, semi-dynamic or PHP site, one •network deployment: recommended when the server
of the important phases consists in deploying this site on is easily accessible.
a Web server (on a host or on an Intranet).
The WDDeploy tool simplifies the deployment of your sta-
Two deployment methods are available: tic sites.
•remote deployment (through FTP): recommended Note: to deploy a dynamic site, see ’Deploying a dynamic
when the server is not directly available. site’, page 148.
147
22.1 Overview
The WebDev administrator is a module used to manage • the remote WebDev administrator allowing the site
the dynamic WebDev sites. manager to manage his dynamic WebDev sites remo-
When developing a dynamic WebDev site, the adminis- tely from any computer.
trator is mainly used to: This help only presents the WebDev Development admi-
• run the test of the site via the test page ("Advanced" nistrator.
tab, "Test Page" option). For more details about the deployment tools, see their
• define the parameters for connecting to the site for help.
test: timeout value, ... ("Configuration" tab).
• delete the current test connections ("Connections" Starting the WebDev administrator
tab). To start the WebDev Development administrator, select:
• change the Web server used for your tests ("Advan- • "Tools .. WD150Admin - WebDev Administrator" from
ced" tab, "Server" option). WebDev Development.
• perform a diagnostic if a problem occurs when starting • "Programs .. WebDev 15 .. WebDev administrator"
a WebDev site ("Configuration" tab, "Diagnostic" from the "Start" menu.
148
149
Managing the remote debugging WebDev sites. Caution: This server will be used for all the
The WebDev administrator enables you to specify dynamic WebDev sites installed on this computer.
whether the remote debugging of the dynamic WebDev If the server used is not found in this list, choose "Other".
sites is allowed or not. You will have to manually configure the Web server used.
If the remote debugging is allowed, the following parame- See the online help for more details about the configura-
ters must be specified: tion of specific servers.
• Main port (27 271 by default). Diagnostic
• Range of the session ports (between 27 282 and 27 The "Diagnostic" button enables you to check the confi-
289 by default). guration of the current computer. This diagnostic is used
The "Default" button lets you restore the default values. to check:
•whether the FTP/IP protocol is installed
22.2.4 Management •whether a Web server (HTTP server) is started
The "administrator" tab allows you to: •whether the manager of the AWP protocol is configu-
red properly
• Configure the server for the site setups and updates.
•whether the necessary WebDev executables are
• Configure the error messages displayed in the browser. found.
• Managing the WebDev accounts.
The dynamic WebDev sites will not work if one of these
Setup/Update conditions is not fulfilled. See the online help for more
These options are available in the deployment version. details.
They allow the host to authorize and configure remote
installation and updates of sites. Name or IP address of the current computer
150
151
152
153
154
•Click the "Share" button to share the selected ele- cific operation is required.
155
156
The automatic mode allows you to not have to manage the computer where the analysis is generated.
the "Master/Guest" mode on the project.
To enable the automatic mode: Changing computer
1. Display the project description ("Project .. Project If you need to change your computer (or the name of your
description"). computer), you must check in everything via the SCM
2. In the "SCM" tab, check "Check out/Check in administrator BEFORE changing computer ("SCM .. SCM
the project automatically". administrator" to start the SCM administrator). See the
This option can also be enabled via "SCM .. Project online help for more details.
management .. Manage the project checkout automati-
157
158
add a directory found in the local project to the refe- History and differences
rence project. The SCM administrator enables you to:
Note: Do not use this option to add a project to SCM. •view the history of the modifications made to a file
•Create new directory. This option enables you to (check-in and check-out operations). To do so, select
create a new directory in the reference project. the relevant file and select "Source Code Manage-
•Delete a directory. This option enables you to delete ment .. History". The window that opens enables you
a directory from the SCM database. You also have the to:
ability to delete a project from SCM (to do so, delete - Get an earlier version
the corresponding directory). The deleted directory is - Save an earlier version under a new name.
the directory selected in the SCM explorer. - Compare two versions
CAUTION: this operation cannot be undone. - Merge.
•Rename a directory. This option enables you to •see the differences: This option enables you to com-
rename a directory in the SCM database. The direc- pare the local version with the version stored in the
tory used is the one selected in the SCM explorer. SCM database.
•Define the associated local directory. This option File sharing
enables you to specify the name of the local directory
associated with the project found in the SCM data- The SCM administrator is used to manage file share
base for the current user. among several projects (sharing sets of procedures, sha-
ring analyses, …). This operation can be performed in the
Restore a project version SCM administrator only.
The SCM administrator enables you to restore a specific Administration and maintenance tools
version of a project (corresponding to an earlier version General options
Part 2: Creating an application, a site
159
the relevant users. next time the projects are opened, you will have to spe-
•Full backup of the database: This option allows the cify the new directory for the SCM database.
administrator to perform a backup of the SCM data- • "Tools .. Maintenance .. Convert the database to
base. This backup is performed in a file in .ZIP format. Client/Server" starts the wizard for switching the data-
Note: During the backup, the SCM database can only base to HyperFileSQL Client/Server mode.
be accessed in read mode. This operation can be performed only if a HyperFileSQL
•Back up and clear the history: This option allows the Client/Server engine is installed on the server where
administrator to delete part of the history for the SCM the SCM database must be installed.
database. The deleted part is automatically saved in You must specify:
a file in .ZIP format. This backup can be restored - The name of the server
later. To save or clear the history, specify the date - The name of the database and its port.
from which the history must be kept. - The name and password of an administrator of the
•Restore a full backup of the database. HyperFileSQL database.
•Restore a history backup: This option enables the Depending on the size of the SCM database, the migra-
administrator to restore a history backup file. tion of the database may take quite a long time.
At the end of this operation, SCM proposes to automa-
Maintenance tically create the user account corresponding to the
• "Tools .. Maintenance .. Convert database to the most connected user (if this account does not exist).
recent format" lets you migrate a SCM database to a The next time the project is opened, you will have to
more recent format. This format optimizes the acces- specify the new parameters for connecting to SCM.
ses to the database. Note: The SCM database in "Classic" mode is not
Note: To use this option, the SCM database should not deleted. Once the migration to HyperFileSQL Client/
160
Part 2: Creating an application, a site
Tome1_2.book Page 161 Vendredi, 28. mai 2010 5:50 17
PART 3
Basic syntax
of WLanguage
Tome1_2.book Page 162 Vendredi, 28. mai 2010 5:50 17
Tome1_2.book Page 163 Vendredi, 28. mai 2010 5:50 17
163
1. INTRODUCTION
WinDev, WebDev and WinDev Mobile are complete deve- window, page and control.
lopment tools that allow you to create projects as well as These processes are entered in a dedicated source editor
manage the elements created with the WinDev, WebDev (also called code editor). This editor can be accessed
and WinDev Mobile language: WLanguage. directly from WinDev, WebDev or WinDev Mobile. It ena-
WLanguage is an integrated 5GL. With the WLanguage bles you to access any process of an object at any time.
functions, you can create processes for each project,
164
This chapter presents the syntax of WLanguage. Each default, the following colors are used:
WLanguage feature is: •yellow for server code,
•accessible in server code only: the feature will be •green for browser code written in WLanguage,
executed on the server, •blue for browser code written in JavaScript.
•accessible in browser code only: the feature will be
executed by the browser on the d user’s machine, • You can execute a process on the server from a process
•accessible in both server and browser code. written in browser code.
Example:
Notes: //browser code for
//modifying and exiting form a combo
• To write server code, you must use WLanguage.
// box
• To write browser code, you can use: PageSubmit("","Button1")
•WLanguage commands, which will be translated //call the server code of the click on
into JavaScript automatically, //BUTTON1
•JavaScript directly.
• In the code editor, different color bands let you diffe-
rentiate between server code and browser code. By
Part 3: Basic WLanguage syntax
Tome1_2.book Page 165 Vendredi, 28. mai 2010 5:50 17
165
2. VARIABLES
WLanguage offers two types of variables:
• the simple types, which can be declared directly
• the advanced types, which are made of one or more
simple type variables.
166
167
2.1.4 The different integer types Real numbers all have the same number of significant
WLanguage offers different types of integers: digits (15).
If the result of a calculation performed on real values
Value included between involves more than 15 significant digits, this result will be
Integer -2 x 109 and 2 x 109 automatically rounded to 15 significant digits. The preci-
(about) sion of the result will be less than the precision of a calcu-
1-byte integer -128 and 127 (inclusive) lation performed with the currency type.
2-byte integer -32.768 and 32.767 Calculations on currencies
(inclusive) All the calculations that use at least one currency will be
4-byte integer -2 x 109 and 2 x 109 performed with the currency type. For a better precision
(about) of the result, all the operands will be automatically chan-
ged into currency.
8-byte integer -9 x 1018 and 9 x 1018
(about) External language
The currency type is not available with external langua-
Unsigned integer 0 and 4 x 109
ges.
Unsigned 1-byte integer 0 and 255 (inclusive)
Unsigned 2-byte integer 0 and 65.535 (inclusive) 2.1.6 The numeric type
Unsigned 4-byte integer 0 and 4 x 109 (about) WD, WB s, The Numeric type can be used only in
Unsigned 8-byte integer 0 and 18 x 1018 WDMobile WinDev, in WebDev server code and in
WinDev Mobile.
System integer automatically adapts to
the size generated by the
The numeric type is used to contain integer or decimal
system (4 bytes in 32-bit,
numbers by specifying if necessary:
8 bytes in 64-bit)
• the number of digits in the integer part.
168
The length of an ASCIIZ string cannot exceed 2 GB. The MyString = NoSpace(MyString)
length given to the ASCIIZ string must be equal to its CountLetter(MyString)
current length plus 1 (for the binary zero). // CountLetter is a procedure
Type not available in WinDev Mobile.
• Fixed string on: Fixed-size string. 2.1.9 The Buffer type
The length of a fixed string cannot exceed 2 GB. The The buffer type corresponds to a binary memory zone.
string is filled with When using this type, you can share code handling the
- 0 if the variable is not assigned yet binary format between a WinDev application and a Win-
- spaces as needed if the variable is assigned (similar Dev Mobile application.
to the Basic "string" type). The buffer type manages no specific end marker and it is
Type not available in WinDev Mobile. used to store binary 0.
• Pascal string on:
String preceded by a byte that specifies the length Two types of variables are available:
(similar to Pascal). This byte is not accessible. For •Buffer:
example, String[1] represents the first character of the This type is used to handle a memory zone whose size
string and not its length. is dynamic: it is automatically adapted to the content
The length of a Pascal string cannot exceed 255 cha- of the buffer.
racters. The length given to the Pascal string must be •Buffer on:
equal to the length of the string. This type is used to handle a memory zone whose size
Type not available in WinDev Mobile. (in bytes) is defined during the compilation. This is an
• UNICODE string : advanced type used to perform specific operations in
String only containing Unicode format characters, that memory, to use some Windows APIs.
is, a string returned by the AnsiToUnicode function or
by one of the Unicode management functions.
Tome1_2.book Page 169 Vendredi, 28. mai 2010 5:50 17
169
2.1.10 The date type type enables you to easily manage conversions (Time-
ToString, TimeToInteger, …)
WD, WB s, The Date type can be used only in
WDMobile WinDev, in WebDev server code and in This type can be used:
WinDev Mobile. • to retrieve and handle the HyperFileSQL items in Time
format
The Date type enables you to easily handle the dates. • to retrieve and handle the edit controls in Time format
This type allows you to easily manage the conversions • in the WLanguage functions used to manage the times.
(StringToDate, DateToString, IntegerToDate, DateToIn-
• to perform calculations on times (difference, addition,
teger, …).
…).
This type can be used: Properties available for the times:
• to retrieve and handle the HyperFileSQL items in Date
See the online help to find out which properties can be
format. used with times.
• to retrieve and handle the Date edit controls. StartTime is Time="20011201"
• in the WLanguage functions used to manage the dates. // Adds 5 hours
• to perform calculations on dates. StartTime..Hour +=5
Note: Several properties can be used with the Date type, // Modifies the number of minutes
to recover only part of the date for instance. StartTime..Minutes=5
Default value Limits:
By default, a Date type variable is initialized with today’s The Time type can be used to manage the hours found
date (system date). To set the default value assigned to between 00:00 and 23:59. The precision is up to the mil-
Date type variables, use DateTimeByDefault. lisecond.
StartDate is date = 1205
EndDate is date = "20011231"
2.1.12 The DateTime type
170
Type of a variant
The Variant type is used to: You can get the type of a variant by using the Type pro-
• store any simple type variable: boolean, numeric, perty. Type enables you to find out the type of the value
string, date, time, ... stored in the variable.
• manage interaction with ActiveX objects and the OLE
automation programming Notes:
• handle the NULL value in WLanguage • VariantConvert lets you convert the type of the value
stored in a Variant type variable.
Assigning a Variant type • TypeVar lets you find out the type of a variable (Variant
A Variant variable can be assigned with type for a Variant variable)
• any literal value
171
• Case #1: Both parameters are provided: In this code, EditControl1 corresponds to the control
HExecuteQuery(CustomerLastNameFirst- where the user must enter the query parameter.
Name, … In this example, the table below describes the use of
hQueryDefault, "Smith", "John") "NULL if empty":
Value ente- "NULL if SQL code run
will run the query:
red in empty" for
SELECT * FROM CUSTOMER EditControl1 the
WHERE LASTNAME= ’Smith’ EditControl
AND FIRSTNAME = ’John’ 1 control
• Case #2: Only the last name is provided: No value Option SELECT ItemName
HExecuteQuery(CustomerLastNameFirst- checked FROM FileName
Name, …
No value Option SELECT ItemName
hQueryDefault, "Smith")
unchecked FROM FileName
will run the query: WHERE Item = ’’
SELECT * FROM CUSTOMER WHERE LAST- A value is Option SELECT ItemName
NAME=’Smith’ entered checked or FROM FileName
• Case #3: Only the first name is specified: unchecked WHERE Item= …
’ValueEntered’
sName is Variant = Null
// use of variant required
// for Null type variable
// (not specified)
HExecuteQuery(CustomerLastNameFirst-
Name, …
hQueryDefault, sName, "John")
Tome1_2.book Page 172 Vendredi, 28. mai 2010 5:50 17
172
2.3.2 Null and the variants 2.3.4 Null and the WLanguage functions
To specify that a Variant variable contains no value, use Some WLanguage functions accept Null as parameter to
the NULL constant. specify that the parameter takes no value.
Notes: Some examples:
• for a Variant type, NULL means "Not assigned"
TreeAdd, Null allows you to not display any image
• for a numeric type, NULL means "equal to 0" (see TreeInsert for the various levels of the added ele-
below) ments.
vVal is variant TreeListItem Null is used to list children from the tree
IF vVal = Null THEN ... root.
// returns True because the variant
// is not assigned
TreeModify Null is used to not modify the image
vVal = 0
defined using the TreeAdd function
IF vVal = Null THEN ... INIWrite Null is used to remove a keyword or a
// returns False because the variant section from the INI file
// is assigned
// with an integer whose value is 0 2.3.5 Null and the dynamic objects
vVal = 5
With dynamic objects (class, structure, array, automation
IF vVal = Null THEN ...
object, and so on), Null is used to find out whether the
// returns False because the variant
object is allocated or not.
is
// with an integer whose value is 5 For example:
// Declare a dynamic automation
2.3.3 Null and the numeric values // dynamic
Used with numeric values, Null enables you to compare a MyDynamicObject is …
value to 0. The equality operators and the comparison dynamic automation object
Part 3: Basic WLanguage syntax
2.4 Constants
END
WD, WB s, Constants can only be used in Win-
WDMobile Dev, in WebDev server code and in CONSTANT
WinDev Mobile. VATRate = 19.6
END
Constants are language elements whose value is set
once and for all. This value cannot be modified during the The constants must be declared in:
execution of the program. • the project initialization code to be used in all the pro-
cesses of the project (project code, window/page
code, control code, etc.)
Syntax: Declaring one or more constants • the global declaration code of a window/page to be
CONSTANT
used in all the processes of the window/page (win-
<Name of Constant 1> = <Value 1>
dow/page code, code of the controls found in the win-
<Name of Constant 2> = <Value 2>
Tome1_2.book Page 173 Vendredi, 28. mai 2010 5:50 17
173
174
Passing a "simple" array in parameter to a procedure A dynamic array is an "advanced" type of array: the
An array can be passed in parameter to a procedure. To dimension of the array are allocated on demand, in the
do so, use the following syntax: program. In most cases, a "simple" array is good
<Procedure Name>(<Array Name>) enough.
SuppArray is array of 10 … Reminder: An array is a structured type that is used to
by 50 strings group elements of the same type. Each array element can
// Call the procedure be directly accessed by its subscript.
// DisplayArray We advise you to use:
DisplayArray(SupplierArray)
• A dynamic array or a "simple" array when the size of
Dimension of a "simple" array the array must be modified in the program.
The Dimension function allows you to: • A fixed array for Windows APIs.
• find out the total number of elements in an array. • An associative array to store elements indexed on any
• resize an array. type of information.
Caution: The Dimension function does not allow you to Syntax
modify the number of dimensions in an array. Declaring a dynamic array
Elements of a "simple" array <Array Name> is array dynamic
An array can be made of classes only if these classes CustomerArray is dynamic array
have a constructor without parameters (or with optional
parameters). Allocating a dynamic array
<Name of Dynamic Array> =
An array cannot be made of:
new array dynamic of <Dimension 1>
• composite variables. [by <Dimension 2> ... [by <Dimension 10>]]
• arrays. <Type of Array Elements>
Declaring variables with the same name OR
Part 3: Basic WLanguage syntax
Several variables with the same name cannot be used in <Name of Dynamic Array> =
the same process (regardless of the type of these varia- new array dynamic of <Dimension 1>
bles). [,<Dimension 2> ... [,<Dimension 10>]]
If variables with the same name are declared in the diffe- <Type of Array Elements>
rent processes of the project, the rule for variable scope
applies. CustomerArray is dynamic array
CustomerArray = new array …
WLanguage functions and simple arrays dynamic of 4 by 7 int
Several WLanguage functions allow you to handle the // Equivalent to :
simple arrays. You have the ability to perform sorts, sear- CustomerArray = new array …
ches, ... See the online help for more details. dynamic of 4,7 int
Arrays in the classes
When copying instances of classes, all the members of Referencing a dynamic array
the class are copied into the new instance except for the To reference a dynamic array, this array must be alloca-
arrays. Therefore, if the value of an array member is modi- ted.
fied, this value is modified in all the instances. • Referencing an element in a one dimensional array:
To get independent arrays in all the instances of classes, <Array Name> [Subscript1]
a local array must be declared as follows: • Referencing an element in a two-dimensional array:
SystemClass is class <Array Name>[Subscript1, Subscript2]
aDefaultArray is array … OR
local 1 int <Array Name>[Subscript1][Subscript2]
END • Referring to an element in a n-dimensional array:
<Array Name>[Subscript1,…,SubscriptN]
2.5.2 Dynamic array OR
<Array Name>[Subscript1]…[SubscriptN]
WD, WB s, Dynamic arrays can be used only in • Passing an array as a parameter to a procedure: <Pro-
WDMobile WinDev, in WebDev server code and cedure Name>(<Array Name>)
in WinDev Mobile.
Tome1_2.book Page 175 Vendredi, 28. mai 2010 5:50 17
175
176
OR Struct is structure
<Array Name> is array fixed of
n1 is int
<Dimension 1> [,<Dimension 2> ...
nArray is fixed array of …
[,<Dimension 10>]] <Type of Array Elements> 2 int
CustomerArray is fixed array … n2 is int
of 5 by 7 by 3 int END
// Equivalent to : MyStructure is Struct
CustomerArray is fixed array …
of 5,7,3 int Representing the memory zone of "MyStructure":
177
Note: This type of array allows for fast access to any ele- Handling a composite variable
ment, with some options for strings, but it does not allow A composite variable can be used without referencing its
for sorting (especially no sorting on the key). members.
Syntax CompositeVar is composed of
Declaring an associative array Member1 is fixed string on 8
<Array Name> is array associative Member2 is fixed string on 12
of <Type> END
Str = CompositeVar // Str is built by
// concatenating all the members
// Fill an associative array with // of the composite variable
// the size of the files CompositeVar = Str
aaFileSize is array … // Str is transfered to
associative of int // composite
aaFileSize["File1.txt"] = …
fSize("File1.txt") Type of the members in a composite variable
aaFileSize["File2.txt"] =… The members of a composite variable can have the fol-
fSize("File2.txt") lowing types:
// Retrieves the size of a file • Integer (or selected among advanced integers).
Trace(aaFileSize(…
• Real (or selected among advanced real).
"File2.txt";])
• Currency.
Note: An advanced syntax is also available. See the • Fixed string, ASCIIZ string or Pascal string.
online help for more details (keyword: "Associative • Array ("simple" array, dynamic array or fixed array).
Array").
• Automation or Dynamic Automation.
2.5.5 Composite variable • Structure.
• Variant.
178
site variable.
this window/page and in the associated local procedu-
If variables with the same name are declared in the diffe- res.
rent processes of the project, the rule for variable scope
• in the opening code of a report, you will be able to
applies.
declare a <Structure Name> type variable in this
2.5.6 Structure report, in the controls of this reports and in the asso-
ciated local procedures.
WD, WB s, The structures can only be used in • in the class declaration code, you will be able to
WDMobile WinDev, in WebDev server code and declare a <Structure Name> type variable in this class
in WinDev Mobile. and in the methods of this class.
• in a process, you will be able to declare a <Structure
A structure is a custom type of data. A structure groups Name> type variable fin this process.
different types of elements.
Type of the structure members
Note: if you use custom variables, we recommend you The members of a structure can have the following types:
declare: • Integer (or selected among advanced integers).
• a structure type if several variables of this type are • Real (or selected among advanced real).
used in different processes of the project.
• Currency.
• a composite variable if a single variable of this type is
used in your project. • String (or selected among advanced strings).
• Array ("simple" array, dynamic array or fixed array).
Syntax • Automation or Dynamic Automation.
Declaring a structure • object (class instantiation). The class can have a cons-
<Structure Name> is structure tructor without parameters (or with optional parame-
<Structure Members> ters).
END • Variant.
ProductRef is structure
SCode is int All the other types of data (composite variable, constant,
PdtCode is fixed string on 10 and so on) are forbidden.
END
Tome1_2.book Page 179 Vendredi, 28. mai 2010 5:50 17
179
Which "advanced" types can be a member? To instantiate a structure, you need to:
An "advanced" variable can be a member of another 1. declare a dynamic structure
"advanced" variable. 2. instantiate a structure
Note: the structure is automatically freed when it is not
180
The important parameters of this syntax are as follows: Allocating an automation object
When allocating an automation object, the automation
<VariableName> server is automatically started.
Name identifying the variable of the structure. To allocate an automation object with an existing ins-
<StructureName> tance of an automation server, use GetActiveObject.
Name identifying the structure, defined when creating Passing parameters to a method
the structure The methods of automation servers can accept one or
<Parameters> more parameters.
Optional parameters of the constructor. When calling a method, the parameter sequence must be
respected (see the server documentation for more
Freeing a dynamic structure details).
Delete <Structure Name> With some automation servers, some method parame-
ters are not valued: only the presence of the parameter is
The important parameters of this syntax are as follows: important, not its value.
<StructureName> For instance, the "EditReplace" method of Word Basic
accepts 10 parameters, the last one (ReplaceAll) being
Name identifying the instance of the structure. not valued.
2.5.8 Automation object In WLanguage, any ordinary value can be passed to non-
valued parameters.
WD Automation objects can be used only The methods of some automation servers can accept
in WinDev. optional parameters located anywhere in the list of para-
meters.
Automation is used to declare an automation object. This In WLanguage, the optional parameters must necessarily
object is allocated during the declaration. be found after the mandatory parameters.
Part 3: Basic WLanguage syntax
Note: you can also use a dynamic automation object. It is To give any ordinary value to an optional parameter,
allocated upon request, in the program. assign the * character to the optional parameter. On the
Syntax contrary, this character will not be required for the optio-
nal parameters found after the last mandatory parame-
Declaring an automation object ter.
<Name of Automation Object> is object automa-
tion <Name of Automation Server> Declaring variables with the same name
MyAutomationObject … Several variables with the same name cannot be used in
is automation object MyServer the same process (regardless of the type of these varia-
bles).
Calling a method of automation object If variables with the same name are declared in the diffe-
<Name of Automation Object>>><Method rent processes of the project, the rule for variable scope
Name>([<Parameters>]) applies.
Note: The list of methods that can be used depends on
the server. See the documentation about the server for 2.5.9 Dynamic Automation object
more details.
MyAutomationObject>>…
WD Dynamic automation objects can be
used only in WinDev.
OpenFile(DocName)
181
Allocating a dynamic automation object • The methods of some automation servers can accept
<Name of Dynamic Automation Object> = new dyna- optional parameters located anywhere in the list of
mic automation object <Name of Automation Ser- parameters.
ver> In WLanguage, the optional parameters must necessa-
// Create an automation object rily be found after the mandatory parameters.
// dynamic To give any ordinary value to an optional parameter,
MyDynamicObject = new … assign the * character to the optional parameter. On
dynamic automation object MyServer the contrary, this character will not be required for the
optional parameters found after the last mandatory
Call a method of a dynamic automation object parameter.
<Name of Dynamic Automation Object>>><Method
Name>([<Parameters>]) Declaring variables with the same name
MyDynamicObject>>…
Several variables with the same name cannot be used in
OpenFile(DocName)
the same process (regardless of the type of these varia-
bles).
Note: The list of methods that can be used depends on If variables with the same name are declared in different
the automation server. See the documentation about the processes of the project, the rule for variable scope
server for more details. applies.
Lifespan of a dynamic automation object 2.5.10 Data source
The dynamic automation object is created when alloca-
ting the object. WD, WB s, Data source type variables can be
The dynamic automation object is automatically des- WDMobile used only in WinDev, in WebDev server
troyed at the end of the process containing its declara- code and in WinDev Mobile.
tion or when a new allocation is performed on the object.
A dynamic automation object declared as "global" in the A Data source variable is used to describe a temporary
following code: data source (query, view, alias, …). All the operations
182
183
184
HyperFileSQL properties.
Syntax
•validate the description of each item (HDescri-
beItem). Declaring an item description
<Variable Name> is
•validate the description of the file (HDescribeFile). item
3. Describe, if needed, the characteristics of the
links via the HyperFileSQL properties. Declaring several item descriptions
4. Validate (if necessary) the description of each link <Name of Variable 1>, <Name of Variable 2> are
(HDescribeLink). item descriptions
Handling the links of a temporary file MyItem …
When a link is created in the data model editor, the name is item description
of the link is automatically recognized by the compiler. MyItem1, MyItem2 are
item descriptions
When creating a temporary link with a "Link Description"
variable, the name of this link is defined with the Name Describing an "Item description" variable
property. This name is not automatically recognized by
To describe an "Item Description" variable, use the
the compiler. Using this name to designate the temporary
WLanguage properties specific to item descriptions.
link generates a compiler error.
To validate the description of an "Item description" type
In order for the name of the temporary link to be recogni-
variable, use HDescribeItem.
zed by the compiler, this link name must be declared with
the Extern keyword. You will then be able to use the tem- // Describe the MyFile file
porary link name in the code editor. …
// Describe the "NAME" item
MyLink is …
MyItem..Name = "NAME"
link description
MyItm..Type = hItemText
…
MyItem..Size = 40
MyLink..Name = "LIVES"
MyItem..KeyType = hUniqueKey
…
Part 3: Basic WLanguage syntax
// Validate description
HDescribeLink("LIVE")
// "NAME" item
…
HDescribeItem(MyFile, …
EXTERN LIVES
MyItem)
…
// Validate file description
Cardinality = …
// MyFile …
LIVE..MaxLinkedCardinality
Properties specific to the description of items
Declaring variables with the same name The properties specific to item descriptions are detailed
Several variables with the same name cannot be used in in the online help.
the same process (regardless of the type of these varia-
bles). How to describe temporary files?
To describe temporary files, you must:
If variables with the same name are declared in different 1. Declare "File description", "Item description"
processes of the project, the rule for variable scope
and "Link description" variables (if necessary).
applies.
2. For each file:
2.5.13 Item description •describe the characteristics of the file using the
HyperFileSQL properties.
WD, WB s, Item description type variables can be •describe the characteristics of the items using the
WDMobile used only in WinDev, in WebDev ser- HyperFileSQL properties.
ver code and in WinDev Mobile. •validate the description of each item (HDescri-
beItem).
An Item description variable is used to describe one or
•validate the description of the file (HDescribeFile).
more items of a temporary data file. The description of
3. Describe, if needed, the characteristics of the
each item is validated by >HDescribeItem.
links via the HyperFileSQL properties.
After this validation: 4. Validate (if necessary) the description of each link
• this item can be handled like any other item described (HDescribeLink).
in the analysis. Handling the items of a temporary file
• the "Item Description" variable is reinitialized and it When a file is created in the data model editor, the
can be used to describe another item of a temporary names of the file and items are automatically recognized
data file. by the compiler.
Tome1_2.book Page 185 Vendredi, 28. mai 2010 5:50 17
185
When creating a temporary file with a "File Description" Declaring several fonts
variable, the name of the temporary file and its items are <Name of Variable 1>, <Name of Variable 2> are
defined with the Name property. These names are not fonts
automatically recognized by the compiler. A compilation MyFont is font
error occurs if these names are used to define the tempo- MyFont1, MyFont2 are fonts
rary file or its items.
In order for the name of the temporary file and its items to Defining the characteristics of a font
be recognized by the compiler, the name of this tempo- The default font is "Arial", 12, black, no attribute.
rary file must be declared as a data source. This tempo- To define the characteristics of a dynamic font, use:
rary file and its items can then be handled by their name • the FontCreate function.
in the code editor.
• the Charset, Angle, Strikeout, Condensed, Color,
MyFile …
Extended, Bold, Italic, Large, Name, Underlined and
is file description
Size properties.
…
MyFile..Name = "CUSTOMER" • the FontSelect function, which opens the standard
… Windows font selection dialog box.
HDescribeFile("CUSTOMER") MyFont = …
… FontCreate("Arial",12, iBold)
CUSTOMER is data source MyFont..Name = "Arial"
… MyFont..Size = 12
HReadFirst(CUSTOMER, CUSTOMER.CUST- MyFont..Bold = True
NAME)
Declaring variables with the same name
Note: you can also declare the name of the temporary file Several variables with the same name cannot be used in
using Extern. However, the execution speed of the pro- the same process (regardless of the type of these varia-
cess will be slower. bles).
186
Defining the characteristics of a connection WLanguage properties that can be used with the Queue
To describe a "Connection" type variable, use the WLan- type
guage properties specific to connections.
Name of the pro- Effect
// Describe the connection
perty
MyCtion..User = "USER"
MyCtion..Password = "PASSWORD" AdditionCompleted Returns and modifies the addi-
MyCtion..Server = "MYSERVER" tion mode of the elements.
MyCtion..Database = "Database1" This property is used for mul-
MyCtion..Provider = … tithread management
hAccessHFClientServer
MyCtion..Access = hOReadWrite NbPendingThread Returns the number of pending
myCtion..ExtendedInfo = "Info" threads.
MyCtion..CursorOptions=hClientCursor This property is used for mul-
HOpenConnection(MyConnection) tithread management
Declaring variables with the same name Occurrence Returns the number of occurren-
Several variables with the same name cannot be used in ces of the queue
the same process (regardless of the type of these varia- Empty True if the child is empty, False
bles). otherwise
If variables with the same name are declared in different Note: These properties can be used with the following
processes of the project, the rule for variable scope
syntax:
applies.
•<Variable Name>..<Property Name>
2.5.16 Queue • <Variable Name>.<Property Name>
A queue is a structured type that is used to group a set of WLanguage functions for managing the queues
elements of the same type. The elements are added at
Part 3: Basic WLanguage syntax
187
The syntax used corresponds to the one used for the WLanguage functions for list management
arrays : The following functions can be used to handle a List
FOR EACH [ELEMENT] <Variable> … variable.
[, <Counter> [, <Counter>]] …
OF <Queue> Add Adds an element at the
... end of the list.
END Deserialize Deserializes a list.
The elements can be modified during the browse opera- Insert Inserts an element into a
tion. If the queue is modified during a browse operation, list.
the elements browsed will be the ones found when the
browse operationwas initialized: Serialize Serializes a list.
•the elements enqueued after the initialization of the Delete Deletes an element from
browse operation will not be browsed. the list
•the elements dequeued after the initialization of the DeleteAll Deletes all the elements
browse operation will still be browsed. from the list.
Notes Lists and multithreading.
•In the debugger, the content of the queue is dis- The multithread management is taken into account when
played in dequeue order. adding, inserting and deleting an element.
•A queue can be used to type a procedure parameter. • You also have the ability to use properties during mul-
•A queue can be copied with the operator =. You also tithread management but the result is not permanent.
have the ability to copy an instance of class or struc-
ture containing a queue.
•A queue can be initialized by a list of elements in
enqueue order. For example:
188
tions).
x is int
WHILE Pop(MyStack, x) You also have the ability to use properties during mul-
Trace(x) tithread management but the result is not permanent. For
END example:
IF MyStack..Occurrence>0 THEN
WLanguage properties that can be used with the Stack // When the thread arrives here, …
type the stack may be empty
The following properties can be used to handle a Stack END
variable.
Browsing through stacks:
Name of the property Effect The FOR EACH syntax can be used to browse through
AdditionCompleted Returns and modifies the stacks. The elements are browsed in pop order, that is
addition mode of the ele- the reverse order of the push order.
ments. The syntax used corresponds to the one used for the
This property is used for arrays:
the multithread manage- FOR EACH [ELEMENT] <Variable> …
ment [, <Counter> [, <Counter>]] …
OF <Stack>
NbPendingThread Returns the number of ...
pending threads. END
This property is used for
the multithread manage- The elements can be modified during the browse opera-
ment tion. If the stack is modified during a browse operation,
the elements browsed will be the ones found when the
Occurrence Returns the number of browse operation was initialized:
occurrences of the
stacks. •the elements pushed after the initialization of the
browse operation will not be browsed.
•the elements popped after the initialization of the
Tome1_2.book Page 189 Vendredi, 28. mai 2010 5:50 17
189
190
The rule for variable scope is as follows: • If a variable "global" to a window/page and a variable
• If a variable "global" to the project and a variable "local" to a process of this window/page have the
"global" to a window/page have the same name: same name:
- the variable "global" to the window/page will be - the "local" variable will be used in the process where
used in all the other processes of the window/page is was declared.
and its controls, including the "local" procedures of - the variable "global" to the window/page will be
the window/page. used in all the other processes of the window/page
- the variable "global" to the project will be used in all and its controls (including the "local" procedures of
the other processes. the window/page).
• If a variable "global" to the project and a variable - none of these variables will be used in the rest of the
"local" to a process have the same name: project.
- the "local" variable will be used in the process where Exception: The rule for variable scope does not apply to
is was declared. constants.
- the variable "global" to the project will be used in all
the other processes.
Tome1_2.book Page 191 Vendredi, 28. mai 2010 5:50 17
191
3. OPERATORS
3.1 Overview
The different operators are as follows: • Character string operators: Examples: "+", "[[" and
• Logical operators: Examples: AND, OR, NOT "]]"
• Arithmetic operators: Examples: "+", "-", "*", "/", • Operator on address: &
"++", "--", "+=", "-=" • Operators for control and item indirection: { and }
• Binary operators: Examples: BinaryAND, BinaryOR, • Punctuation operators: Examples: "(" and ")", "["
BinaryNOT and BinaryXOR and "]", "," and "." and ":" and ";", "..", "…" and
• Comparison operators: Examples: "=", "~=", "<>", "//"
"<=", ">=", "<", ">", "~~"
3.2.3 Notes
Numeric variable
If a numeric variable is handled as a logical operator
(boolean), "0" is equivalent to False. Any other value is
equivalent to True.
Tome1_2.book Page 192 Vendredi, 28. mai 2010 5:50 17
192
193
194
195
FOR I = 1 TO 5 Example:
IF "B"<MyArray[I]<="M" THEN // Declare the structures
Trace(MyArray[1]) O is ST1
// Displays Dupond and Foolamour P is ST2
END // Declaration and instantiation
END // of dynamic structures
P1 is structure ST1 dynamic
Comparing instances of structures and instances of
P1 = O
classes
P2 is structure ST2 dynamic
The dynamic structures are instantiated when they are P2 = O
allocated. // Comparison
The "=" operator enables you to compare instances of IF P1 = P2 THEN …
dynamic structures (or instances of dynamic classes).
The same operation can be performed on the instances
of classes.
196
Caution: Be careful when you use the [[ and ]] operators occur at run time.
in procedures that handle character strings. You may
modify your character strings without being aware of it. "[[" and "]]" operator
For example, the following procedure could modify part All the syntaxes of the [[ ]] operator are available for UNI-
of the string. CODE strings.
Procedure P(sString) If the string passed in parameter is in ANSI format, the
IF sString then sString="5" result returned by the [[ ]] operator will be in ANSI format.
//Call to the procedure via the fol- If the string passed in parameter is in UNICODE format,
lowing code line : the result returned by the [[ ]] operator will be in UNI-
// p(sVar[[3 to]]) CODE format.
The position parameters and the length parameters are
To avoid modifying the initial string, the parameter must expressed in number of characters.
be passed by value
Note: No compilation error occurs if the result of the [[ ]]
• by using brackets around the parameter in the call to operator on an ANSI string is assigned to a Unicode string
the procedure (and conversely). However, a WLanguage error will occur
• by using the Local keyword in the procedure’s header at run time.
3.6.3 Operators on character strings and UNI- 3.6.4 Position in a character string
CODE The position of the first character is set to 1 (and not to
The available operators are as follows: 0).
•"+": To concatenate strings. Position returns the start position of a given character
•" [[ " and "]]" (double opening square brackets and string inside another character string.
double closing square brackets): substring extraction
operator. 3.6.5 WLanguage functions
The character strings can also be handled by the func-
"+" operator
Part 3: Basic WLanguage syntax
tions:
Two UNICODE strings can be concatenated. A UNICODE
• Right.
string and an ANSI string cannot be concatenated.
• Left.
Note: no compilation error will be triggered if the conca-
tenation of two ANSI strings is assigned to a UNICODE • Middle.
string (and vice versa). However, a WLanguage error will
197
• The & operator displays an error message then when • If the variable is a local variable, the value returned by
compiling the project. Indeed, the addresses of these the & operator must only be used in the process where
two elements may change at any time. the variable was declared.
• If a "Character string" must be passed by address to • Once the current process is completed, the address
CallDLL32, you must not use a String variable: the will be invalid and it must not be used anymore.
string’s address may change at any time. We recom-
mend that you use the ASCIIZ String type.
198
<Type>: Constant used to specify the type of the element When should I use the indirection?
sought: The indirection can be used for instance:
IndControl Element sought among the controls • To access the value of an element (control, variable,
indConnection Element sought among the connec- item …)
tions {s_ControlName} = 10
ControlValue = {s_ControlName}
indReport Element sought among the reports
• to use a property
indWindow Element sought among the windows {s_ControlName}..Height = 10
indFile Element sought among the files
Note: to designate the current object, use the following
indGPW Element sought among the elements keywords:
of the user groupware •Myself: the current control
indLink Element sought among the links •MyWindow: the current window
indPage Element sought among the pages •MyPage: the current page
•MyReport: the current report
indQueryPara- Element sought among the parame-
meter ters of queries •MySource: the current data source
•MyFile: the file that triggered the current trigger.
IndItem Element sought among the items
IndVariable Element sought among the variables
The miscellaneous operators group the following opera- • Element of an array defined in WLanguage. Example:
tors: MyArray is array of 5 strings
• "(" and ")": The parentheses MyArray [1] = "Smith"
• "[" and "]": The brackets • Window control (combo box, list box, array, radio but-
• ",": The comma ton, check box). Examples:
• ".": The period •combo: MyCombo[1] = "Boston"
• ":": The colon •check box: checkbox[1] = True
• ";": The semicolon
• "..": The double dot
3.9.3 The comma
• "…": The triple dot The comma is used to separate:
• "//": The double bar • different declarations of variables of the same type
performed on the same line. For example:
3.9.1 The brackets MyExample1, MyExample2 …
are strings
The brackets are used to:
• group the different elements of an operation while spe- • The different parameters of a WLanguage function. For
cifying the priority order. For example: example:
dCopyBlt(Image1, image2)
If (A-B)*5 THEN ….
• Specify the different parameters of a WLanguage func- 3.9.4 The semicolon
tion. For example:
The semicolon is used to separate the different state-
dCopyBlt(Image1, image2)
ments written on the same line. For example:
I is int;MString is string
3.9.2 The square brackets
The square brackets are indexing operators. They are 3.9.5 Colon
used to identify the indexed objects.
The colon is used to access the members and methods of
Some examples: the objects.
• Element of an Array type HyperFileSQL item. Example: A double colon is used to access the global members
Customer.Address[1] and the global methods of a class.
Tome1_2.book Page 199 Vendredi, 28. mai 2010 5:50 17
199
3.9.6 The dot The "…" operator must necessarily be used at the end of
The dot is used to access a sub-element. Some exam- a line (and not in the middle of a line).
ples: No character must be found after the "…" operator
• access a window/page control: MyWindow.DateEdit- (apart from comments).
Control Starting with version 12, the "…" operator is not requi-
• access a global variable of a window/page: MyWin- red anymore to continue on the next line:
dow.gDuration • the parameters of functions or procedures
• Access a file item: Customer.Name • the right operands for the arithmetic and logical opera-
• access to a table column: Table.Column1 tors.
// Arithmetic operators
3.9.7 The double dot // (+, -, /, *) and logical (AND, OR)
n is int = 5 +
The double dot is used to access a property of a control,
6
window, report, file, item or variable. Some examples:
Scrollbar..MaxValue = 200
3.9.9 The double slash
ShippingCost..Title = …
"Window for entering the shipping The double slash is used to comment out the text that fol-
cost" lows this sign. This text will be ignored when the code is
MyReport..BottomMargin = 20 compiled and when the project is run.
MyFont .. Name = "Arial" For example:
// Performs a search in
3.9.8 Triple dot // a string
The "…" operator (triple dot) is used to continue a logical // Declaration
line over the next physical line. For example: MyString is string = …
IF (FamilyCode="LV") AND … "WinDev is great"
// Test
200
4. WLANGUAGE STATEMENTS
4.1 Composite statements
Several types of composite statements are available in END
WLanguage: Code to run
• Conditional statements The code to run is located between the LOOP and END
•SWITCH: Runs an action or another one according statements.
to an expression
Exiting from a loop
•IF: Selects the action to perform according to a
condition Several statements are available:
• Loop statements • RETURN: Exit from the loop and exit from the current
process (or procedure).
•LOOP: The statement block is repeated endlessly
• RESULT: Returns a status code to the calling process.
•FOR: The statement block is repeated until a limit Exit from the loop and exit from the current process (or
value procedure).
•FOR EACH: HyperFileSQL browse (full browse, • BREAK: Exits the loop and resumes the current pro-
browse with search, browse with filter) cess.
•WHILE: The statement block is repeated according
to a condition The Close function lets you exit the loop and close de cur-
• Branch Statement: GOTO: Branches to a given label rent window.
Caution: RETURN and RESULT cannot be used in the
4.1.1 LOOP statement
Part 3: Basic WLanguage syntax
same process.
The statement block is repeated endlessly. The number of Running the next iteration
iterations in the statement block is not checked, there is
no expression to evaluate. To directly run the next iteration without ending the code
of the current iteration, use the Continue statement:
LOOP
LOOP
//read a line from a text file
…
ALine = fReadLine(FileNum)
IF <Condition> THEN CONTINUE
IF ALine = EOT THEN BREAK
// Return to the LOOP keyword
ProcessLine(ALine)
…
END
END
Syntax
Loop without end
• Syntax 1: Loop with exit based on an "IF" condition
LOOP During the project’s compilation, an endless loop (loop
…
without BREAK, RETURN or RESULT statement) is signa-
led by a warning.
IF <Condition> THEN BREAK
… 4.1.2 GOTO statement
END
• Syntax 2: Loop with exit based on an "WHILE" condi- WD, WB s, The GOTO command can only be used
tion WDMobile in WinDev, in WebDev server code and
LOOP in WinDev Mobile.
…
DO WHILE <Condition> The GOTO statement is used to run a code identified by a
given label.
• Syntax 3: Loop with exit based on the number of itera-
tions
LOOP (<Number of Iterations>)
…
Tome1_2.book Page 201 Vendredi, 28. mai 2010 5:50 17
201
4.1.3 FOR statement 4.1.4 FOR EACH/FOR ALL statement, file brow-
sing
The statement block is repeated while a control variable
is modified and compared to a limit value (before each WD, WB s, The FOR EACH/FOR ALL command
beginning of the statement block). WDMobile can only be used in WinDev, in Web-
The statement block is run for each one of the values suc- Dev server code and in WinDev
cessively taken by the control variable. The initial value is Mobile.
assigned to the control variable during the first entry in
the FOR statement. FOR EACH is used to perform different types of HyperFi-
FOR Subscript = 1 TO 10 leSQL browse operations:
Array[Subscript] = MyVariable + 10 •full browse,
END •full browse based on a specified key,
Tome1_2.book Page 202 Vendredi, 28. mai 2010 5:50 17
202
203
For example:
// Comparing to a "CustomerName > ’Smith’ and …
// value ZipCode = 34101 or CustomerAge >=
FOR EACH Customer WITH … 32"
CustomerName = "Smith"
// Add the customers to the list The supported operators depend on the type of the items
ListAdd(CustomerList,… used in the condition:
Customer.CustomerLastName)
END <\> Different Valid for all the types
// Comparing to a > Greater than Valid for all the types
// value
FOR EACH Order WITH … >= Greater than or Valid for all the types
OrderDate <= "12/31/2003" equal to
// Add the orders to the list < Less than Valid for all the types
ListAdd(OrderList, …
ORDERS.OrderNumber)
<= Less than or equal Valid for all the types
END
to
= Strictly equal to Valid for all the types
// Comparison with a list
~= Almost equal to Valid for the "string" types
// of values
only
FOR EACH Order WITH …
OrderDate = … ] Contains Valid for the "string" types
"01/01/2003" TO "12/31/2003" only
// Add the orders to the list
]= Starts with Valid for the "string" types
ListAdd(OrderList,…
only
ORDERS.OrderNumber)
204
…
IF <Condition> THEN CONTINUE Parsing the occurrences of a string inside another string
// Return to the FOR EACH keyword
1. Without any option
// Go to next record FOR EACH POSITION <Position> OF <Sought>…
…
IN <Initial String> [<Direction>]
END
…
END
4.1.5 FOR EACH /FOR ALL statement, parsing
strings // The "C:Exports.TXT" file
// contains the list of products
WD, WB s, The FOR EACH/FOR ALL command
// exported, separated by ";"
WDMobile can only be used in WinDev, in Web- // Retrieve each product
Dev server code and in WinDev
Mobile. ExportedProduct is string
ExportedProduct = fLoadText(…
"C:\Exports.TXT")
The FOR EACH statement is used to perform different
OldPosition is int
types of parsing on strings:
CurrentPosition is int
•parsing substrings separated by a separator. // For each product
•Parsing the occurrences of a string inside another FOR EACH POSITION CurrentPosition …
one OF ";" <strongIN ExportedProduct
// Add the product to the
Note: Both the FOR EACH and FOR ALL statements are // ProductList list
accepted. In this documentation, we will be using the ListAdd(ProductList, …
FOR EACH statement but it can be replaced by FOR ALL.
ExportedProduct[[OldPosition + 1 TO
Syntax …
Parsing substrings separated by a separator CurrentPosition - 1]]
FOR EACH STRING <Substring> OF … // Store the position
<Initial String> … OldPosition = CurrentPosition
END
[SEPARATED BY <Separator>] [<Direction>]
…
END
Tome1_2.book Page 205 Vendredi, 28. mai 2010 5:50 17
205
206
This syntax is used to browse all the selected rows found // Read the element of an array
in a list box, table or looper. // of reals to calculate the sum
For each row read, the <Subscript> variable returns the // Fill the array
subscript of the selected row. ArrCalc is array of 3 reals
To access a specific column’s value, use the ArrCalc[1] = 12.5
<Column>[<Subscript>] syntax ArrCalc[2] = 10
ArrCalc[3] = 7.5
The table’s current row is always changing during the
// Calculate the sum
browse operation.
AnElement is real
The behavior is undefined if the number of control ele- TotalSum is real
ments is modified during the browse. FOR EACH ELEMENTAnElement OF …
Browsing the table rows CalcArray
When browsing through the table rows: TotalSum += An Element
• the display of this table is locked. The MultitaskRedraw END
function is ignored.
• the selected rows and/or the current row must not be For each iteration, <Variable> directly refers to the cur-
modified (TableSelectMinus, TableSelectPlus, etc.) rent element in the array. If the value of <Variable> is
modified, the current element in the array is modified.
• for a browsing table, in the browse loop, the current
record is the record processed by the browse opera- When exiting from the loop (standard exit or via the EXIT
tion. statement), the value of the last element read is assi-
gned to <Variable> but <Variable> does not directly refer
4.1.7 FOR EACH/FOR ALL statement, array to the array element anymore.
browsing All types of arrays are available: automatic, fixed, dyna-
mic.
WD, WB s, The FOR EACH/FOR ALL command The arrays can have several dimensions.
Part 3: Basic WLanguage syntax
WDMobile can only be used in WinDev, in Web- The behavior is undefined if the number of elements is
Dev server code and in WinDev modified in the browse loop.
Mobile.
Browsing through the values of an array elements
The FOR EACH statement is used to perform different FOR EACH ELEMENT (<Value>) OF
types of browse operations on the arrays: <Array> [<Direction>]
•Browsing the array elements. …
•Browsing the values of the array elements. END
Note: Both the FOR EACH and FOR ALL statements are For each iteration, the value of the element browsed is
accepted. In this documentation, we will be using the assigned to the <Value> variable. If the value of <Value>
FOR EACH statement but it can be replaced by FOR ALL. is modified, the current element in the array is not modi-
fied.
Syntax All types of arrays are available: automatic, fixed, dyna-
Browsing through the elements of an array mic.
FOR EACH ELEMENT <Variable> OF … The arrays can have several dimensions.
<Array> [<Direction>]
The behavior is undefined if the number of elements is
…
modified in the browse loop.
END
Tome1_2.book Page 207 Vendredi, 28. mai 2010 5:50 17
207
208
This syntax is useful when browsing associative arrays Case <Min Expression> <= * < <Max Expression>
with duplicates. In an associative array without duplica- :
tes, the number of elements browsed can be 0 or 1. In an <Action20>
associative array with duplicates, the number of ele- Case <Min Expression> < * < <Max Expression> :
ments browsed can be 0 or N. <Action21>
The array elements are browsed in the order they were …
added (no direction option). [ CASE ELSE: <Action Case Else>
When exiting from the loop (standard exit or via the EXIT OR
statement), the value of the last element read is assi- OTHER CASE :
gned to <Variable> but <Variable> does not directly refer <Action Other Case>
to the array element anymore. OR
OTHER CASE
4.1.9 SWITCH statement <Action Case Else> ]
The SWITCH conditional statement is used to choose the END
action that will be run according to the value of an OTHER CASE keyword
expression.
OTHER CASE must be the last statement used in SWITCH.
SWITCH Quantity
CASE 1: Comment = "Promotions"
BREAK SWITCH statement
CASE 2: Comment = "Buy"+… The BREAK SWITCH instruction enables you to exit a
"two"+… SWITCH statement and to resume the current process.
"the second one is free"
OTHER CASE: Comment = "" 4.1.10 IF statement
END The IF conditional statement allows you to choose the
action to run according to a condition.
Syntax IF CustomerAge > 60 THEN
SWITCH <Comparison Variable>
Part 3: Basic WLanguage syntax
Elderly += 1
Case <Expression1> : <Action1>
ELSE IF Customer.Age > 18 THEN
Case <Expression2> :
Adult += 1
<Action2.1> ELSE IF Customer.Age > 4 THEN
<Action2.2> Child += 1
Case <Expression3> ELSE Baby += 1
<Action3> END
Case <Expression4>, <Expression5> : <Action4>
Case <Expression6>, <Expression7> :
<Action5>
Syntax
Case <Expression8>, <Expression9> • Syntax 1
IF <Condition> THEN
<Action6>
<Action if condition is True>
Case <Min Expression> TO : <Action7>
[ELSE
Case TO <Max Expression> : <Action8>
<Action if condition is False> ]
Case <Min Expression> TO <Max Expression> :
END
<Action9>
Case = <Expression> : <Action10> • Syntax 2
Case ~ = <Expression> : <Action11> IF <Condition> THEN
Case ~~ <Expression> : <Action12> <Action if condition is True>
Case [= <Expression> : <Action13> [ELSE <Action if condition False> ]
Case > <Expression> : <Action14>
Case >= <Expression> : <Action15> • Syntax 3
Case < <Expression> : <Action16> IF <Condition> THEN <Action if condition True>
Case <= <Expression> : <Action17> [ELSE
Case <Min Expression> <= * <= <Max Expression> <Action if condition is False> ]
: END
<Action18> • Syntax 4
Case <Min Expression> < * <= <Max Expression> IF <Condition> THEN <Action if condition True>
: [ELSE <Action if condition False>]
<Action19>
Tome1_2.book Page 209 Vendredi, 28. mai 2010 5:50 17
209
• Syntax 5 dition (A > 10) is False, the second condition (B < 20) will
IF <Condition 1> THEN not be evaluated.
<Action if condition 1 is True>
[ELSE IF <Condition 2> THEN ELSE without IF
<Action if condition 2 is True> ELSE cannot be used without the corresponding IF state-
[ELSE IF <Condition 3> THEN ment.
<Action if condition 3 is True>
[…]]]
4.1.11 WHILE statement
END In a WHILE statement, the expression is evaluated at
each beginning of the block of statements.
Condition The process loops as long as the condition expression is
<Condition> may take the following format : True. The program will exit from the block of statements
•<Value> = <Expression> when the condition is False.
List = INIRead("Examples",…
•<Value> < <Expression>
"","",IniFile)
•<Value> <= <Expression> KeyWord = ExtractString(List,Num,CR)
•<Value> > <Expression> WHILE Keyword <> ""
•<Value> >= <Expression> Num = Num + 1
•<Value> = <Min Expression> TO <Max Expression> ExplName = INIRead(…
"Projects installed",…
•<Min Expression> <= <Value> <= <Max Expression>
Keyword,"",IniFile)
•<Value> IN (<Expression 1>, <Expression 2>, ... , Keyword = ExtractString(List,…
<Expression N>) Nb+1,CR)
Note: in this case, all the expressions are checked. END
•<Value> _IN_ (<Expression 1>, <Expression 2>, ... ,
<Expression N>) Syntax
210
211
212
213
5. RESERVED WORDS
Several WLanguage words are keywords, used to perform
specific actions:
• Extern • MyWindow
• MyPage • MySource
• Modulo • MySelf
• MyPopupControl • MyReport
• MyFile • MyParent
• STOP
5.1 External
Including constants
WD, WB s, The EXTERN keyword can only be used
WDMobile in WinDev, in WebDev server code Using include files is very useful to describe constants
and in WinDev Mobile. common to several projects or used by the operating sys-
tem. EXTERN allows you to include a file containing com-
The EXTERN keyword is used to: mon constants in the code.
• include a text file containing WLanguage commands in Several files defining constants are provided with Win-
an application (see use 1). Dev/WebDev:
214
Syntax
EXTERN <Name of External Object>
<Name of External Object> corresponds to the name of
the external object (file, variable, constant, etc.) to
declare.
5.2 MyWindow
• Using the Title property
WD, The MyWindow keyword can only be
MyWindow..Title = …
WDMobile used in WinDev and in WinDev Mobile. "Enter your data"
CurrentTitle = MyWindow..Title
MyWindow is used to handle the current window. When
the window is run, MyWindow is replaced by the window • Pass in parameter:
(and not by the name of the window. MyWindow is used CallProcedure(MyWindow)
like a window then. MyWindow can only be used in the processes associated
Benefit: MyWindow enables you to write local code (con- with the current window (processes associated with a
trol, button, etc.) or global code (global procedure, class, window or a control for instance). MyWindow cannot be
etc.) that is independent from the current window. used in a report.
// Retrieve the title of the current
// window Using MyWindow in a procedure
WindowTitle = MyWindow..Title MyWindow can be used in a (local or global) procedure
only if the procedure uses the current window. MyWindow
Syntax refers to the current window then.
MyWindow
For a local procedure, MyWindow corresponds to the win-
Part 3: Basic WLanguage syntax
5.3 MyPage
• Using the Title property
WB s The MyPage keyword can only be used in
WebDev server code. MyPage..Title = …
"Enter your data"
CurrentTitle = MyPage..Title
MyPage is used to handle the current page. When the
page is run, MyPage is replaced by the page and not by • Pass in parameter:
the name of the page. MyPage is used like a page then. CallProcedure(MyPage)
Benefit: MyPage enables you to write local code (control,
button, etc.) or global code (global procedure, class, MyPage can only be used in the processes associated
etc.) that is independent from the current page. with the current page (processes associated with a con-
trol or a page for instance). MyPage cannot be used in a
// Retrieve the title of the
report.
// current page
PageTitle = MyPage..Title Using MyPage in a procedure
Syntax MyPage can be used in a (local or global) procedure only
MyPage if the procedure handles the current page. MyPage refers
to the current page then.
Handling the current page
For a local procedure, MyPage corresponds to the page
MyPage is always replaced by the current page. For to which the procedure belongs.
example:
Tome1_2.book Page 215 Vendredi, 28. mai 2010 5:50 17
215
5.4 MySource
• Retrieve the name of the data source to perform a
WD, WB s, The MySource keyword can only be HyperFileSQL process.
WDMobile used in WinDev, in WebDev server // Retrieve the name of the data
code and in WinDev Mobile.
// source for the report
DataSource = MySource..Name
MySource is used to handle the current data source (file,
view or query). When the project is run, this keyword is
// Retrieve the name of the customer
automatically replaced by the current data source.
// currently printed
Benefit: MySource enables you to: IF MySource.CustName = "Martin" THEN
• make the code independent of the current data source. TotalBT..BrushColor = iLightRed
• access the value of an item of the current record in the END
current data source.
Syntax
MySource
Limit
MySource can only be used in the processes associated
5.5 Modulo
Returns the remainder of a division. Syntax
Note: Modulo can be used as a keyword or as a WLan- Modulo function
guage function. <Division Remainder> = Modulo(<Dividend>,<Divi-
// Retrieve the division sor>)
// remainder
DivisionReminder = Modulo(21,4)
Modulo keyword
<Division Remainder> = <Dividend> Modulo <Divi-
// DivisionRemainder is equal to 1
sor>
// Equivalent: DivisionReminder = 21
Modulo 4
5.6 MySelf
MySelf is used to handle the current control. When the
WD, WB s, The Myself keyword can only be used project is run, MySelf is replaced by the control (and not
WDMobile in WinDev, in WebDev server code and by the name of the control). MySelf can be used as any
in WinDev Mobile. control.
Tome1_2.book Page 216 Vendredi, 28. mai 2010 5:50 17
216
Benefit: MySelf enables you to write local code (control, • Retrieving the value of the current control:
button, etc.) or global code (global procedure, class, ControlValue = MySelf
etc.) that is independent from the current control. • Modifying the value of the current control:
-- Whenever a combo box is modified
MySelf = "Smith"
// Call the UpperMask procedure
UpperMask() • Using a property (Caption property, for instance):
--UpperMask procedure MySelf..Caption = "Name of customers"
// mask: 1st letter uppercase ControlCaption = MySelf..Caption
// (editable combo box) • Pass in parameter:
Procedure UpperMask () CallProcedure(MySelf)
Value = Myself
IF Size(Value) > 1 THEN
A WLanguage error occurs if there is no current control.
CursorPos = Myself..Cursor Using MySelf in a procedure
MySelf = … MySelf can be used in a local procedure or in a global
Upper(Value[[1]])+… procedure only if the procedure is called in a process
Lower(Value [[2 to Size(… associated with a control. In this case, MySelf refers to
Value)]]) the current control.
Myself..Cursor = CursorPos
END
Myself is used to make a procedure "generic": the
control’s name is not spelled out. This procedure can be
called by several controls.
Syntax
MySelf WLanguage functions and current control
To specify the current control in the WLanguage functions
Handling the current control that accept a control name in parameter, use:
MySelf is always replaced by the current control. For • an empty string.
example:
Part 3: Basic WLanguage syntax
• Myself directly.
5.7 MyPopupControl
Handling the control that opened the popup window
WD, The MyPopupControl keyword can only
WDMobile be used in WinDev and in WinDev MyPopupControl is always replaced by the control that
Mobile. opened the popup window. Therefore, it can be handled
from the code of the popup window. For example:
MyPopupControl is used to handle the control that ope- If MyPopupControl..Type = …
ned a popup window. At run time, MyPopupControl is typButton THEN
replaced by: MyPopupControl..Caption = …
"Selection in progress"
• the control that opened the popup window (i.e. the
END
control from which OpenPopup or OpenPopupPosition
was called) Pass in parameter
• the control specified in OpenPopupPosition if the dis- CallProcedure(MyPopupControl)
play mode was set to poAccordingToControl.
MyPopupControl can only be used in the processes that
In all cases, MyPopupControl is replaced at run time by handle the current popup window (in the processes asso-
the corresponding control (and not by the name of the ciated with a control for instance). MyPopupControl can-
control). MyPopupControl can be used like any other not be used in a report or in a window that is not a popup
control then. report or a popup window.
Benefit: MyPopupCOntrol enables you to write local code
(control, button, etc.) or global code (global procedure,
class, etc.) that is independent from the current popup Using MyPopupControl in a procedure
window. MyPopupControl can be used in a procedure (local or
global) only if the procedure is called in a process asso-
Syntax ciated with a control of the popup window or in a process
MyPopupControl
of the window popup. MyPopupControl refers to the con-
trol that opened the popup window.
Tome1_2.book Page 217 Vendredi, 28. mai 2010 5:50 17
217
MyPopupControl is used to make a procedure "generic": WLanguage functions and current window
the control’s name is not spelled out. This procedure can To specify the control that opened the current popup win-
be called by several controls. dow in the WLanguage functions that accept a control
name in parameter, use MyPopupControl directly.
5.8 MyReport
example:
WD, WB s, The MyReport keyword can only be
WDMobile used in WinDev, in WebDev server • Using a property (BottomMargin property, for ins-
code and in WinDev Mobile. tance):
MyReport..BottomMargin = 15
The MyReport keyword is used to manage the current ResMargin = MyReport..BottomMargin
report. During the execution of the project, MyReport is • Pass in parameter:
replaced by the report and not by the name of the report. CallProcedure(MyReport)
MyReport is then used like a report.
Benefit: MyReport enables you to write local code (con- MyReport can only be used in the processes associated
trol, item, etc.) or global code (global procedure, class, with the current window (processes associated with a
etc.) that is independent from the current report. control or an item for instance). MyReport cannot be
used in windows.
// Retrieve the name of the current
report Using MyReport in a procedure
MyReport = MyReport..Name MyReport can be used in a local or global procedure only
Syntax if the procedure handles the current report. In this case,
MyReport MyReport refers to the current report.
For a local procedure, MyReport corresponds to the
5.9 MyFile
replaced by the current data file.
WD, WB s, The MyFile keyword can only be used
WDMobile in WinDev, in WebDev server code Benefit: MyFile enables you to create generic triggers,
and in WinDev Mobile. without having to use indirection on the H.FileName
variable . This enables you to handle the file, its proper-
In a trigger, MyFile is used to find out the file responsible ties or its items.
for the trigger. At run time, this keyword is automatically
5.10 MyParent
trol. MyReport can be used used like a supercontrol.
WD, WB s, The MyParent keyword can only be Benefit: MyParent enables you to make the code of the
WDMobile used in WinDev, in WebDev server supercontrol’s controls (control, button, etc.) or the
code and in WinDev Mobile. code of the functions associated with the supercontrol
independent from the supercontrol’s name.
MyParent is used to handle:
• the current supercontrol from an element of the super- • the current report from one of the report controls.
control.
• the current window/page from one of the controls of
When the window/page is run, MyParent is replaced by this window/page.
the supercontrol and not by the name of the supercon-
Tome1_2.book Page 218 Vendredi, 28. mai 2010 5:50 17
218
219
220
containing the selected code" from the popup menu. • of the controls of the window/page.
You can now specify the name of the procedure. The • of the local procedures associated with the window/
procedure is created, the corresponding code is page.
replaced by the call to the procedure with the neces-
sary parameters. These procedures are stored in the window/page.
• From the "Code" pane, "Global procedure" option: Caution:
open the popup menu (right mouse click) and select • The local procedures of a window cannot be used by its
"New global procedure". sibling windows.
Note: you can display the list of global procedures by • The local procedures declared in a child window can-
selecting "Display .. Global procedures" (keyboard not be used in its parent window.
shortcut [Ctrl] [F8]) from the code editor.
WebDev browser: you can display the list of global brow- Procedures local to a report
ser procedure by selecting "Display .. Global browser The local procedures declared in a report can be called
procedures" ([Ctrl] [Alt] [F8] keyboard shortcut) in the from all the processes:
code editor. • of the report.
• of the report controls.
Testing a global procedure • of the local procedures associated with the report.
To run the test of a global procedure:
These procedures are stored in the report.
• From the code editor:
1. Display the global procedure in the editor.
2. Click the [GO] button. Creating a local procedure
3. The description window of the test of the proce- Several methods can be used to create the local proce-
dure is displayed. This window is used to: dures:
•Enter the different parameters of the procedure. • From the code editor:
•Run the test of the procedure ([Run the procedure
Part 3: Basic WLanguage syntax
221
• lock this set only when modifications are made to a 6.3.3 Importing a set of procedures
global procedure. A set of procedures can be imported into a project. The
• modify one or more global procedures even if the pro- procedures found in this imported set can then be used
ject is currently modified by another user. in your project.
To import a set of procedures:
1. In the "Code" pane, "Global Procedures"
6.3.2 Creating a set of procedures option, open the popup menu (right mouse click)
To create a set of procedures: and select "Import a set of procedures".
1. In the "Code" pane, select "Global procedures". 2. select the set of procedures to import.
2. Open the popup menu (right mouse click) and 3. confirm that the selected set must be added to
select "New set of procedures". your project.
222
223
224
225
7. EXCEPTION MANAGEMENT
7.1 Overview
This enables you to display, without any programming, a
WD, WB s, Exception management is only availa- message such as:
WDMobile ble in WinDev, in WebDev server code "Problem in the XXX application: Write down the text of
and in WinDev Mobile. the error and contact our technical support at
xx.xx.xx.xx.xx".
When a programming error occurs in an application/site,
the WLanguage security mechanism is enabled. An error 7.1.2 Exception mechanism
message is displayed on the end user’s computer and the
program execution is terminated. The exception mechanism is used to process the error
cases by programming. If an exception process is trigge-
To lessen the consequences of programming errors, Win- red, no error message is displayed and the exception
Dev/WebDev offers several solutions: code is run. This code enables you to perform all the
• the display of a custom error message (not available in necessary operations:
WebDev). • to exit the current application/site "properly" if the
• the mechanism of exceptions. This enables you to cus- error is a fatal error
tomize the management of the error. • give control back to the user if the error can be fixed.
Caution: these solutions only manage programming WinDev/WebDev offers two types of exception proces-
errors. These solutions cannot be used to manage the sing:
runtime errors (such as inability to write into a read-only
• general exceptions: the exception process is valid for
226
Nesting exception processes in different processes: Quality of the code following an exception process
managing the exception via a higher level After the execution of an exception process, the WLan-
If exception processes are declared in embedded objects guage code following the process is run. We recommend
(project and window/page or window/page and control that you pay attention to the quality of this code (to avoid
for instance), the error can be managed in the higher displaying an error message).
Tome1_2.book Page 227 Vendredi, 28. mai 2010 5:50 17
227
Example: in the following code, the {"Control1"}..Value • use EndProgram to close the application.
= 5 line triggers an exception process. At the end of the // exception process
exception process, the same code line is run again: the WHEN EXCEPTION
exception has already been processed and the WLan- // process to perform in
guage security mechanism is triggered. // case of an exception
To avoid this problem, at the end of the exception pro- Trace("Error")
cess, we advise you to: END
• make sure that the problem is corrected and that it will // control programming error
not happen again. // Control1 does not exist
{"Control1"}..Value = 5
• use RETURN and RESULT to exit from the current pro-
cess
7.2.5 Special case
• use ReturnToCapture to give control back to the user.
A general exception process cannot be declared in com-
posite statements such as:
• FOR
• LOOP
• WHILE
In this type of statement, use the specific exception pro-
cess.
228
229
230
8.2.3 Constructor and destructor class). This enables you to create a new type of data from
a known type, in order to add features to it, or to modify
The notion of Constructor and Destructor is important
its behavior. The base class will not be modified. A class
because it involves an automatic method call when crea-
can inherit from one or more classes; it becomes a sub-
ting or destroying an object.
class.
The Constructor method associated with a class is auto-
A derived class inherits the members and methods of its
matically called when declaring an object of the class.
This ensures that the initialization processes of the object parent classes, in addition to its own members and
(assigning members for example) will not be forgotten by methods. There is no need to duplicate the members and
the developer. the methods of the parent classes.
The Destructor method associated with a class is auto- See ’Class inheritance’, page 248, for more details.
matically called when deleting the object (exiting the pro- 8.2.5 Data encapsulation
cedure where the object was declared). This allows you to
free the resources used by the object without fear of over- Data encapsulation is probably the most important
sight (memory area for instance). It can also be used to notion in OOP. This technique ensures that the object
update a file related to the object. data will not be wrongly modified by functions (methods)
external to the object. It is possible to prevent a user from
See the ’Constructor and destructor’ paragraph, page
245, for more details. accessing some or all object members. The members
whose access is not allowed are called private members.
8.2.4 Inheritance They can only be accessed from the methods designed
The inheritance is used to include the characteristics of for this purpose in the class.
an existing class (base class) into a new class (derived
231
232
the following functions: Event, Timer, Multitask, DnDE- class, the method is called without any parameters (the-
vent, DDEEvent, CallDLL32, … refore default value must be assigned to the parame-
ters).
8.4.1 Constructor method If the ancestor constructor method must be executed
with parameters, you need to explicitly call the method
Declaration of the method before any other instructions (therefore it must be called
Procedure <ClassName>::Constructor([<Parame-
as the first instruction of the constructor method of the
ters>])
subclass).
The important parameters of this syntax are as follows: //----Declare Class1 class
<ClassName> Class1 is class
Class1Member is int
Name identifying the class.
END
<Parameters> //----Class1 method::constructor
Optional parameters of the constructor. If these procedure …
parameters are specified, they must be passed Class1::constructor(Param1)
when declaring the object or when performing the Info("Class1::constructor => " + …
dynamic instantiation. Param1)
//---- Declare Class2 class
Calling the constructor method to build a class Class2 is class
Constructor <ClassName>([<Parameters>]) // inherit from Class1 from which
// Constructor expects a parameter
<ClassName> a Class1 object
Name identifying the class. Class2Member is int
end
<Parameters>
//----Method Class2::constructor
Optional parameters of the constructor. Procedure Class2::Constructor(Param2)
Calling the constructor to build a member constructor Class1(10)
Constructor : <Member Name> ([<Parameters>]) Info("Class2::Constructor => " + …
Param2)
The important parameters of this syntax are as follows:
Tome1_2.book Page 233 Vendredi, 28. mai 2010 5:50 17
233
8.5 Object
To access a class, the object must be declared as being 8.5.3 The methods of an object
part of the class to handle, this is called instantiation of The methods of an object are features associated with
an object. the object. An object necessarily owns all the methods
An instance is an object that belongs to a given class. described in the class. These methods can be called in
To handle an object, you must different ways according to the location of the call.
1. describe its class, 1. Calling a method belonging to an object other than
2. declare the object as belonging to the class. the current object
<Object Name> : <Method Name> ([<Parameters>])
An object can be passed in parameter to a function or to
a procedure. The member is sought among the methods of the object
Note: you can dynamically instantiate an object to a class. If the method is not found, it is sought among the
class. See dynamic instantiation for more details. methods of the ancestor classes of the object class.
Object example: "SourceFile" is object of class "File". 2. Calling a method of the current object
For this object, you can handle the members named
"Name", "Extension"… : <Method Name> ([<Parameters>])
8.5.1 Declaring an object 3. Calling a method of an ancestor class that has been
234
Directory is String
End
SourceFile is object …
<ObjectName>
Dynamic file Name identifying the instance of the class.
//… <Class Name>
//create the object
SourceFile =New File
Name identifying the class, defined when the class
//process the object …
was created in the code editor.
//… <Parameters>
//free the object
Optional parameters of the constructor.
Delete SourceFile
8.6.3 Freeing a dynamic object
Delete <ObjectName>
235
236
Part 3: Basic WLanguage syntax
Tome1_2.book Page 237 Vendredi, 28. mai 2010 5:50 17
PART 4
Managing controls,
windows and pages
Tome1_2.book Page 238 Vendredi, 28. mai 2010 5:50 17
Tome1_2.book Page 239 Vendredi, 28. mai 2010 5:50 17
239
1. THE CONTROLS
1.1 The different types of controls of a window, page
WinDev, WebDev and WinDev Mobile offer a large num- 1.1.2 Types of controls available in WebDev
ber of control types, easily included in your windows or The following controls are available in the WebDev page
pages. These controls can be created using the "Con- editor:
trol" toolbar, or using the "Insert" menu of the window or
page editor. •HTML static, •TreeView,
•Static control, •Cell,
This chapter only presents how to define and handle a
control’s general settings, as well as the programming •Button, •HTML table,
functions common to all the control types. •Link, •Horizontal rule,
240
241
- Position the control with the mouse (the outline of 1.2.4 Deleting one or more controls
the control appears in dotted lines and it helps you - 1st method: use the clipboard
position the new control). - Select the control (or group of controls) to delete.
- 2nd method: Drag and drop Note: Use the [Ctrl] key to select several controls
- Select the control to copy. at once.
- Keep the left mouse button down and drag the - Cut the control using "Edit .. Cut". The control (or
control into the target window or page. group of controls) is placed in the clipboard then.
- Release the mouse button once the control is posi-
tioned in the target window or page (the dotted - 2nd method: direct deletion
border of the control enables you to quickly posi- - Select the control (or group of controls) to delete.
tion the pasted control). Note: Use the [Ctrl] key to select several controls
at once.
Special case: special paste - Press the [Del] key or select the "Delete" option of
Special paste lets you copy into the current window (or the popup menu.
page) the content of the clipboard according to the for-
mat specified later.
242
243
- 2nd solution: Capture with the lasso grouped together, use control groups. See the online
help for more details.
•Click beside the first control to select and keep the
left mouse button down. To group selected controls:
•Move the mouse cursor to select all the controls: the 1. Select all the controls to group together.
selection area is represented by a dotted rectangle. 2. Choose "Control .. Group the selection".
•Release the mouse button when the selection is per- To dissociate selected controls:
formed. 1. Select the group of controls to dissociate.
Notes: 2. Choose "Control .. Dissociate the selection".
• By default, all the controls with a section included in 1.4.4 Moving a control
the lasso area will be selected. To only select the con-
trols that are entirely included in the lasso area, keep A control can be moved inside the same window, same
the [Shift] key down. page, or from one window to another, or one page to ano-
ther.
• All the selected controls are displayed with white han-
dles, the first selected control is displayed with gray To delete one or more controls from a window (or page):
244
Resize the window The "off window" controls are automatically displayed.
When resizing the window (by user action or by program- To prevent "off window" controls from displaying when
ming), the controls displayed in the enlarged area of the the window is resized, locate these controls above the
window are automatically displayed. window (top part of the splash screen).
For example:
• In the editor, the "login" window is as follows. The To create an "off-window" control:
"Details" button allows you to increase the height of 1. Select "Insert .. Control/Shape/Special" and
the window: select the type of control to insert.
Note: You can also use the icons found in the con-
text-sensitive toolbar of the window editor.
2. Click inside the window where the control must be
created.
245
Border
markers
Guides
246
tab of the display options ("Display .. Options .. Modify - Cancel: all the rules applied since the start of the
options"): activation and display of the grid, width and correction are canceled. The interface checker is
height of a grid cell, grid color. closed. The window or page is displayed in its ini-
The snap-on grid can be temporarily enabled/disabled tial state (before the interface checker was star-
by pressing the [Shit] key while moving a control. ted).
247
1.5.7 Positioning table (WebDev only) "Display..View positioning table" or use the [Ctrl] + [U]
The positioning table lets you control the tables created keys.
in the HTML code of the page. See the online help for more details about the positioning
To enable the display of the positioning table, select table.
248
3. In this screen, choose the type of anchor to use. Width and Bottom: the control stretches
The most common options are represented by icons: toward the right and moves toward the bottom
No anchor: the control is not modified when when the window’s size is increased.
the window’s size is modified. No anchoring To make the control move slower or faster, use
option is selected. the anchor rate to the bottom.
To change the speed at which a control stret-
Width: the control stretches to the right when ches compared to the window, use the anchor
the window is enlarged. To change the speed rate in width.
at which a control stretches compared to the
window, use the anchor rate in width. Right and Bottom: the control moves to the
bottom right when the window is enlarged. To
Right: the control moves to the right when the make the control move slower or faster, use
window is enlarged. To make the control move the anchor rate to the bottom and the anchor
slower or faster, use the anchor rate to the rate to the right.
right.
Horizontally Centered at Bottom: the control
Centered in width: the control remains cente- remains centered in width in the window,
Part 4: Managing controls, windows and pages
red in width in the window regardless of the regardless of the window’s width. However, the
window’s width. control is anchored to the right and it moves to
Height: the control stretches toward the bot- the right when the window is enlarged.
tom when the window’s height is increased. To To make the control move slower or faster, use
change the speed at which a control stretches the anchor rate to the bottom.
compared to the window, use the anchor rate Centered in height: the control remains cente-
in height red in height in the window regardless of the
Width and Height: the control stretches window’s height.
toward the bottom right when the window’s Horizontal Distribution: this option is only
size is increased. To change the speed at available when several controls are selected.
which a control stretches compared to the The anchoring options are used to keep an
window, use the anchor rate in height and the horizontal distribution of the selected controls
anchor rate in width. when the window is enlarged.
Height and Right: the control stretches toward Vertically Centered to the Right: the control
the bottom and moves to the right when the remains centered in height in the window,
window’s size is increased. regardless of the window’s height. However,
To make the control move slower or faster, use the control is anchored to the right and it
the anchor rate to the right. moves to the right when the window is enlar-
To change the speed at which a control stret- ged.
ches compared to the window, use the anchor To make the control move slower or faster, use
rate in height. the anchor rate to the right.
Vertical Distribution: this option is only availa- Centered: the control remains centered in
ble when several controls are selected. The width and in height in the window regardless
anchoring options are used to keep a vertical of the window’s size.
distribution of the selected controls when the
size of the window is increased in height. 4. Define (if necessary) the different anchor rates.
5. Validate.
Bottom: the control moves toward the bottom If the option "Display .. Option .. Show anchors" is
when the size of the window is increased enabled, the anchor signs automatically come up in
toward the bottom. To make the control move the control (red arrows).
slower or faster, use the anchor rate to the bot- Tip: if WinDev detects an anchoring problem in a window,
tom. a tip comes up automatically in the development environ-
ment. Accepting this tip allows you to automatically opti-
mize the interface of your resizable windows.
Tome1_2.book Page 249 Vendredi, 28. mai 2010 5:50 17
249
250
ControlInOutReason Indicates the origin of the modification in the control currently in edit
ControlClone Creates a new control (this new control is a copy of an existing control found in the current
window)
PopupField Identifies the control on which the popup menu was opened
CurrentField Returns the name of the control currently in edit
FieldError Customizes the error message displayed in the controls when the value cannot be dis-
played
FieldExist Checks the existence of a control in a window/page
ControlGrayed Grays a control or a group of controls. During this operation, an animation can be perfor-
med on the controls.
ControlInvisible Makes a control (or a group of controls) invisible in a window. During this operation, an ani-
mation can be performed on the controls.
PreviousField Returns the name of the control that was previously in edit in the current window
FieldFirst Returns the name of the first control in edit in the specified window
FieldNoSpace Specifies whether the space characters on the right of the value found in the control are
deleted
NextField Identifies the next control in edit
ControlDelete Permanently deletes a control or a table column
ControlOver Identifies the control hovered by the mouse cursor
ControlVisible Makes a control (or a group of controls) visible in a window. During this operation, an ani-
mation can be performed on the controls.
ChangeStyle Modifies the style of a control dynamically
LoadParameter Reads a persistent value. The persistent value was saved by SaveParameter in the file spe-
cified by InitParameter
CurrentColumn Returns the subscript of the current subscripted column in a browsing table or in a memory
table
SelectionColor Changes the characteristics of the selection bar in a table, in a combo box or in a list box
SetFocus Gives focus to the specified control
ScreenFirst Defines the next control that will be in edit in the current window
EnumControl Lists the controls in a window, page, group, tab or supercontrol
HTMLNavigate Starts a navigation operation in an HTML control
CurrentSubscript Returns the subscript for the current control
NextSubscript Returns the number of the next row displayed in the current table.
InitParameter Initializes the management of persistent values in the registry
Occurrence Returns the number of occurrences of a control in a window/page
ControlTab Returns the name of the Tab control that contains the specified control
OpenPopupMenu Automatically opens a popup menu for the current control or window
Tome1_2.book Page 251 Vendredi, 28. mai 2010 5:50 17
251
ConfigureSpellCheck Enables you to configure the spelling checker of OpenOffice for all the edit controls of the
application
ParentObject Identifies the "Parent" of a graphic object: control, column, window, page, etc.
Reset Reinitializes all the controls found in the current window/page
ReturnToCapture Resumes input in the specified control or window/page
RTFAdd Adds a character string (in RTF format or not) at the end of an RTF edit control
RTFLoad Loads a file in RTF format into an RTF edit control
RTFInsert Inserts a character string in RTF format into the content of an RTF edit control
RTFSearch Searches for a character string in an RTF edit control
RTFReplace Replaces or inserts a character string in an RTF edit control
RTFSelection Changes or lists the attributes of the text currently selected in an RTF edit control
RTFToText Returns the text found in an edit control in RTF format without the RTF formatting
SaveParameter Saves a persistent value in the registry (or in a file specified by InitParameter)
DeleteParameter Deletes a parameter (or a set of parameters) saved either by SaveParameter, or saved
252
2.1 Overview
The windows constitute the main interface of a WinDev a query, ….
application. Indeed, the windows allow the users to view •RID window. These windows are identical to RAD
and handle the information. This information can be windows, but the code is the responsibility of the
dynamic and come from files, queries, etc. or it can be developer. Only the interface is generated.
static, entered in the window controls directly. •internal window.
To create a window: •window based on a template.
1. Select "File .. New .. Window". The wizard for win- •windows imported from another application (Win-
dow creation starts. Dev only).
Part 4: Managing controls, windows and pages
253
254
• Top left pixel: all the pixels with the same color as the
top left pixel of the image will be transparent.
Part 4: Managing controls, windows and pages
255
To define the 9-image mode for the background image image, define the color that will be used to define the
of a window: transparent areas ("Light Magenta" for instance). All
1. Display the description window of the window. these areas will be invisible when displaying the window
2. In the "Image" tab, select "Use the 9-image at run time: the window will be clipped.
mode" and configure this mode with the button on
the right. Caution: this image’s borders must be the cleanest pos-
3. The configuration screen for the different areas sible (no gradient, etc.) in order to avoid display effects
comes up. during preview or when opening the clipped window.
To clip a window:
2.3.5 Clipped window 1. Display the "Image" tab of the window descrip-
tion ("Description" option of the popup menu).
WD This feature is only available in Win-
Dev. 2. Select the window’s background image. This
image will define the shape of the window.
3. Check "Use the image transparency to clip the
WinDev lets you clip windows. The windows will have cus- window".
tom shapes (window in the shape of a circle, a computer, 4. Specify the transparency color ("Transparency"
256
2. If needed, insert the main menu ("Insert .. Add Popup menu …").
the main menu"). 2. Display the popup menu of the home window
3. Display the "Style" tab of the current window’s option (right click) and select "Description of the
description window ("Description" option of the popup menu". The description window of the popup
popup menu. menu comes up.
4. Select the "Display menu in XP look" option. 3. Display the "Style" tab of the popup menu’s des-
cription window.
Note: menus using the XP look keep the settings of the 4. Select the "Display menu in XP look" option.
menu option font (size, color, …). These characteristics
have been defined in the "Style" tab of the description Note: menus using the XP look keep the settings of the
window of the menu option. menu option font (size, color, …). These characteristics
have been defined in the "Style" tab of the description
For a window’s popup menu to use the XP look: window.
1. Display the popup menu you want ("Windows ..
2.5.1 Overview "icons bar" can be accessed. Outside this area, no con-
The following types of windows can be created in a Win- trol can be in edit mode and no mouse click is active.
Dev application: Characteristics of the MDI child windows
• MDI: MDI child windows all have the same characteristics (not
These windows must respect some constraints specific modifiable):
to the MDI applications. Three types of windows are
•modifiable borders,
available: MDI parent window, MDI child or MDI sibling.
Child and sibling windows are opened in non-modal •a minimize button, maximize button, system menu,
mode. •title bar,
• non-MDI: •no menu.
These windows have no specific constraint. These win- The MDI child windows are necessarily opened in the
dows can be opened in modal mode or in non-modal parent window. The display position of an MDI child win-
mode. dow is always relative to its parent window.
2.5.2 MDI window Programming
Characteristics of the MDI parent windows MDI child windows must be opened with the MDIOpen
An MDI parent window must necessarily be the first win- function.
dow of a WinDev project. This window is used to display Note: an MDI child window cannot be tested directly from
all the application windows. the editor. Indeed, it must necessarily be opened from
An MDI parent window has the following characteristics the parent window.
(not modifiable): Regarding the display of a message or a progress bar
•modifiable borders, with the Gauge and Message functions:
•minimize button, maximize button, system menu, • If the MDI child window includes a status bar, the mes-
sage or the progress bar is displayed in the MDI child
•title bar, window.
•icon bar, • If the MDI child window includes no status bar, the
•ability to include a drop-down menu and toolbars. message or the progress bar is displayed in the bar of
the MDI parent window.
In a parent MDI window, only the controls located in the
Tome1_2.book Page 257 Vendredi, 28. mai 2010 5:50 17
257
2.5.3 Non-MDI window (or free window) •a button for the system menu or not,
For non-MDI windows, there is no constraint about size or •a simple, thick or double window border,
window type for opening windows. Therefore, regardless •a menu or not,
of their opening mode, windows can have: •all types of controls.
•a title bar or not,
The free windows can be opened:
•a minimize button or not,
•with the Open> function (modal open),
•a maximize button or not,
•with OpenChild or OpenSister (non-modal opening).
258
• If the parent window is closed, its child windows are dows from a "MDI parent" type window.
also closed. If a child window refuses to close, the fol- When calling OpenChild, the following processes are run:
lowing child windows of this window will not be closed •Run the code for "declaring the global variables" of
either, as well as the parent window. the child window.
• If the child window is minimized, the other windows are •Running the initialization codes of the controls (the
not minimized. The icon of the window is the one of the order is undefined).
window (or the one of the project if the window has no
icon). •Run the processes following the call to OpenChild of
the parent window.
• If the parent window is minimized, all the child windows
become temporarily invisible. •Display the child window (the parent window remains
the current window).
When opening a non-modal sibling window: Note: non-MDI child windows can be displayed out-
• All the sibling windows can be in edit at the same time. side of the parent window; they can be displayed at
• Once a child window is closed, another child window any coordinates in the screen.
becomes the current window. ReturnToCapture lets you force input in the child window.
Part 4: Managing controls, windows and pages
259
Opening with alias If the window is minimized, all the child windows are
The same window (child or sibling window) can be ope- minimized. The icon used is the one of the window (or the
ned several times. This window is its own sibling. Each one of the project if the window has no associated icon.)
window opened is identified by an alias. The alias is MDI child window
passed as parameter to OpenSister, OpenChild or MDIO-
pen. If no alias is specified when an already open window If the window is minimized, it is minimized inside the
is opened, an alias is automatically assigned to the win- parent window. The icon used is a part of the title bar.
dow by WinDev. MDIWindowMenu lets you minimize all the open MDI
Note: this alias can be modified with WinChangeAlias. child windows, and then restore them.
The alias is used to identify windows with functions that Reminder
accept a window name as parameter (for instance: Cur- A window can be minimized:
rentTitle, NextTitle, ReturnToCapture, etc.) or to handle a •using the Iconize function,
control from a given window.
•using the WinSize function.
The alias is returned by CurrentWin or PreviousWin.
// Open CUSTFORM with CUSTOMER1 alias A window can be restored:
260
closed.
2.8.1 Maximized window The type of the button can be changed at any time in the
A maximized window occupies the entire screen of the editor:
Pocket PC. Different options can be configured in the • via the popup menu of the button:
window creation wizard ("File .. New .. Window .. Wizard
for creating blank windows":
Characteristics
1. OK/Close button
The "Close of OK" button is used to close or validate the
current window. This button is associated with a specific
process of the window: "Before closing with OK/Close
button". This process is run before the closing code of 3. Scrollbar
the window. The scrollbars are automatically displayed if the size of
By default, this button is used to close the window (the the window is greater than the resolution of the screen of
code of this button corresponds to Close). the Pocket PC used.
Operating mode of the Close button This option can be chosen at any time in the window des-
cription ("Details" tab).
The processes run are as follows:
Caution: in full screen mode, automatic scrollbars are
• execution of the "Before closing with OK/Close but- never displayed in a maximized window.
ton" process.
• execution of the code of the "Cancel" button found in 4. Tabs
the window (if this button exists). If the window con- The tabs are used to display information about the diffe-
tains no "Cancel" button, the window is closed. rent panes. The user only has to choose the requested
tab.
Operating mode of the OK butto:
See the online help for more details.
• execution of the "Before closing with OK/Close but-
Tome1_2.book Page 261 Vendredi, 28. mai 2010 5:50 17
261
5. Menu and toolbar time in the "Style" tab of the window description.
In an application for Pocket PC, this menu is located at 2. Close/OK button
the bottom of the windows. A drop-down menu allows the
user to quickly access one of the features of the applica- The "Close of OK" button is used to close or validate the
tion. current window.
Adding a drop-down menu to a window or deleting a This button is associated with a specific process of the
drop-down menu from a window can be done at any time: window: "Before closing with OK/Close button". This
process is run before the closing code of the window.
• via "Windows .. Main menu .. Delete the main menu".
• in the "Style" tab of the window description ("With Operating mode of the Close button:
menu" box) • execution of the "Before closing with OK/Close but-
ton" process.
Size of a maximized window
• execution of the "Cancel" type button found in the
The usable size of a maximized window depends on the window (if there is such a button). If the window con-
elements taken into account in the window (title bar visi- tains no "Cancel" button, the window is closed.
ble or not, toolbar visible or not, status bar visible or not,
262
To force an action upon a window, define a button in the •the button to run
window as "Automatic Execution". The principle is easy,
if no button has been used in the window after a given
period of time, the process of the "Automatic Execution"
button is automatically run. At run time, the amount of
time is decremented automatically. When it reaches zero,
the button’s code is automatically executed.
2.9.1 Implementation
3. At run time, the remaining time is automatically
To automatically run a window button: displayed.
1. Define which button your window must run auto-
matically.
2. In the window description ("Details" tab of the 2.9.2 Programming
description window), specify:
You can also define a button for automatic validation with
•the delay before automatically executing the but- DelayBeforeClosing.
ton
2.9.3 AAF: Automatic Application Feature
This feature is also directly accessible to the end user. It
can request that an application’s button be run automati-
cally after a given period of time.
263
2.11.1 Overview
Your application opens several windows at the same time
and you don’t know which one to use?
The inactive windows can be automatically dimmed. This
feature enables you to always know which window to use.
This feature is called DDW, which stands for Dim Disabled
Windows.
For example:
You modify the personal details of a customer 2.11.2 DDW for all the application windows
then you click the "Validate" button By default, the DDW feature is enabled for all the applica-
tion windows.
To enable the DDW feature for all the application win-
dows:
1. Display the "Charter" tab of the project descrip-
tion window ("Project .. Project description").
2. Select "Enable DDW to gray the windows when
they are disabled" and validate ("OK").
Tome1_2.book Page 264 Vendredi, 28. mai 2010 5:50 17
264
validate ("OK").
Notes:
Notes:
• When creating a new project, this option is checked by
default. • When creating a new window, this option is checked by
default.
• WinActivateDDW is used to enable or disable this fea-
ture by programming. • This feature can be enabled or disabled :
- by the end user via "Gray the window when it is inac-
• WinRateDDW is used to modify the ratio used to gray cessible (DDW)" from the popup menu of the window.
all the application windows. - by programming with WinActivateDDW.
• If "Enable DDW to dim the windows when they are
inactive" is unchecked at the project level, the DDW 2.11.4 Configuration of the end-user compu-
feature will be disabled at run time even for the win- ters
dows whose corresponding option is checked. Depending on the configuration of the end-user compu-
• If "Enable DDW to dim the windows when they are ters, the DDW feature may have no effect.
inactive" is checked at the project level, the DDW fea- Indeed, the DDW feature is affected by the characteris-
ture will be enabled at run time even for all the windows tics of the video card, the speed of the processor, …
Part 4: Managing controls, windows and pages
265
2.14.1 What is UMC? The added processes can be forwarded to the developer
UMC is an option allowing advanced users to perform so they can be added to the application’s source.
their own processes in the application. The end user can A large number of WLanguage features are accessible to
enter WLanguage code and add it to an existing applica- the user and some restrictions can be set by the develo-
tion. per. For instance forbid the use of any file management
Tome1_2.book Page 266 Vendredi, 28. mai 2010 5:50 17
266
functions. In order to insure data integrity, the record If you authorize it, two options are available:
modification or addition commands are not available to • Allow the use of HyperFileSQL commands (HReadFirst,
the end user. HFilter, HAdd, …).
• Accept the suggestions made by the users.
2.14.2 How to enable/disable UMC?
This second option enables the application to send an
You can of course disable this feature for a window or for email when the user creates a macro code. The "*.UMC"
the entire application if you want. file corresponding to the macro code is sent as an atta-
To disable UMC for a window, select the "Forbid the use chment. This way you can easily retrieve suggestions from
of U.M.C" option in the "Details" tab of a window’s des- your customers and include them in your project automa-
cription. tically! WinDev offers a "*.UMC" file import option
When creating the executable you can authorize the entry ("File .. Import .. User Macro Code …").
of User-Macro Code or forbid it for the entire application.
2.15.1 What is a HyperFileSQL context? tances of the same application were running in parallel.
A HyperFileSQL context contains the information relative We recommend that you use an independent HyperFi-
to the data used: leSQL context for the MDI and multi-threaded applica-
• Information about the current record: record number, tions.
item content, … The independent HyperFileSQL context is taken into
• Values of the HFound, HOut functions, … account:
• Characteristics of the current filter. • when using a HyperFileSQL database with HyperFi-
• Characteristics of the current search. leSQL functions (functions starting with the letter H).
• Characteristics of the current browse. • when using a HyperFileSQL database with SQL func-
• Name of the opened files. tions (functions starting with the letters SQL)
• Name and characteristics of queries (HExecuteSQL- • when using any database via an ODBC driver, with the
Query and HExecuteQuery functions). SQL functions.
The "Independent HyperFileSQL Context" option is sup-
Note: only one transaction is possible per HyperFileSQL ported in WinDev for the following databases:
context. • HyperFileSQL
2.15.2 Independent HyperFileSQL context • Oracle
When opening the window, the existing HyperFileSQL • SQL Server
context is automatically "duplicated": the operations • Sybase
performed in each context are independent from the • AS400
ones performed in the other contexts. The use of an inde- • Any database via ODBC
pendent context provides the same result as if two ins-
Tome1_2.book Page 267 Vendredi, 28. mai 2010 5:50 17
267
268
Before closing with OK/ This process is run before the closing code of the window. This process is associated with the
Close button "Close" or "OK" button found in the title bar of the window.
(WinDev Mobile Operating mode of the Close button:
only) - execution of the "Before closing with OK/Close button" process.
- execution of the "Cancel" type button found in the window (if there is such a button). If the
window contains no "Cancel" button, the window is closed.
Operating mode of the OK button:
- execution of the "Before closing with OK/Close button" process.
- execution of the "Validation" type button found in the window (if there is such a button). If
the window contains no "Validate" button, the window is closed.
Note: if the "Before closing with OK/Close button" process calls ReturnToCapture, the win-
dow will not be closed.
Taking focus Run when the window takes focus (the title bar is active) and another application window
loses focus:
- the user has clicked another window of the application,
- ReturnToCapture has been executed from another window of the application.
This process will not be run:
- when opening the first window of the project,
- when calling OpenChild or OpenSister from the current window,
- if Close is called in the window’s initialization code,
- if the user clicks a window from another program then re-clicks inside the initial window.
Loss of focus Run when the window loses focus when going to another window. This process is always cal-
led before the ’gain of focus’ process of another window in the following cases:
- closing the window (before the closing process),
- the user has clicked another window of the application,
- ReturnToCapture has been executed from another window of the application.
This process will not be run:
- if ReturnToCapture for another window has been called in the window’s initialization code,
- if Close is called in the window’s initialization code,
- if the user clicks a window from another program then re-clicks inside the initial window.
Tome1_2.book Page 269 Vendredi, 28. mai 2010 5:50 17
269
270
Width Enables you to find out and modify Plane Enables you to find out and modify
the width of a window the active plane of a window
InitialWidth Enables you to find out the crea- TextDirection Enables you to find out and modify
tion width of a window the writing direction used in the
MaxWidth Enables you to find out and modify window (useful for managing lan-
the maximum width of a window guages such as Arabic or Hebrew)
MinWidth Enables you to find out and modify Title Enables you to find out and modify
the minimum width of a window the title of a window
Caption Enables you to find out and modify NoteTitle Enables you to find out and modify
the title of a window the caption used in the program
documentation for a window
MDIBottom Enables you to find out and modify
the distance between the bottom
border of the MDI parent window Type Enables you to find out the type of
and the bottom border of the MDI an object
Part 4: Managing controls, windows and pages
271
272
WinUsefulSize Dynamically changes the useful size of the internal window displayed in an Internal Window
control.
WinRateDDW Enables you to find out and modify the level of gray for the windows to which the DDW feature
is applied
Close Closes a WinDev window (and returns a value if necessary)
Iconize Minimizes a WinDev window
WindowBitmap Creates the image of the specified window in a BMP file
InitWindow Initializes (or not) the controls to zero and runs the initialization processes of the controls
and window
Maximize Displays a WinDev window in its maximum size
MultitaskRedraw Immediately redraws the window controls that must be graphically refreshed
WindowCount Calculates the number of windows currently opened in the current application
Open Opens a modal WinDev window
OpenChild Opens a non-modal child window
Part 4: Managing controls, windows and pages
273
3. THE PAGES WB
3.1 Overview
The pages constitute the main interface of a WebDev site. 2. Select the type of page to create:
Indeed, the pages allow the Web users to view and han- •blank page, without any control.
dle the information. •dynamic RAD type page used to display and enter
This information can be data. This type of page can be based on a data file,
• dynamic and come from files, queries, ... This informa- on a query, …
tion changes according to the requests made by the •Semi-dynamic RAD type page used to display
Web users. data. This type of page can be based on a data file,
• static. The information is fixed and it does not change. on a query, …
274
275
3.4.3 Applying a page template 3.4.4 Opening the template associated with a
To create a new page based on a page template: page
1. Select "File .. New .. Page". To open the template associated with a page:
2. In the wizard, select your custom template in the 1. Display the page in the page editor.
"Project Templates" combo box. 2. Open the popup menu of one of the template’s
Note: the […] button lets you select a preset tem- elements (right click).
plate offered by WebDev. 3. Select "Open the template".
3. Choose the type of page to create and validate.
A yellow square is used to identify the elements 3.4.5 Applying the modifications performed on
belonging to the page template. These elements can a template
be modified only in the page template. When a page template is modified, the modifications can
To apply a template to an existing page: be applied to one ore more pages that use this template
1. Display the page in the page editor. in the current project.
2. Select "Insert .. A template (Inheritance)". Applying the modifications is proposed when the tem-
3. Select the page template to apply. plate is saved. It can be done at any time:
4. Validate.
276
2. This variable is passed in parameter to the variables declaration" process of the CALENDARPAGE
CALENDARPAGE page. The sSelDate parameter con- page:
tains the value of the MyDate variable.
-- Global declarations of
3. The value of the sSelDate parameter is modified
-- CALENDARPAGE
in the CALENDARPAGE page (for example: sSelDate PROCEDURE CalendarPAGE(…
= "20020701"). sSelDate = 20030101)
4. The value of the MyDate variable is not modified. // - sSelDate: date specifying the
// date to select.
3.5.3 Running the test of a page with parame-
ters
3.5.4 Scope of the parameters
To test a page with parameters directly from the page edi-
tor, we recommend you give a default value to the para- The parameters passed to a page are global to all the
meters when declaring them. processes of this page (initialization, code of a button,
code of a local procedure, …).
For example, to test the page found in the previous exam-
ple, the following code must be entered in the "Global
Part 4: Managing controls, windows and pages
277
Advanced management • Save memory on the server (by closing the contexts of
pages previously opened but not used, for example).
WebDev enables you to perform advanced context mana-
gement via the Context functions*. • Prepare pages intended for communicating with other
applications (the page receiving information back from
You can: a secured payment site, for example).
• open a page’s context without displaying it in the brow- • Handle pages from other pages.
ser (ContextOpen),
• test whether the page context exists on the server Special case
(ContextExist), When using the "Back" key of the browser, a desynchro-
• close the context of an unused page (ContextClose). nization may occur between the page and its context. See
This advanced management of page contexts can be ’Managing the "Back" button’, page 285, for more
used to: details.
278
Initialization (Ser- Run when the page is opened. 3.10.2 Optional processes
ver code) The processes are run in the following order: Several optional processes can be managed.
•initialization of the page’s controls.
•initialization of the page. To manage an optional process, all you have to do is
select it in the icon bar of the code window.
Loading (onload) Browser code run when the page is dis-
the page (Brow- played in the browser (created by PageDis-
ser code) play or PageRefresh for instance.
Unloading (onun- Browser code run when a new page is dis- You have the ability to manage:
load) the page played in the browser.
(Browser code) •the rollover of the control by the mouse,
•pressing, releasing or double-clicking the left mouse
button,
•the right mouse button down, up, with a double click,
•the mouse wheel, etc.
Tome1_2.book Page 279 Vendredi, 28. mai 2010 5:50 17
279
280
281
4.1 Overview
The browser "Back" button allows the Web users to go 4.1.2 Example of desynchronization
back to the pages that were already visited. Site example:
In a WebDev site, each HTML page displayed on the • A browser page contains a file table linked to the ITEM
browser is associated with a page context, found on the file and a "Next" link.
server. Each action performed in a page displayed by the
browser must trigger an identical action on the corres- • The ITEM file only contains a single item, each record is
ponding page context found on the server. made of a letter in the alphabet.
However, the browser "Back" button is used to perform • The page can display 6 rows from the table, the "Next"
an action on the browser only: the page displayed in the link displays the next 6.
282
283
284
The dialog boxes are standard windows that allow you to •The question boxes (YesNo function of WLanguage).
communicate with the user. They can be used to notify of
an error, to ask for confirmation, etc.
The dialog boxes always contain the same elements:
•An icon used to quickly identify the type of message
displayed: Information, Question or Error.
•A title displayed in the title bar.
•One or more buttons allowing the user to choose an •The confirmation boxes (Confirm function of WLan-
answer. The number and the type of these buttons guage).
depend on the type of dialog box used.
•A text on one or more lines corresponding to the mes-
sage intended for the user.
Several types of dialog boxes are available:
•the information or error boxes (Warning, Info or Error
function of WLanguage). For example:
By default, dialog boxes are closed only through a user
action on a button in the box. If no button is pressed, the
application/site is locked.
To avoid any lock risk, use DelayBeforeClosing and spe-
cify the amount of time after which the dialog box is auto-
matically closed.
Tome1_2.book Page 285 Vendredi, 28. mai 2010 5:50 17
285
5.3.1 Overview Whenever a function used to dialog with the end users is
The advanced dialog boxes are windows that allow you to called, WinDev offers to:
communicate with the user. These windows are used to • select an existing message
manage: • create a new message with a simple window.
• the directive questioning: the user answers a question The corresponding code is automatically generated when
through buttons containing the text of the action to per- the different message characteristics are entered.
form. Note: The generated code uses the Dialog function.
Your applications use a lot of system dialog boxes? Why Reminder: by default, the displayed dialog boxes are
not customize these windows and give them the "style" standard dialog boxes that have the following characte-
of your application? ristics:
WinDev enables you to easily include the "WinDevMes- • gray background.
sageBox" window in your applications. This window is a • icon indicating the type of information displayed.
system information window (dialog box) fully customiza- • standard WinDev buttons.
ble and that can be used in all your applications.
No code is required. When this window is included in your Note: the use of this window enables you to get multilin-
project, Info, YesNo, Confirm and Error automatically gual dialog boxes (images, button caption, etc.). By
display the "WinDevMessageBox" window. default, this window supports French, English, German,
Spanish, Italian, Dutch and Portuguese. See the "Multi-
lingual dialog boxes" paragraph for more details.
Tome1_2.book Page 286 Vendredi, 28. mai 2010 5:50 17
286
5.4.1 Customizing the system information win- 5.4.2 Stop customizing the system information
dows window
To customize the system information windows: To cancel the customization of the system information
1. In WinDev, display the "Style" tab of the project’s windows:
description window ("Project .. Project descrip- 1. In WinDev, display the "Style" tab of the project’s
tion"). description window ("Project .. Project descrip-
2. Check "Apply the theme of skin template to the tion").
system information windows" and validate. The 2. Uncheck "Apply the theme of skin template to the
"WinDevMessageBox" and "WinDevDialogBox" system information windows" and validate.
windows are automatically included in your applica- 3. Delete the "WinDevMessageBox" and "WinDe-
tion. The skin template of your project is applied to vDialogBox" windows from your project:
these windows. •from the project graph
The "WinDevMessageBox" window replaces the •from the "Project" pane.
standard system information window (displayed 4. If needed, delete the file corresponding to the
using Warning, Info, YesNo, OKCancel, Confirm and "WinDevMessageBox" and "WinDevDialogBox"
Error).
Part 4: Managing controls, windows and pages
WinDev enables you to automatically close these dialog To avoid any lock risk, use DelayBeforeClosing and spe-
boxes to avoid locking the application. By default, the cify the amount of time after which the dialog box is auto-
dialog boxes are closed only when the user clicks one of matically closed.
their buttons. If no button is pressed, the application is
locked.
5.6.1 Overview In order for the Web user to easily identify the active
From now on, with the new Web technologies, the sites page, the system for graying the pages is automatically
can look more like Windows applications and display dia- used. The inactive page is grayed, so the active pages
log boxes. can be easily viewed by the Web user.
Tome1_2.book Page 287 Vendredi, 28. mai 2010 5:50 17
287
5.6.2 The available WLanguage functions dialog box. This cell will be used to communicate
WebDev offers several functions for communicating with with the user. This cell must contain at least:
the user: •a static control used to display the text of the dia-
log.
CellDisplayDialog Displays a cell in a page with a
DDW effect (Dim Disabled •a button used to validate the dialog box.
Windows). This function is The cell (as well as its controls) is invisible.
used to easily simulate a dia- You can add controls to the cell if necessary (image,
log box in browser code. …).
2. The code of the button for closing the dialog found
CellCloseDialog Masks a cell displayed in the in the cell contains the following code:
page via CellDisplayDialog.
CellCloseDialog("MyCell")
OKCancel Displays a message in a stan-
dard dialog box that proposes CellCloseDialog enables you to hide the previously
"OK" and "Cancel" and displayed cell .
returns the user’s choice. 3. To communicate with the user from the page
YesNo Displays a message in a stan- (using a page’s button for instance) simply use the
288
5.6.5 Managing a dialog with YesNo and These internal pages contain the dialog box:
OKCancel •WebDevOKCancel for OKCancel.
The YesNo and OKCancel functions also enable you to •WebDevYesNo for YesNo.
easily communicate with the user. These functions are The page are added using "File .. New .. Page",
used to ask a question to the Web user who will answer by "Internal page" tab, "OK/Cancel" or "Yes/no"
either "Yes" or "No", or "OK" or "Cancel". option. These pages must be saved in your project
To manage a dialog with YesNo and OKCancel, you must: with the name proposed by default.
1. Including specific internal pages in your project. 2.Use the YesNo and OKCancel functions in the
application’s code.
289
A popup menu can be opened by the user via a right be handled by programming.
mouse click. This menu allows the users to easily access
the specific features of a window or window control. WinDev enables you to create custom popup menus and
to associate these popup menus:
WinDev enables you to manage two types of popup
menus: • with one or more controls found in a window.
• the system popup menus managed by Windows. These • with a window.
popup menus are displayed when a right click is perfor-
med on some types of controls (edit control, table, …). Note: "Windows .. Popup menu .. Edit" enables you to
See the ’Default system popup menu’ paragraph, page find out all custom popup menus available in a window.
306, for more details. These popup menus can be associated with this window
or with the controls found in this window.
• the custom popup menus managed by WinDev. These
290
Note: you can also create a custom popup menu: • If different popup menus are associated with a table
• from the "Details" tab of the description window of a and with its columns, the popup menu associated with
window or window control. Simply select the "None" the columns will have priority. When a right click is per-
element in the "Menu Ctx." combo box and click the formed on a column, only the popup menu associated
arrow to the right of this combo. The window for editing with the column will be displayed.
the new custom popup menu is opened. This popup • If all the table columns are associated with one or more
menu will be automatically associated with the current popup menus, the popup menu associated with the
element (or with all the elements in case of multi- table will never be displayed.
selection).
• from the "Management of popup menus" window 6.2.3 Editing a custom popup menu
("Window .. Popup menu .. Edit"). Simply click the A popup menu can be edited:
"New" button and enter the name of the new popup • by selecting "Windows .. Popup menu .. <PopupMenu-
menu. Name>".
• from the "Details" tab of the description window of a
6.2.2 Associating a custom popup menu with window or control associated with this popup menu:
one or more elements (window or controls)
Part 4: Managing controls, windows and pages
291
6.2.4 Displaying the description window of a - display the custom popup menu with the XP style.
custom popup menu Example of menu that uses the XP style:
To display the description window of a custom popup
menu:
1. Edit the requested popup menu ("Windows ..
Popup menu .. <PopupMenuName>").
2. Display the popup menu of the host window (right
mouse click).
3. Select "Description of popup menu".
The description window of a custom popup menu can
also be displayed from the "Management of popup
menus" window:
- Select "Windows .. Popup menu .. Edit".
- Select the requested popup menu.
- Click the "Description" button.
292
293
6.4.1 Popup menu of the "Currency + Euro" If this popup menu is proposed to the users, the popup
controls menu associated with the control will be ignored.
In the "Currency + Euro" controls (edit controls, table To disable this system popup menu:
column, and so on), a popup menu can be proposed to • from the window editor: select the "Disabled" ele-
the user in order to choose the display currency. This ment from the "Menu Ctx." combo box (control des-
popup menu presents the result of the conversion for the cription window, "Details" tab).
value entered in the different currencies. • by programming: use PopupMenu.
Reminder: to display the popup menu specific to the
"WinDev currency + Euro" type controls:
1. Display the description window of a "WinDev Cur-
rency + Euro" control ("Display .. Selection descrip-
tion").
2. Select the "Details" tab.
3. Click the "Options" button found in the "Euro
Management" area. The window for managing the
294
295
7.3.4 About menu in your application ("Windows .. Main menu .. Add the
WinDev enables you to automatically insert a "?" menu menu?").
296
297
8.1.4 Image associated with a menu option keyboard keys. This shortcut gives direct access to a
menu option from the keyboard.
WD, This feature is only available in WinDev
WDMobile and in WinDev Mobile. To associate a keyboard shortcut with a menu option:
1. Select the menu option to which a keyboard
shortcut must be associated.
Each menu option can be preceded (or not) by an image.
2. Select "Display .. Selection description". The
To display an image in front of a menu option : description window of the current menu option is dis-
1. Select the menu option in front of which the image played.
must be displayed. 3. Select the elements that constitute the keyboard
2. Display the "Details" tab of the description win- shortcut of the menu option.
dow of the menu option ("Display .. Selection des-
cription").
3. Select the image to display. This image can be
chosen from the image catalog supplied with Win-
Dev. Note: if a keyboard shortcut is associated with a menu
option, this shortcut is shown next to the menu option’s
298
299
See the online help for more details about these functions.
These functions are only available in WinDev.
Tome1_2.book Page 300 Vendredi, 28. mai 2010 5:50 17
300
Helpnumber Enables you to find out and modify the help number associated with a control.
Font Enables you to find out and modify the font used in a control.
FontCharset Enables you to find out and modify the character set currently used by the font of a control.
FontStri- Enables you to find out and modify the "Strikeout" attribute for the content of a control
keOut
FontCon- Enables you to find out whether the characters of the text displayed in a control are condensed and to
densed condense (or not) the characters of the text displayed in a control
FontExten- Enables you to find out whether the characters of the text displayed in a control are extended and to
ded extend (or not) the characters of the text displayed in a control
FontBold Enables you to find out and modify the "Bold" attribute for the content of a control
Fontitalic Enables you to find out and modify the "Italic" attribute for the content of a control
FontLarge Enables you to find out whether the characters of the text displayed in a control are enlarged and to
enlarge (or not) the characters of the text displayed in a control
FontName Enables you to find out and modify the font used in a control
FontUnderli- Enables you to find out and modify the "Underline" attribute for the content of a control
ned
FontSize Enables you to find out and modify the size of the font used in a control
Type Enables you to find out whether the element used is a menu option
Value Enables you to find out and modify the number associated with a menu option
Visible Enables you to find out whether a menu option is visible and to make a menu option visible/invisible
301
9.1 Overview
In the status bar of a window, you can display: Note: To display a status bar in the current window:
•a message with information on the current control. • select "Status bar" in the "Style" tab of the window
This message is entered in the "Help" tab of the des- description.
cription window of the control. • select "Windows .. Status bar .. With status bar".
The message will be displayed in the status bar when
the user selects the control.
In WinDev, to display several pieces of information at the
•a special information message. This is displayed by same time, you can split the status bar into cells ("Insert
programming with the Message function. cell" option of the status bar’s popup menu).
The description window of a status bar is used to: • The name of the current user in an application that
• add and/or delete cells. uses the user groupware.
• modifying the order of the cells. Two specific options are also available:
• specify for each cell the information to display. • By programming: the information displayed in the sta-
tus bar is specified by programming (Message function
for instance).
To display the description window of a status bar:
• Update process: the "Whenever updated" process is
•select "Description" from the popup menu of the automatically associated with the status bar’s cell. This
status bar. process is run on a regular basis. This process can con-
•select "Windows .. Status bar .. Edit". tain the elements to display in the cell for instance.
See the online help for more details.
9.2.2 Characteristics of a status bar cell
9.2.1 Type of cell in the status bar The description window of the status bar also enables
You have the ability to display: you to define the display characteristics of the cells found
• The progress bar displayed by the Gauge function. in the status bar.
• The help message associated with the control that has • The position of the cell in the status bar.
focus (help message defined in the control "Help" tab • The background image of the cell.
or by programming with the Message property). • The background color of the cell.
• The date of the current computer • The width of the cell.
• The time of the current computer • Whether the cell is in edit.
• The position of the cursor in the current edit control • The anchor of the cell (its operating mode when the
(Column and Row of Caret). window is resized).
• The status of the [Caps Lock] key, indicating whether All these characteristics can be used in your programs
the Caps Lock key is on or off. through the properties available for status bar cells.
• The status of the [Insert] key, indicating whether the
[Insert] key is on or off.
Tome1_2.book Page 302 Vendredi, 28. mai 2010 5:50 17
302
303
FontCondensed Enables you to find out whether FontSize Enables you to find out and
the characters of the text dis- modify the size of the font used
played in a cell are condensed in a cell
and to condense or not the cha- AnchorRateWidth Enables you to find out and
racters of the text displayed in a modify the anchor rate when a
cell cell stretches on the vertical axis
FontExtended Enables you to find out whether Type Enables you to find out the type
the characters of the text dis- of an object
played in a cell are condensed
and to condense or not the cha- Value Enables you to find out and
racters of the text displayed in a modify the text displayed in a
cell cell
FontBold Enables you to find out whether InitialValue Enables you to find out the initial
the text displayed in a cell is bold text displayed in a cell
and to modify the bold attribute Visible Enables you to find out whether
304
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WinDev Mobile).
305
10.1 Overview
You want to display a WinDev Mobile window on the window to display in the home screen. You also have the
home screen of a Pocket PC? All you have to do is gene- ability to propose a window for configuring the "Today
rate a "Today screen" (element of the home screen of Screen". Then, WinDev Mobile creates the necessary
Pocket PC). This feature enables you to display real-time files and installs them on the Pocket PC.
information such as stock market, sales, customers to Limitations: The "Today screen" is available only with
contact, … Pocket PCs that use ARM and x86 processors.
The principle is simple: just define in your application the
306
10.5 Tips
Tips for developing your Today Screen: available on the Pocket PC.
• The initialization code of the project will be automati- • Avoid using the Close function in the main window of
cally loaded when your "Today Screen" is run. This the Today Screen. Indeed, the location of the Today
process must contain no code used to open a window. Screen will remain visible.
• The Pocket PC must be reset if a load problem occurs • The height of the window of the Today Screen can be
Part 4: Managing controls, windows and pages
(error in the initialization code of the project for ins- modified at run time by the Height property.
tance). The Today Screen will be automatically disa- • The window for configuring the Today Screen is a stan-
bled during the reset. dard window, with a Close button used to validate the
• The window that constitutes the "Today Screen" can choices.
open one or more windows (via buttons for instance). • The position of the Today Screen is configured on the
• The following code enables you to make the window of Pocket PC (in the setting of "Today"). If the window
"Today Screen" transparent: used for the Today Screen is too large, it will extend
MyWindow..BrushColor = iTransparent beyond the screen. You can create a Today Screen that
covers the entire screen when the Pocket PC is started:
Caution: check the style used in respect to the themes the Today Screen becomes the Pocket PC’s dashboard.
Tome1_2.book Page 307 Vendredi, 28. mai 2010 5:50 17
307
308
after the drag and drop operation. cursor position or at the end of the lis-
To delete the selected elements (cut/paste) after the tview after the Drag/Drop
drag and drop operation, you need to program the drag
and drop.
TreeView The selected element(s) are not deleted (copy/paste) The selected elements are inserted at
after the drag and drop operation. cursor position or at the end of the tree-
To delete the selected elements (cut/paste) after the view after the Drag/Drop
drag and drop operation, you need to program the drag
and drop.
The behavior of these controls can be modified by programming.
Reminder: to select several elements, press the [Ctrl] key during the selection.
309
310
See the online help for more details about these functions.
These functions are only available in WinDev.
Tome1_2.book Page 311 Vendredi, 28. mai 2010 5:50 17
311
12.2 Choosing the languages supported by the project and the analysis
12.2.1 Languages supported by the project control panel of Windows).
The different languages supported by the project are This setting is performed in the "Languages" tab of the
defined in the project description ("Project .. Project project description ("Project .. Project description").
description .. Languages"). When creating an edit control or a table column for dis-
The selected languages will be offered for all the multilin- playing numeric data (number, currency, date, time,
gual resources that can be translated (control captions, duration, and so on), the input mask used will be the
menu options, help message associated with a control, mask defined in the language options of the project. This
etc.) option is available in the windows and in the pages.
At run time, when an edit control or a table column has a
When the project languages are modified, the modifica- mask "Defined by the project", the input mask and/or
tions will be automatically taken into account by: the display mask will automatically adapt according to
•for all the new elements or objects created in the the options selected in the project based on the lan-
WinDev or WebDev editor, guage displayed at run time.
•for any element or object opened in the WinDev or Remarque: the language options also let you define the
WebDev editor. direction for writing and the character set used
The main language corresponds to the language used by ("various" option).
default at run time. Executable program (WinDev and WinDev Mobile)
Linguistic options When creating the executable program, you can specify
The display of the numeric data found in the project the languages that will be taken into account by the exe-
(number, currency, date, …) can be configured in each cutable. You can for instance create a different executa-
language supported by the project. ble program for each language supported by the project.
This feature enables you to reduce the size of the execu-
The parameters used by default are the ones defined in table.
the linguistic options of Windows (accessible from the
Tome1_2.book Page 312 Vendredi, 28. mai 2010 5:50 17
312
12.2.2 Languages supported by the analysis An element can support more languages than the project
If your project uses an analysis, the choice of languages (if the element is shared among several projects that
supported by the analysis is performed in the data model support different languages for instance).
editor. Indeed, the same analysis can be shared among Displaying the languages supported by
different projects that do not propose the same langua- an element
ges. Therefore, the number of languages defined for the To find out which languages are supported by an ele-
analysis can be greater than the one defined for the pro-
ment:
ject.
• for windows, pages and reports: display the "Lan-
The configuration of the languages supported by the ana-
guage" tab of the description window.
lysis is performed in "Analysis .. Analysis description ..
International". • for the classes and the sets of procedures:
1. Select the class or the set of procedures in the
The different languages configured in the analysis will be
"Code" pane.
proposed:
2. Select "Languages" from the popup menu.
• when configuring the shared information of items. The This window enables you to add a new language. This
description of the controls linked to the items (options, language will be supported by the selected element.
Part 4: Managing controls, windows and pages
captions, …) can be entered in the different languages To add a language to the entire project, the language
supported by the analysis. When generating a "full must be added to the project description window
application RAD" or a window RAD, this information (see "Languages supported by the project").
will be automatically taken into account by all the lan-
guages common to the analysis and to the project. Synchronizing the element languages
• in the information printed in the program documenta- with the project
tion (notes about the file or the item). The "Synchronize with project" button (window for lan-
• in the information managed by "Reports and Que- guage management) enables you to synchronize the lan-
ries". If the "Reports and Queries" program is provi- guages of the current element with the ones defined for
ded with your WinDev application, you can translate the project.
the name of the file and the name of each item. There- After synchronization, only the languages supported by
fore, the user will be able to use the names correspon- the current project will be selected. These languages can-
ding to his own language when creating his reports and not be deselected. The other languages (not supported
queries. This information can be entered in the by the project) will be deleted and the existing transla-
"Reports & Queries" tab of the file and item descrip- tions will be lost.
tion.
Changing the language displayed in the
12.2.3 Languages supported by the different editors
project elements To change the language displayed in the editors (window,
page, code, report), select "Display .. Language dis-
By default, the different project elements (windows,
played". The corresponding shortcut is:
reports, code, classes, set of procedures, and so on)
support the same languages as the project where they • Ctrl + Alt + L to go to the next language.
were created. • Shift + Alt + L to go to the previous language.
313
Automatic translation of the interfaces Note: to prevent the automatic activation of the input lan-
For each object, different multilingual areas are dis- guage (language used by the keyboard) that corresponds
played in the description windows of the object. The mul- to the current language:
tilingual areas allow you to enter the information in the 1. Display the "Translation" tab of the WinDev
different languages supported by the project. options ("Tools .. Options of WinDev/WebDev/Win-
To translate this information from WinDev: Dev Mobile")
1. Configure the translation options of the software 2. Clear the "Enable the automatic change of the
used ("Tools .. Options of WinDev / WebDev / Win- input regional settings" option.
Dev Mobile .. Translation"). These options enable
you to define:
12.3.3 Translating specific windows and pages
•the default translation tool (and the transmission Management of HyperFileSQL errors
mode for the text to translate and for the translated By default, the windows/pages for managing the Hyper-
text) FileSQL errors are provided in English and in French. To
•the source language and the destination language translate them into another language, you must:
for the translation.
1. Include the default error windows/pages in your
314
315
12.5 Managing some specific character sets in the HyperFileSQL data files
When an application is used to display or save data in the on 2 bytes for instance).
HyperFileSQL files, this data is entered in the current lan- • The character set of the file must always be the one
guage. specified by ChangeCharset. Otherwise, when acces-
No specific management is required if the application is sing a string index (string, character, date, time) :
used in a country that uses a Latin character set. - Reading and searching for a record: no error will be
If the application is used in a country that uses a specific displayed. However, the data read will not correspond
character set, this character set must also be supported to the expected data.
by the data files. Therefore, the searches, the sorts, ... - Modifying a record (addition, modification, deletion
will be performed according to the selected character of records or crossed records): a WLanguage error will
set. be displayed.
• No query with joins can be performed on text items that
12.5.1 Defining the character set of a data file use different character sets.
To define the character set used by a data file: Example: Creating a data file in Hebrew
1. Define the character set with ChangeCharset // Language used in the application:
. Hebrew
2. Create the data file with HCreation (or HCreatio- Nation(28)
nIfNotFound). In these functions, use the hChange- // Change the character set
Charset constant to take into account the character ChangeCharset(charsetHebrew)
set specified by ChangeCharset. // Create the data file
// Taking into account the new
All the functions used to perform sorts, searches, ... will // character set
use the features of the selected character set. HCreate(Azaa,"","","",…
hChangeCharset)
Notes and limitations // Enter a record
• The length of string items specified in the analysis is Azaa.toto = "\x96 éâ\x91 \xb2 éç\x93
expressed in bytes and not in characters. Depending \x98 \x91 \xb2 â\x91 ê\xb2 é\x98 "
on the character set used, you may have to increase HAdd(Azaa)
the size of the item (if the characters used are coded
Tome1_2.book Page 316 Vendredi, 28. mai 2010 5:50 17
316
12.5.2 Changing the character set of a data 12.5.3 Finding out the character set of a data
file file
In some cases, you may want to change the character set To find out the character set used by a data file, use the
of a data file without re-creating this file. For example, Charset property on the chosen HyperFileSQL data file.
• a data file was translated Example: Changing the fonts according to the character
• a data file is filled when installing an application with set of the file read:
the data corresponding to the setup language, … HOpen(Customer)
FileLanguage is int …
To modify the character set used for the searches, the = Customer..Charset
sorts: // Change the character set displayed
1. Specify the character set to use with ChangeChar- // according to the file’s format
set. SWITCH FileLanguage
2. Re-index the data file with the HIndex function. CASE charsetArabic :
Use the hChangeCharset constant to take into ChangeCharset(charsetArabic)
account the character set specified by ChangeChar- CASE charsetDefault :
set.
Part 4: Managing controls, windows and pages
ChangeCharset(charsetDefault)
CASE charsetGreek :
ChangeCharset(charsetGreek)
CASE charsetHebrew :
ChangeCharset(charsetHebrew)
CASE charsetOccidental :
ChangeCharset(charsetOccidental)
OTHER CASE
// Switch to the western character set
ChangeCharset(charsetOccidental)
END
317
318
MouseCursor Enables you to find out and modify the rollover cursor defined for a control or a window
StartDate Enables you to find out and modify the rollover cursor defined for a control or for a win-
dow
EndDate Enables you to find out and modify the end date of a period selected in a Calendar con-
trol.
Moveable Enables you to find out whether a table column can be moved by the user and to allow/
forbid the user to move a table column
MoveableByBackground Enables you to find out whether a window can be moved by its background and to make the
window movable (or not) by its background
Description Enables you to find out and modify the description associated with a page.
Detection Enables you to find out and modify the mechanism for automatic detection of incoming
streams
DisplayCurrency Enables you to find out and modify the currency used when displaying or entering a
value in an edit control or column of "Currency + Euro" type
MemoryCurrency Enables you to find out and modify the currency used when handling an edit control or
Part 4: Managing controls, windows and pages
319
InitialHeight Enables you to find out the initial height of a control or window and to modify the base
height used to anchor controls "in height"
LineHeight Enables you to find out and modify the height of the rows in a list box, a table or a
combo box
MaxLineHeight Enables you to find out and modify the maximum height of the table rows (for the multi-
line rows with automatic resizing)
MaxHeight Enables you to find out and modify the maximum height of a control or window
MinHeight Enables you to find out and modify the minimum height of a control or window
HTMLAfter Enables you to find out and modify the HTML code inserted after the control.
HTMLBefore Enables you to find out and modify the HTML code inserted before the control.
Identifier Enables you to find out and modify the name under which the current computer appears to
its correspondents (corresponds to the number display)
Image Enables you to find out and modify the image associated with a control (button, tab,
menu option), with a cursor (progress bar, slider) or with the toolbar of a MDI parent
window
320
Memory Enables you to find out whether the specified control is a browsing table or a memory
table, list box or combo box, or looper
PopupMenu Enables you to find out and modify the popup menu associated with a control
Message Enables you to find out and modify the help message
Miniature Enables you to find out and modify the image associated with an element of a listview
ListViewMode Changes the display mode of the listview (switch from listview to standard and conver-
sely)
MagnifierMode Enables you to find out and modify the management mode of the magnifier in the title
of the columns found in a table or in a treeview table.
Modified Enables you to find out whether a control was modified by the user (with the keyboard
or the mouse)
Password Enables you to find out whether an edit control is a "Password" control
Keywords Enables you to find out and modify the keywords associated with a page.
Multiline Enables you to find out whether an edit control or a table column is multiline
Part 4: Managing controls, windows and pages
Multiselection Enables you to find out and modify the selection mode of a table, list box, looper
NbLinesPerPage Enables you to find out and modify the number of rows in a table or a looper control dis-
played in a page
Name Enables you to find out the name of a control or group of controls of a window ir a page
NumberColumn Enables you to find out the number of columns in a multi-column list or in table and to
modify the number of columns found in a multi-column list
NumberPage Enables you to find out the number of pages in a "multi-page" image file
FullName Enables you to find out the full name of a control, a group of controls or a window
Note Enables you to find out and modify the notes associated with a control, a window or a
page
NewLine Enables you to find out whether the current row in a table or a looper control was just
created using one of the TableAdd, TableAddLine, TableInsert and TableInsertLine func-
tions
HelpNumber Enables you to find out and modify the help number associated with a control
PageNumber Enables you to find out and modify the page number displayed in an image control
(case of the "multipage" type image files)
TABOrder Enables you to find out the position of a control in the navigation order of a window
Occurrence Enables you to find out the number of rows in a list box, a table, a looper or a combo
box; the number of rows found in a table columns; the number of options found in a
radio button or check box control; the number of controls found in a group of controls
VerticalOrientation Enables you to find out and modify the orientation of a listview
AutoBrowse Enables you to find out whether a browse performed in a looper, browsing table, list box
or combo box is managed automatically or by programming
AnimationPeriod Enables you to find out and modify the rotation period of Cube and Carousel controls
Plane Enables you to find out and modify the active plane of a window or to associate a con-
trol with another plane
Font Enables you to find out and modify the font used in a window control
FontCharset Enables you to find out and modify the character set currently used by the font of a con-
trol
FontStrikeOut Enables you to find out and modify the "Strikeout" attribute for the content of a control
FontCondensed Enables you to find out whether the characters of the text displayed in a control are
condensed and to condense (or not) the characters of the text displayed in a control
FontExtended Enables you to find out whether the characters of the text displayed in a control are
extended and to extend (or not) the characters of the text displayed in a control
FontBold Enables you to find out and modify the "Bold" attribute for the content of a control
FontItalic Enables you to find out and modify the "Italic" attribute for the content of a control
Tome1_2.book Page 321 Vendredi, 28. mai 2010 5:50 17
321
FontLarge Enables you to find out whether the characters of the text displayed in a control are
enlarged and to enlarge (or not) the characters of the text displayed in a control
FontName Enables you to find out and modify the font used in a control
FontUnderlined Enables you to find out and modify the "Underline" attribute for the content of a control
FontSize Enables you to find out and modify the size of the font used in a control
IncomingData Enables you to find out and modify the type of data received by the stream
LeftIndent Enables you to find out and modify the free space on the left of the text in the table columns
RichEdit Enables you to find out whether a window control is in RTF format (Rich Text Format)
DisplayedItem Enables you to find out and modify the item displayed in a table, a looper, a list box or a
combo box
DisplayedItemImage Enables you to find out and modify the item corresponding to the image displayed in a
listview
StoredItem Enables you to find out or modify the item stored in a table, a looper, a list box or a
combo box
322
URL Enables you to find out the address associated with a link, a button or a clickable
image
Value Enables you to find out and modify the value of a control, a window or a page
DisplayedValue Enables you to find out the current value displayed in a window control or a page
InitialValue Enables you to find out the initial value of a window control or a page control
StoredValue Enables you to find out the value that will be stored when selecting an element from
the list box
ReturnedValue Enables you to find out and modify the value returned by a window
CheckSpell Enables you to find out whether the spelling checker of OpenOffice is proposed (or not) in
an edit control or in a table column and to enable it if necessary.
Vertical Enables you to find out whether a control is oriented horizontally or vertically
Empty Enables you to find out whether a table, a looper, a list box or a combo box is empty
Visible Enables you to find out whether an element (control, group of controls, window or page)
is visible and to make an element (control, group of controls, window or page) visible/
Part 4: Managing controls, windows and pages
invisible
InitialVisible Enables you to find out whether a control or a window was visible when it was created
X Enables you to find out and modify the x-coordinate of a control, table column or win-
dow (position on the X axis)
XImage Enables you to find out and modify the initial x-coordinate of an image in an image con-
trol
XInitial Enables you to find out and modify the initial x-coordinate of a control or window
Y Enables you to find out and modify the y-coordinate of a control or window
YImage Enables you to find out and modify the initial y-coordinate of the image in an image con-
trol
YInitial Enables you to find out and modify the initial y-coordinate of a control anchored "at the
bottom"
Zoom Enables you to find out and modify the value of the zoom performed in an image control
See the online help for more details.
See the online help to check the availability of these properties in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 323 Vendredi, 28. mai 2010 5:50 17
PART 5
Standard functions
Tome1_2.book Page 324 Vendredi, 28. mai 2010 5:50 17
Tome1_2.book Page 325 Vendredi, 28. mai 2010 5:50 17
325
1.2 Matrices
A large number of WLanguage functions let you handle number of rows and columns of the matrix.
matrices. The size of your matrices can be managed dynamically.
Matrices are mathematical tools used to simplify and Indeed, a matrix is empty when it is created: it has 0 row
solve many problems. Calculations on matrices are used and 0 column. The dimension of this matrix is 0 x 0. Sim-
in many fields: economy, physics, etc. ply initialize an element in row n and column p and the
In these fields, the problems can often be formulated as size of the matrix becomes n x p. For example, once an
a set of equations. The result of this set of equations can element is initialized in row 6 and column 12, the size of
be calculated via matrices. the matrix becomes 6 x 12.
326
The functions used to calculate statistics start with • calculate the variance and covariance,
"Stat". These functions are used to: • calculate the standard deviation, etc.
327
328
329
330
331
Reverse Returns for each character found in a character string the complement to 255 (the character
string is reversed)
Upper Converts a character string into uppercase characters, according to the localization settings
defined in Windows (accents are kept)
Middle Extracts a sub-string from a given position in a string
Lower Converts a character string into lowercase characters, according to the localization settings
defined in Windows (accents are kept)
NumToString Transforms a numeric value (integer, real or currency) into a character string according to
the specified format
OemToAnsi Converts a character string in OEM format (DOS) into a character string in ANSI format (Win-
dows)
Phonetic Detects whether two character strings are phonetically similar (based on French phonetics)
Position Searches for the position of a character string inside another character string
PositionOccurrence Searches for the Xth position of a character string inside another character string
Replace Replaces all the occurrences of a word found in a string by another word
RepeatString Concatenates N repetitions of the same character string
NoAccent Transforms the accented characters found in a character string into non-accented charac-
ters
NoSpace Returns a character string without the space characters found on the right or on the left
ArrayToString Converts a one-dimensional array or a two-dimensional array into a character string.
Length Returns the length of a character string (number of characters)
CommonLength Returns the number of characters common to two character strings
LengthToString Converts a length expressed in bytes into a character string formatted in kilobytes, megaby-
tes or terabytes
TextToXML Converts a character string in ANSI format into a character string in XML format
UnicodeToAnsi Converts a character string in Unicode format into a character string in ANSI format (Win-
dows)
332
3.3 Handling the dates and times found in the edit controls
The values found in the edit controls can be handled by See the Date types (page 179), Time types (page 179),
the date or time variables. DateTime types (page 179) and Duration types (page
Part 5: Standard Functions
To do so, assign the content of the control to the variable. 180) for more details.
StartDate is date
StartDate = DateControl
// Assign the variables with
// the content of the control
333
334
4.1 Overview
WinDev, WebDev and WinDev Mobile propose a chart ric data. The charts are used to efficiently display this
control (that can be used in the window editor, page edi- type of data.
tor and report editor) as well as functions for creating and Several types of charts can be created: Pie, Bar, Line and
handling charts. Scatter charts. The display options are used to produce
Most applications and sites use a large number of nume- different visual effects for each type of chart.
335
4.2.6 3D charts
All types of charts can be displayed in 3D.
336
337
338
339
340
The last four currencies of this list are user-defined cur- gramming using eDefaultViewCurrency.
rencies: they are available for adding currencies created • The caption of the currency will be displayed beside the
by programming using eInitCurrency. value if the $ sign is specified in the display mask. For
Note: the <Default> currency is the Euro by default. This example: "$ 999.99" will display the following in
default currency can be retrieved and modified by pro- francs: F 945.00.
gramming with eDefaultViewCurrency.
5.2.3 WinDev tooltip
5.2.2 Input currency and display currency A tooltip can be automatically displayed when hovering
The display currency corresponds the currency in which the edit controls (or the table columns) in order to display
the value of the control is displayed or entered. The dis- the entered value in a different currency.
play currency is displayed according to the input mask
specified for the control. Conversion rules in the tooltip
If the displayed currency differs from the stored currency, The tooltip displays the value of the converted control:
the conversion is automatically performed between the •in the specified currency,
display currency and the stored currency. Using a display •in the stored currency if the currency of the tooltip is
currency different from the stored currency enables you the default currency and if the stored currency differs
to store a single currency in the file: the stored value can from the display currency,
be displayed in any currency. •in Euro if the currency of the tooltip is the default cur-
Caution: to prevent errors, you should use the same num- rency and if the stored and display currencies are
ber of decimal places: identical but differ from the Euro,
•in the display mask and in the input mask of the con- •in Franc if the currency of the tooltip is the default
trol, currency and if the stored and display currencies are
•in the rounding of the stored currency. identical and correspond to the Euro.
The displayed currency can be modified by programming Configuring the display of the tooltip
with DisplayCurrency. The currency used for the tooltip is chosen in the window
WinDev advanced configuration editor in the advanced options of the Euro. This currency
Advanced parameters can be used for an edit control and is selected from a list displaying the different currencies.
for a table column: This list contains:
Part 5: Standard Functions
• Currency modifiable via a popup menu: the user can •the number identifying the currency,
choose the display currency via a popup menu. This •the abbreviation of the currency according to the ISO
popup menu presents the result of the conversion for standard,
the value entered in the different currencies. The •the name of the country corresponding to this cur-
popup menu only displays the currencies whose rency.
exchange rate differs from zero. The last four currencies of this list are user-defined cur-
• Display a tilde (~) in case of a rounding difference: rencies: they are available for adding currencies created
this tilde indicates a rounding difference between the by programming using eInitCurrency.
value expressed in the display currency and the value Note: the <Default> currency is the Euro by default. This
expressed in the stored currency. default currency can be retrieved and modified by pro-
Configuring the display currency gramming with eDefaultViewCurrency.
The displayed currency is chosen in the window or page 5.2.4 WinDev dual display
editor from a list displaying the different currencies. This
list contains: The dual display enables you to display the same value
expressed in different currencies in two controls. The fol-
•the number identifying the currency, lowing vocabulary is used:
•the abbreviation of the currency according to the ISO • Base control: control where the value is entered.
standard,
• Tracker control: control displaying the value of the base
•the name of the country corresponding to this cur- control in another currency. The value displayed in the
rency. tracker control always reflects the value entered in the
The last four currencies of this list are user-defined cur- base control.
rencies: they are available for adding currencies created Notes:
by programming using eInitCurrency.
• If the base control is an edit control, the tracker control
Notes: is an edit control.
• The <Default> currency corresponds to the Euro. This • If the base control is a table column, the tracker control
default currency can be retrieved and modified by pro-
Tome1_2.book Page 341 Vendredi, 28. mai 2010 5:50 17
341
is another column of the same table. code used can be for example:
• A base control can be the tracker control of its own --Displaying a table row
tracker control. In this case, you have the ability to PriceEuro=eToEuro(Upbt, 1)
enter a value in the two controls. The associated con- PriceEuro: name of the column displaying the value in
trols will be updated automatically. Euro.
Example: Upbt: name of the column linked to a HyperFileSQL file
The "EDIT1" control is used to enter a value in Francs. It item, displaying the value in Francs.
is associated with the "Price BT" item. Its tracker control The column used for dual display is updated automati-
is the "EDIT2" control. The values entered in the EDIT1 cally:
control will be automatically converted into Euros in the - when the base column is modified by the user,
EDIT2 control. - when the base column is modified by programming.
The "EDIT2" control is used to enter a value in Euros. Its Reminder: The functions for reading or displaying files in
control for dual display is the "EDIT1" control. The values a table have no effect on a calculated column.
entered in the "EDIT2" control will be automatically con- Advanced configuration
verted to Francs in the "EDIT1" control.
Display the rounding difference in the status bar is
In this example, the prices are stored in Francs in the available for an edit control and for a table column.
HyperFileSQL file.
This option is used to display the rounding difference that
Operating mode of dual display for an edit control occurs when converting the value between the base con-
A tracker edit control is updated: trol and the tracker control. This rounding difference will
•when the user enters a value in the base control, be expressed in the weakest of the two currencies: for this
currency, its lower unit has the smallest value.
•when assigning the value of the base control by pro-
gramming, For example, 1 centime in French Francs is weaker than 1
cent in Euros: the difference will be expressed in French
•When using FileToScreen, if the tracker control is not Francs.
linked to a HyperFileSQL item.
Note: the currency used for the rounding difference will
Special case: the conversion is not performed if the trac- be displayed in the message. This rounding difference
ker control is linked to a HyperFileSQL file item. can also be returned by
eRoundDifference.
342
343
344
345
346
347
8. PRINTING IN WLANGUAGE
8.1 Overview
There are several ways you can print: Furthermore, for very simple printouts (text or images),
•The report editor, for creating "preset reports". you don’t even need to use the report editor.
•The print functions in WLanguage. Notes:
The report editor • The print functions are not available with external lan-
The report editor enables you to create printed reports (in guages.
report or label format) containing information coming • This chapter only describes the principle for printing in
from data files. WLanguage.
The print functions in WLanguage WB Important: the use of the WLanguage print
For special printing, the report editor may not be able to functions requires a specific configuration
create the reports you want. In this case, use the print of your server. See the online help for more
functions of WLanguage. details.
348
The configuration and the setting performed by iConfi- These fonts are called "printer fonts".
gure and iParameter reinitialize the print module. There- Unlike software fonts (such as "TrueType"), these fonts
fore, these functions must be the first print functions are directly accessible by the printer, they do not have to
called. All the print functions called before these two be downloaded.
functions will be ignored. In the lists of fonts, the printer fonts are identified by a
"printer" icon in front of the font’s name.
8.2.2 Step 2: Creating print fonts
Caution: using print font can create display effects in
This step enables you to define and choose the different print preview mode.
fonts that will be used in the printed document. You can
choose and define: If you use printer fonts, these fonts will be interpreted by
the printer only. During the print preview, the display of
•print specific fonts: these fonts can be used only the fonts is managed by Windows. As it does not support
when printing through WLanguage functions. these specific fonts, Windows uses the nearest display
•dynamic fonts that can be used for display (in win- font.
dows, drawings, etc.) as well as when printing
through WLanguage. 8.2.3 Step 3: Printing
This step is optional. This step consists in "sending to the printer" the diffe-
rent elements to print: text, images, drawings, etc.
The default font is used if no font is specified for the prin- The actual printing on the requested support (configured
tout. This font has the following characteristics: by iPreview) will happen at the end of the print opera-
•Font: Don’t care tions (iEndPrinting).
•Font #0
Printing text
•Size: 12 pica points
The main WLanguage functions used to print text are as
•Normal style follows:
•Color: Black • iTextHeight: calculates the height of the font for the text
Print font to print (in millimeters.
The print fonts are created by iCreateFont. This function • iZoneHeight: calculates the necessary height of a
enables you to choose: fixed-width area in order for the entire text to be printed
in this area.
Part 5: Standard Functions
349
• Texts can be printed in specific positions: fiXPos and • iLine: Prints a line at the specified coordinates.
iYPos. • iHLine: prints a horizontal line at the specified coordi-
Printing images nates.
Several WLanguage functions enable you to print images • iVLine: prints a vertical line at the specified coordinates.
while respecting their size. Other functions
• iImageHeight: calculates the height of the image to Several WLanguage functions are used to optimize the
print (in millimeters). printouts performed in WLanguage. You have the ability
• iPrintBarCode: prints a bar code in a rectangle. to manage:
• iPrintImage: sends the image file to print to the print •page breaks,
buffer. •the print job’s cancellation by the user,
• iImageWidth: calculates the width of the image to print •the page size.
(in millimeters).
• iTransparentMagenta: modifies the setting of the • iWindowCancel: configures the display of the window
Magenta color so it is made transparent or not for used to cancel the current print job (WinDev only).
future print jobs. • iEndPrinting: indicates the end of the document to
• iXPos: manages the horizontal position (x-coordinate) print and actually starts printing the data stored in the
of the print cursor in the page. print spooler.
• iYPos: manages the vertical position (y-coordinate) of • iPageHeight: calculates the printable height of the
the print cursor in the page. page taking the defined margins into account.
• iPageHeightLeft: calculates the remaining available
Printing drawings height on the current page, taking the defined margins
The following WLanguage functions enable you to easily (top and bottom) into account.
print different shapes: • iDocumentCanceled: enables you to find out whether
• iBorder: prints a border using the specified coordinates. the user requested to cancel the printing of the current
• iEllipse: prints an ellipse inside a rectangle. document (WinDev only).
• iPrintBarCode: prints a bar code in a rectangle. • iDocumentPrinted: enables you to find out whether the
• iNewLine: prints a line (in Windows standard, with a user requested the printing of the document from the
print preview window (WinDev only).
350
351
iParameterPDF Defines the protection options for the generated PDF file
iParameterXLS Defines the options for the XLS file generated during the printout. The current layout
(color and font) can be taken into account or not.
iPicaToMM Converts the coordinates of a point (expressed in system coordinates) into millimeters
iFont Selects the default font
iDidotFont Selects the unit that will be used for the height of the fonts (created by iCreateFont):
DIDOT point or PICA point
iXPos Used to manage the horizontal position (x-coordinate) of the print cursor in the page
iYPos Used to manage the vertical position (y-coordinate) of the printout cursor in the page
iRAZ Reinitializes the print parameters stored in the print library
iDirImageHTML Used to select the directory of the generated images during a printout in HTML format
iSkipLine Forces a line break.
iSkipPage Generates a page break
iSelectFont Creates a new print font from the window for selecting the Windows fonts
iStatusReportPrintout Returns the status of the current printout
iSubstBlock Substitutes a report block for another one while the report is printed
iPageEnd Forces the move to the next page while a report is printed
iLine Prints a line at the specified coordinates
iHLine Prints an horizontal line at the specified coordinates
iVLine Prints a vertical line at the specified coordinates
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
352
9. MANAGING MS WINDOWS
9.1 Overview
A large number of WLanguage functions let you manage • services,
MS Windows. • Windows,
You have the ability to manage: • Windows events,
• the registry with the registry functions, • Java applications,
• the Windows clipboard, • executables,
• the Windows recycle bin, • DDE communication,
• the mouse, • agents,
• serial and parallel ports, • the network,
• Twain devices, • the SNMP protocol,
• USB devices, • the project,
• the system, • the scheduler.
353
The following functions are used to manage the serial and parallel ports:
sComputeCrc16 Checks a character string before and after transmission between WinDev applications
sComputeCrc32 Checks a character string before and after transmission between WinDev applications
sInEntryQueue Retrieves the number of pending bytes in the input buffer of a specified serial port
sInExitQueue Retrieves the number of bytes waiting to be transferred into the output buffer of the specified
serial or parallel port
sEscape Runs different functions that directly affect the bits of the serial port or parallel port, indepen-
dently of the communication protocol
sWrite Writes a character string into the output buffer of the specified serial port or parallel port
sEvent Branches an event on a serial port.
Tome1_2.book Page 354 Vendredi, 28. mai 2010 5:50 17
354
• save the document coming from the Twain device in a GIF file.
• view the document coming from the Twain device in the user interface of the device.
TwainToJPEG Enables you to:
• save the document coming from the Twain device in a JPEG file.
• view the document coming from the Twain device in the user interface of the device.
TwainToClipboard Enables you to:
• copy the document coming from the Twain device into the clipboard.
• view the document coming from the Twain device in the user interface of the device.
TwainScanZone Enables you to define or reinitialize the area to scan.
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 355 Vendredi, 28. mai 2010 5:50 17
355
The following functions are used to manage MCI (Media Control Interface):
MCIStopPlaying Stops the execution of a multimedia file
MCIBegining Enables you to point to the beginning of a multimedia file
MCIErr Returns the number of the last error caused by a MCI function
MCIStatus Enables you to find out the status of a multimedia file
MCIExecute Runs a MCI command
MCIClose Closes a multimedia file
MCIEnd Enables you to point to the end of a multimedia file
MCIPositionFormat Sets the format of the position for a multimedia file
MCIHeight Returns the height of a multimedia file (in pixels)
356
357
SysListVideoCard Returns the name of the video cards connected to the current computer.
SysListScreen Returns the list of the screens connected to one or more video cards.
SysListScreenOrienta- Enables you to find out the possible orientations of a Pocket PC screen.
tion
SysListScreenResolution Returns the list of possible resolutions for a screen.
SysMetric Returns the resolution of a specific element
SysStandby Enables you to find out and modify the amount of idle time before the current Pocket PC
switches to standby mode. This function is also used to enable and disable the standby
mode for a Pocket PC
SysErrorMode Modifies the display mode of errors
SysNumberScreen Returns the number of screens currently connected to the current computer
SysNameMainScreen Returns the name of the main screen
SysNameExe Returns the name and the full path of an application
SysGetDC Retrieves the DC (Device Context) of a window, control or screen
SysDir Returns the path of a system directory
SysDirStorageCard Returns the list of storage cards found in the current Pocket PC
SysScreenResolution Returns the characteristics of the screen resolution
SysWindowsVersion Returns information about the Windows version used on the current computer
SysXRes Returns the horizontal resolution of the screen
SysYRes Returns the vertical resolution of the screen
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
358
Transfer Copies a block of bytes or a fixed-length string from a memory address to another memory
address
WindowsVersion Returns the runtime mode of the program in the current environment
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
359
360
LargeFontFactor Returns the current enlargement ratio of a WinDev window (only if Windows is in
large font mode)
HelpFile Returns or modifies the name of the help file used by the context-sensitive help of a
window
FileDisplay Returns a specific file to the client browser
EndAutomatedProcedure Stops the current or forthcoming execution of an automatic procedure (defined by
the properties of the procedure in the code editor)
EndProgram Ends the execution of the current program
fDataDir Returns the full path of the directory for the HyperFileSQL data files
fWebDir Returns the physical name of the directory containing the images, the Javascript
files and the Java files of the WebDev site
Random Returns a random number
Hasp Interrogates an electronic HASP key
INIWrite Writes a specific value into a INI file
INIRead Reads the content of a INI file
InitRandom Initializes the generator of random numbers
JSONExecute Calls a server URL of the same domain that returns data in JSON format
JSONExecuteExternal Calls an external server URL that returns data in JSON format
JSProperty Enables you to handle specific features on the objects found in the current page
RunReportsAndQueries Starts Reports and Queries
CommandLine Identifies and retrieves the different elements of the command line passed in para-
meter to the current program
ExecutionMode Returns or modifies the behavior of the application (site) when some errors are
generated
NumHelp Returns the number of the help context associated with the specified control
ConfigureAAF Enables you to specify the behavior of some automatic features of the application
(AAF).
Part 5: Standard Functions
ConfigureSpellCheck Configures the spelling checker of OpenOffice for the edit controls and for the table
columns found in the application. You have the ability to specify the language in
which the spell check must be performed.
FolderWeb Returns the path of the directory containing the images, the Javascript files, …
sComputeCrc16 Checks whether a character string has been transmitted properly in case of trans-
mission with risk of information loss
ScriptDisplay Calls an external script (.php or .asp for instance) and returns the result page in the
current window of the browser
ScriptExecute Calls an external script (.asp or .php for instance) and returns the result in a string
(an http query is performed, allowing you to use either a POST method or a GET
method)
SelectColor Opens the standard window for color selection
Sound Plays a sound in WAV format
SSLActive Enables you to enable or disable the SSL secure mode.
MouseXPos Returns the horizontal position of the mouse cursor
MouseYPos Returns the vertical position of the mouse cursor
DrawingStyle Enables you to modify some parameters for the display mode of windows
Trace Displays the requested information (content of a control for instance) in a window
opened in parallel of the current window
StartTrace Opens the trace window
EndTrace Closes the trace window if this window was opened
TypeVar Identifies the type of an expression, a variable (during a call to a procedure for ins-
tance) or a control
DataType Identifies the type of a WLanguage variable
Tome1_2.book Page 361 Vendredi, 28. mai 2010 5:50 17
361
UploadCopyFile Saves on the server a file "uploaded" by a Web user (i.e. sent by a Web user to the
server via an "Upload" edit control)
UploadFileName Returns the name of a file "uploaded" by a Web user (i.e. sent by a Web user to the
server via an "Upload" edit control)
VariableReset Resets the variable to its initial value
VariantConvert Converts the value stored in a Variant variable
WinDevVersion Returns the version number of the WD150WM DLL of WinDev
WHelp Displays a file or a help page in HLP or CHM format
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
362
The following functions are used to manage DDE (Dynamic Data Exchange):
DDEString Returns the information retrieved by DDERetrieve
DDEConnect Opens a DDE connection between the current program and the recipient according to a given sub-
ject
DDEDisconnect Deletes a connection between the current program and a recipient
DDERecipient Identifies the recipient of a DDE connection
DDESend Sends data to the program connected via DDE
DDEError Returns the status report about the execution of a function used to manage the DDE dialog
DDEEvent Associates a procedure written in WLanguage with a DDE event
DDEExecute Sends a command to run
DDEUnLink Interrupts a link between an item and a data
DDEItem Identifies the item affected by a DDE event
DDEStart Runs a program from the current application or site
DDELink Creates a hot link with a data
DDEWarmLink Creates a warm link with a data
DDEUpdate Modifies a linked data
DDERetrieve Retrieves a data sent by a program (the recipient of the connection for the specified object)
DDETopic Identifies the subject of the conversation associated with a DDE connection
See the online help for more details about these functions.
363
364
365
10.1 Overview
Some WLanguage functions enable you to manage your •get information about your ".XLS" files found on the
".XLS" type files from your applications or from your first page of the workbook (cell data, number of rows,
sites. These functions enable you to retrieve the data number of columns, column type, column title),
entered in Excel. •find out the Excel version used,
These functions are used to: •identify the errors that occurred during the different
•work with ".XLS" files (open and close), operations performed on an ".XLS" file.
366
367
368
369
zipExist Enables you to find out whether an archive exists. An archive exists if it was opened by
the zipOpen function or if it was created by the zipCreate function.
zipExtractPath Returns the initial path of a file found in the archive
zipExtractFile Extracts a file from an archive and decompresses it
zipExtractFileList Extracts and automatically decompresses a list of files found in an archive to a physical
location.
zipExtractAll Extracts all the files from an archive and decompresses them
zipClose Closes an archive
zipCurrentFile Returns the name of the file currently processed by the functions for adding and extrac-
ting files
zipInfoFile Returns information on a file or archive (stored path, size before and after compression,
etc.)
zipListFile Returns the list of files found in the archive
zipPassword Defines the password used to add files to the specified archive and to extract files from
the specified archive
zipMsgError Returns the message associated with an error number
zipNbFile Returns the number of files found in an archive
zipNbPart Returns the number of parts found in an archive
zipNbPartNeeded Returns the number of parts of a given size required to contain the archive
zipCompressionLevel Changes the level of compression used when creating an archive in ZIP format
zipOpen Opens an existing archive
zipOpenCAB Opens an existing CAB archive
zipOpenRAR Opens an existing RAR archive
zipMerge Merges the different parts of an archive to create a single-part archive
zipDeleteFile Deletes a file from an archive
zipDeleteFileList Deletes a list of files from an archive
zipDeleteAll Deletes all the files from an archive
370
12.1 Overview
Several WLanguage functions are available for burning In WinDev, CD burning functions are available only for
CDs or DVDs. You can create: Windows XP and higher.
•data type CDs/DVDs. In WebDev, the burning will be done on the Web server.
•audio CDs. This server must be equipped with Windows XP or later.
Note: You can only burn files onto a CD or a DVD. You can-
not copy a CD or DVD directly.
2. If needed, open the tray of the current burner 7. If needed, retrieve the characteristics of the com-
(BurnerEject). pilation with BurnerCompilationInfo.
3. If needed, specify the type of the CD/DVD to 8. Burn the selected files on the CD/DVD with Bur-
create: nerSave. A WLanguage procedure ("callback") is
regularly called during this burn process. This proce-
BurnerMediaInfo Retrieves the characteristics of the dure is used to manage the different events that
CD/DVD found in the current bur-
ner occur.
9. If needed cancel the current burn operation (Bur-
BurnerMediaType Enables you to find out and modify
the format of the CD/DVD to burn nerCancel).
Tome1_2.book Page 371 Vendredi, 28. mai 2010 5:50 17
371
372
These functions let you access Pocket PCs from a standard WinDev application.
ceConnect Connects the current computer to a Pocket PC
ceCopyFile Copies a file found on the current computer to the connected Pocket PC; found on
the connected Pocket PC to the current computer; found on the connected Pocket
PC to another directory on Pocket PC
ceCreateShortcut Creates a shortcut on the Pocket PC connected to the current computer
ceFileDate Returns or modifies the different dates associated with a file (creation, modifica-
tion or access)
ceDisconnect Closes the connection between the current computer and the Pocket PC
cePowerStatus Returns information about the Pocket PC’s battery (the main one or the spare one)
ceConnectionStatus Enables you to find out the status of the connection between the current computer
and a Pocket PC
ceWinEnum Enables you to enumerate the Windows windows currently opened on the Pocket
PC
ceWinTitle Returns the title of the specified Windows window
ceFileExist Checks the existence of a file
ceFileTime Returns or modifies the different times associated with a file (creation, modifica-
tion or access)
ceOEMInfo Returns the OEM information of the Pocket PC connected to the current computer
ceRunExe Starts the execution of a program (an executable for instance) from the current
application
Part 5: Standard Functions
ceListFile Lists the files found in a directory (and in its sub-directories) and returns the num-
ber of listed files
ceMachineName Returns the name of the Pocket PC connected to the current computer
cePlatform Returns the name of the platform for the Pocket PC connected to the current com-
puter
ceRegistryNextKey Identifies the key found after the specified key in the registry of Pocket PC
ceRegistryCreateKey Creates a key in the registry of Pocket PC
ceRegistrySetValue Writes a value into a register of the Pocket PC registry
ceRegistryExist Checks the existence of a key in the Pocket PC registry
ceRegistryListValue Returns the name (and possibly the type) of the values for a key found in the regis-
try of the Pocket PC
ceRegistryQueryValue Reads the value of a register in the registry of the Pocket PC
ceRegistryFirstSubKey Identifies the key found after the specified key in the registry of Pocket PC
ceRegistrySubKey Identifies the path of the Nth specified sub-key in the registry of Pocket PC
ceRegistryDeleteKey Deletes a sub-key from the registry of the Pocket PC
ceRegistryDeleteValue Deletes a value from the registry of the Pocket PC
ceDir Searches for a file or for a directory on the Pocket PC connected to the current
computer
ceMakeDir Creates a directory on the Pocket PC connected to the current computer
ceRemoveDir Deletes a directory from the Pocket PC connected to the current computer
ceDeleteFile Deletes a file from the Pocket PC connected to the current computer
ceDeleteShortcut Deletes a shortcut previously created by ceCreateShortcut
ceSysDir Returns the path of a system directory for the Pocket PC connected to the current
computer
Tome1_2.book Page 373 Vendredi, 28. mai 2010 5:50 17
373
ceFileSize Returns the size (in bytes) of a file found on the Pocket PC connected to the current
computer
ceProcessorType Returns the type of processor for the Pocket PC connected to the current computer
ceWindowsVersion Returns information about the version of Windows used on the Pocket PC connec-
ted to the current computer
ceXRes Returns the horizontal resolution of the screen for the Pocket PC connected to the
current computer
ceYRes Returns the vertical resolution of the screen for the Pocket PC connected to the
current computer
See the online help for more details about these functions.
374
PART 6
Features
specific to the Web
Tome1_2.book Page 376 Vendredi, 28. mai 2010 5:50 17
Tome1_2.book Page 377 Vendredi, 28. mai 2010 5:50 17
377
1. FILE UPLOAD
1.1 Overview
The upload consists in saving on the Web server a file contact. In order for the photo to be displayed indepen-
accessible from the computer of the Web user. The file dently of the Web user, the photo is "uploaded" to the
found on the Web user’s computer is uploaded to the ser- server.
ver: it is loaded and saved on the server computer. • Document Management site: each user can make
All types of files can be uploaded. various types of documents available to all: text, ...
These documents are selected on the Web user’s com-
Examples for using the file upload: puter and "uploaded" to the server in order to be
• Address Book type site: when adding a new contact, made available to all the Web users.
the user can select from his computer a photo for the
378
2. FILE DOWNLOAD
2.1 Overview
The download is the operation that consists in saving a Some examples:
file stored on the server onto the computer of the Web • A DVD rental site lets you download movie trailers to
user. The file is "downloaded" to the computer of the your computer.
Web user. • Some documents can be downloaded into an applica-
tion for document management.
379
3. COOKIES
3.1 Overview
A cookie is a simple way to temporarily store information some personal details such as the user name, the pages
on the computer of the Web user. This information can be visited by the user, the date of the last connection, the
retrieved thereafter. option backup, …
When a user revisits a site, the site "recognizes" the user This information, saved as cookies, will be read during
through cookies. This enables you to avoid requesting the next connection to the site. The site can then propose
details already provided during a previous visit and to custom features to the Web user:
display custom pages. • advertising banner related to subjects looked up
Note: a cookie has an expiration date (by default, 30 during the last connection,
days after its creation). It is automatically destroyed by • custom home page with the user name and the date of
the browser of the Web user when its lifetime is over. the last connection,
Example for using cookies • special offers corresponding to the searches perfor-
A cookie is used to store on the computer of the Web user med during the last visit, …
380
• In browser code: Notes: when connecting to the web site, the server auto-
Use CookieWrite, and specify the cookie’s name, its matically reads all the cookies associated with the cur-
content and its duration. rent domain. CookieRead used:
The cookie is immediately created. • in server code, reads in memory and retrieves the con-
tent of the specified cookie.
3.3.3 Reading a cookie from the web user’s • in browser code, directly reads the content of the coo-
computer kie on the computer of the Web user.
To read a cookie on the user’s computer, use Cookie-
Read, and specify the cookie’s name.
Part 6: Web specific features
Tome1_2.book Page 381 Vendredi, 28. mai 2010 5:50 17
381
382
5.1 Overview
WebDev enables you to include Javascript files or exter- •be found in the _WEB directory of the site or be a file
nal resources in a WebDev project. These files can: external to the site
•be included at project level or at page level. •be in a specific format (ISO, UTF8, …).
Javascript file.
5. Select (if necessary) the requested encoding. If 5.2.6 To include an external resource in the
the encoding corresponds to "<Not defined>", the project:
encoding is automatically detected. 1. Display the project’s description ("Project .. Pro-
6. Validate. ject description").
2. Select the "Advanced" tab.
5.2.3 To include a Javascript file in the project: 3. Click the "Additional Javascript files (.js)" button.
1. Display the project’s description ("Project .. Pro- 4. Click the "Add a Web resource" button and spe-
ject description"). cify the address of the requested Web resource.
2. Select the "Advanced" tab. 5. Select (if necessary) the requested encoding. If
3. Click the "Additional Javascript files (.js)" button. the encoding corresponds to "<Not defined>", the
4. Click the "Add" button and select the path of the encoding is automatically detected.
Javascript file. 6. Validate
5. Select (if necessary) the requested encoding. If
the encoding corresponds to "<Not defined>", the 5.2.7 Automatic detection of the encoding
encoding is automatically detected. If the encoding corresponds to "<Not defined>", the
6. Validate. encoding is automatically detected:
•case of a Web reference: the server is queried. The
5.2.4 Including resources external to the site encoding is supplied by the server.
Including external resources in the site is used to include •case of a file reference: if the file is in UTF8 format,
the interface files (programming interface) proposed by the encoding is automatically switched to UTF8.
the external services (Web API) on the WEB. This gives
you the ability to interface with these external services in
browser code.
Tome1_2.book Page 383 Vendredi, 28. mai 2010 5:50 17
383
384
6. AJAX
6.1 Overview
The AJAX technology is available in WebDev. AJAX can be used at two different levels in a WebDev site:
What does AJAX mean and what are its benefits? •Automatic and instant AJAX: a simple click gives you
AJAX (Asynchronous Javascript and XML) is used to access to the benefits of AJAX. The code remains the
refresh the data modified in an HTML page without same.
having to redisplay the entire page. For example, if some •Programmed AJAX: use the AJAX functions for com-
elements found in the page displayed (content of the plex processes.
basket, characteristics of a product, list of cities, map,
and so on) are modified, only these elements will be Note: Only the recent browsers support the AJAX techno-
refreshed. The server does not have to send the entire logy (Internet Explorer 5.5 and later, FireFox 1.0 and later,
page to the computer of the Web user. Netscape 7 and later, Opera 8 and later, Safari 1.2 and
later). AJAXAvailable enables you to find out whether the
This technology has several advantages: current browser supports AJAX. If a process that uses the
•the server is less used. It can then support more AJAX technology is run on a browser that does not sup-
simultaneous connections. port this technology, the process is run "without " using
•the information is less bulky. the AJAX technology (the entire page is refreshed for ins-
tance).
•the transmission time is shorter.
•the display is instantaneous on the computer of the
Web user.
6.2.1 Overview
Execute the request: search for the characteris-
The diagram below presents the automatic and imme-
tics of the selected country.
diate use of AJAX in a WebDev site:
Send the result of the request back:
•without AJAX: the entire page is sent.
•with AJAX: only the characteristics of the
country are sent.
385
386
Button X X X X
(Static) (Color of the caption)
Link X X X X
(Static) (Color of the caption)
Pager * X
(Content)
Cell control X X
Page X
TreeView X X X X
Notes: •check "AJAX Mode" in the pager description window,
• The number of characteristics automatically managed "General" tab.
will increase in the forthcoming versions. •switch the click process of the pager control to auto-
• The elements not found in this list cannot be automati- matic AJAX mode (click "AJAX" in the process bar).
cally used by AJAX. Special characters
• To modify other characteristics, use programmed AJAX.
Some special characters are automatically replaced by
* The use of Pager controls is specific in AJAX mode. See an empty string ("") in AJAX mode. These characters are
the paragraph below for more details. the characters whose ASCII code is strictly less than 32,
apart from characters 9, 10 and 13 (TAB and CR respec-
6.2.4 Specific features tively).
Specific features of the Pager control In most cases, these special characters are not used in
the strings.
When a table or a looper is automatically updated in AJAX
mode, the content of the pager associated with this table
or with this looper is also automatically updated.
Part 6: Web specific features
387
Analyze the procedure’s result. To allow a server procedure to be called by AJAX, click
"AJAX" in the bar of the procedure:
Display the modified information. Only the relevant
controls will be refreshed.
6.3.2 Functions for AJAX management
Several AJAX functions enable you to manage complex
processes: Procedure that cannot be called by AJAX
AJAXAvailable Used to find out whether the AJAX
technology is supported by the cur-
rent browser.
AJAXExecute Runs a server procedure without
refreshing the page. This function is
a locking function. No process will
be run as long as the result of the
procedure run is not retrieved. Procedure that can be called by AJAX
Tome1_2.book Page 388 Vendredi, 28. mai 2010 5:50 17
388
6.3.4 WLanguage functions useless in AJAX PageInitializa-Resets (or not) the controls found in
All the functions available in WebDev server can be used tion the current page and runs the initiali-
in AJAX. However, the folllowing functions are useless in zation processes of the controls
AJAX. Therefore, these functions are not available in AJAX. PageUse Displays a WebDev page in the brow-
StringDisplay Displays a character string (or a buf- ser of the Web user and closes all the
fer) in the browser current page contexts
ContextClose Closes a page context ScriptDisplay Calls an external script (.php, .asp,
.mhtml or .mht) and returns the result
ContextOpen Opens a new page context without page in the current browser window
returning the information to the brow-
ser UploadCopyFile Saves on the server a file "uploa-
ded" by the Web user
FileDisplay Displays a file in the browser of the
Web user UploadFileName Returns the name of a file "uploa-
ded" by the Web user
FramesetRe- Refreshes a frameset displayed in the
fresh browser of the Web user from the Use Displays a page in the browser of the
context found on the server Web user
FramesetDisplay Displays a WebDev frameset in the This list can evolve. We recommend that you check the
browser of the Web user documentation about each function. The "AJAX" symbol
shows whether the function is available in AJAX mode or
FramesetUse Displays a WebDev frameset in the not.
browser of the Web user and closes
all the current page contexts and fra-
meset contexts
InitWindow Resets (or not) the controls found in
the current page and runs the initiali-
zation processes of the controls
Part 6: Web specific features
Tome1_2.book Page 389 Vendredi, 28. mai 2010 5:50 17
389
7. VISTA GADGETS
7.1 Overview
Windows Vista enables you to install "Gadgets" on the cial icon. This page automatically contains 2 buttons:
desktop. These gadgets are HTML pages that can be "OK" and "Cancel".
easily created by WebDev. The width of this page must be set to 278 pixels.
WebDev enables you to create Vista gadgets from static • Flyout page: free pages that can be opened from the
sites or from AWP sites. main page (via a button, a link, ?).
The maximum size for this type of page is set to 400
A Vista gadget can contain three types of pages. These pixels in height and in width.
three types of pages must respect specific dimensions: WebDev enables you to create these three types of pages
• Main page: it’s the page that is displayed in the gadget and to generate the ".gadget" file. This file can be sup-
pane. plied to the users of the gadget so that it can be installed
This page must have a width included between 25 and on their computer (gadgets that can be downloaded from
130 pixels, and a minimum height of 60 pixels. a site for instance).
• Configuration page: This page is optional. This page is Note: the characteristics of these three types of pages
used to configure the gadget and it is opened via a spe- are detailed in ’Programming Vista gadgets’, page 407.
390
6. Validate. The gadget is created in the "EXE" sub- Windows Vista, the gadget can be installed directly
directory of the project. The extension of the gadget and its test can be run.
is ".gadget". If the development computer is running
391
The browser code associated with this page is as follows: FlyOut page
The flyout pages are standard pages. These pages are
Page load Browser code run when the page is free pages that can be opened from the main page (via a
(onload) (Brow- displayed in the browser (created by button, a link, …).
ser code) PageDisplay or PageRefresh for ins-
tance) The maximum size for this type of page is set to 400
pixels in height and in width. The background color of the
Page unload Browser code run when a new page flyout pages is white. This color cannot be modified.
(onunload) is displayed in the browser. In the flyout pages, a font must be specified in the styles:
(Browser code) if the font is "undefined", the default font will be used. In
Validation of the Browser code run when the valida- this case, some differences of page layout may occur
configuration tion button is pressed. between the edit mode and the runtime mode.
window (Browser The flyout pages contain the following processes:
code)
Page load Browser code run when the page is
Cancellation of Browser code run when the cancela- (onload) (Brow- displayed in the browser (created
the configuration tion button is pressed. ser code) by PageDisplay or PageRefresh for
window (Browser instance)
code)
Page unload Browser code run when a new page
Note: the GadgetLoadParameter and GadgetSavePara- (onunload) is displayed in the browser.
meter functions enable you to manage the storing of the (Browser code)
parameters.
These pages can be handle with the GadgetDisplayFlyout
and GadgetCloseFlyout functions.
392
This certificate must be installed on the server by the The complete procedure to follow in order to obtain an
key manager. SSL certificate is detailed later in this chapter.
8.3 Creating and installing an SSL certificate for IIS2 (2.0 or later)
8.3.1 Step 1: Creating a certificate This example presents the steps to follow to send a certi-
To create a certificate: ficate request to Verisign. These steps are similar for the
1. Start the Microsoft Internet Service Manager other authorities.
("Start .. Run" : Inetmgr.exe). 1. In your browser, type: "http://www.veri-
2. Select the Web site to secure (for instance: sign.com".
"Default Web site"). 2. Click "Free Trial". This option enables you to get a
3. Right-click this site and select "Properties" from free certificate valid for 15 days.
the popup menu. 3. Fill out the short form and click "Submit".
4. Select the "Directory Security" tab: 4. Follow the certification wizard step by step
•Click the "Server certificate …" button. •Step 1 to 5: Generating CSR: click "Continue"
A wizard starts. •Step 2 to 5: Submit CSR: copy the content of the
•Choose "Create a certificate". file previously created, "certreq.txt", in the input
area provided for this purpose, then click "Conti-
•In the "Usual Site Name" screen of the wizard: nue".
leave your computer name.
•Step 3 to 5: Complete Application: the certificate’s
•The wizard create a text file named "certreq.txt" content is listed on the screen, enter your contact
allowing you to ask for your certificate. information (Caution, accented characters are not
5. Exit the properties of the Web server. accepted, most of the information must be the
same as in the certificate. Example: region, com-
8.3.2 Step 2: Requesting a certificate pany, …). Enter your email address, the certificate
The certificate request must be sent to a certificate will be sent to this address. Click "Accept".
authority (for instance: www.verisign.com).
Tome1_2.book Page 393 Vendredi, 28. mai 2010 5:50 17
393
The certificate will be sent to you within an hour. •Copy the selected part into a new file named "Cer-
tif.cer" for instance.
8.3.3 Step 3: Certification of the certificate on 2. Start the Internet Service Manager ("Start ..
the server Run": Inetmgr.exe).
3. Select the Web site to secure (for instance:
1. The certificate is found in the email sent by Veri- "Default Web site").
Sign. 4. Right-click this site and select the "Properties"
•Select the part that looks like this. option.
5. Select the "Directory Security" tab:
-----BEGIN CERTIFICATE-----
•Click the "Server certificate …" button, then follow
MIICBzCCAbECEFi+J6vFjN+EkkfCKLgi6uUwDQYJKoZIhvc the wizard.
NAQEEBQAwgakxFjAUBgNVBAoTDVZlcmlTaWduLCBJbm
MxRzBFBgNVBAsTPnd3dy52ZXJpc2lnbi5jb20vcmVwb3N •Choose "Process the request and install the certi-
pdG9yeS9UZXN0Q1BTIEluY29ycC4gQnkgUmVmLiBMaW ficate".
FiLiBMVEQuMUYwRAYDVQQLEz1Gb3IgVmVyaVNpZ24gYX •Select the created file (Certif.cer).
V0aG9yaXplZCB0ZXN0aW5nIG9ubHkuIE5vIGFzc3VyYW •End the wizard.
5jZXMgKEMpVlMxOTk3MB4XDTAwMDkwMTAwMDAwMFo
XDTAwMDkxNTIzNTk1OVowZDELMAkGA1UEBhMCRlIxEjA Important:
QBgNVBAgTCUxBTkdVRURPQzEUMBIGA1UEBxQLTU9OVF If a test certificate was already installed on this compu-
BFTExJRVIxDDAKBgNVBAoUA1BDUzEPMA0GA1UECxQGV ter:
0VCREVWMQwwCgYDVQQDFANtcjIwXDANBgkqhkiG9w0 • Remove the former certificate (select "Delete Certifi-
BAQEFAANLADBIAkEAmqKCTidFBZEwI0Q7WPTBlQzlacQi cate" in step 1).
5nwjNndrWU2tjGMElrY0IxoduwTgRX+DY42IuptGERQApb • Change the name of your computer (indeed, two test
5NCx/4/3iBrQIDAQABMA0GCSqGSIb3DQEBBAUAA0 certificates cannot be installed on the same computer
EABT7REV9bLiq3EFiug+a/irlbYI7aNiuITsdSVO7j34baFtx = same name).
aa2jTE4JoGrNhrWTQZgBl1GOMpuMef/MuwXHO1A== • Start again from step 1.
-----END CERTIFICATE-----
394
8.4.3 Going back to normal mode (non-secure 3. If necessary (action not defined in the description
transaction) in the current browser of the button), use PageDisplay in the server click
code to display the requested page in non secure
To go back to the normal mode (non-secure transaction) mode.
in the current browser: 4. The page opened by this button will be opened in
1. Create a button that opens a page. This page can non-secure mode. This non-secure mode will be
be opened either by an action defined in the button used until the secure mode is explicitly requested.
(or link) description window, or by programming in
server code. The characteristics of this button are: Special case: Opening a page in secure mode withBrow-
serOpen:
•Type: "Send value to server" or "None". 1. Create a global variable (adrPage) for example in
•Action: "Display page XXX" (or "None" if the page the home page (not secured).
is opened by programming). 2. Initialize this variable with the secure address of
•Target: the page:
- "Current browser" to open the page in the current addrPage = PageAddress(…
browser. <StartPageName>, paSecure)
- "New browser" to open the page in a new browser. 3. In the requested code, use:
2. Enter the following code line in the browser click BrowserOpen(AddrPage)
code of the button:
SSLActive(False)
Part 6: Web specific features
Tome1_2.book Page 395 Vendredi, 28. mai 2010 5:50 17
395
9. JSON
9.1 Overview
JSON (JavaScript Object Notation) is a light format for JSON and WebDev
exchanging data. Based on JavaScript, JSON is a text for- WebDev is used to:
mat independent of any other language. • get information in JSON format in a WebDev site.
JSON is based on two structures: • create WebDev page that return information in JSON
• a set of name/value couples, interpreted in WLan- format. You have the ability to create a site that provi-
guage by structures. des JSON services (a site for monitoring packages for
• a list of organized values, interpreted in WLangage by instance).
arrays.
396
PART 7
Communication
Tome1_2.book Page 398 Vendredi, 28. mai 2010 5:50 17
Tome1_2.book Page 399 Vendredi, 28. mai 2010 5:50 17
399
1. COMMUNICATION
1.1 Communication with WinDev/WebDev
WLanguage offers many communication features.
Part 7: Communication
the network thanks to Socket functions.
• Bluetooth and OBEX Communication between a PC and a Mobile. See ’Managing Bluetooth keys’, page
491.
• multitask management Execute several tasks in parallel in the same See ’Thread management’, page 493.
application or the same site.
• SOAP server Create SOAP client and server applications. See ’SOAP’, page 499.
• procedures on a .net Management of procedure execution on a .Net See ’.Net XML Web services server’, page
Web services server Web services server. 504.
• procedures on a J2EE Management of procedure execution on a See ’J2EE XML Web services server’,
Web services server J2EE Web services server. page 506.
• XML Web Services Import and/or generate .Net and J2EE type See ’XML Web services’, page 508.
XML Web services.
• XML files Manage files in XML format. See ’XML’, page 512.
• .NET assemblies Create and use .NET assemblies. See ’.NET assemblies’, page 515.
Tome1_2.book Page 400 Vendredi, 28. mai 2010 5:50 17
400
ActiveSync X X X X X X
Network card X X X X X X
GPRS X X X X X X
Infrared X
Smartphone X X
or phone
access (GSM
type)
Wi-Fi X X X X X X
Part 7: Communication
Tome1_2.book Page 401 Vendredi, 28. mai 2010 5:50 17
401
2. COMMUNICATING BY EMAILS
2.1 Overview
2.1.1 Email management • The "CEMAPI" API (WinDev Mobile): this email mana-
With Internet, new means of communication have been gement mode lets you use Pocket Outlook to send and
developed and more specifically communication by receive emails.
emails.
2.1.2 Synchronous/Asynchronous mode (Web-
The emails can be directly managed from your applica- Dev only)
tion and from your sites: sending and receiving emails is
child’s play via: The email functions are locking functions by default.
Which means that no other code can be run during their
•several WLanguage functions, execution. The program will resume only when the current
•an email structure allowing you to find out and store email functions have been run.
the characteristics of the email used. WebDev enables you to manage emails in asynchronous
Emails are managed thanks to several methods: mode. This mode allows your sites to send emails without
•The POP3/SMTP protocol: this protocol is an email locking the other processes.
management protocol recognized by all the service If the asynchronous mode is enabled when the session
providers. This protocol enables you to directly com- was started, all the outgoing emails are redirected to a
municate with the server, available at your ISP. "spooler". The emails are queued up before they are
•The "Simple Mail API (also called SMAPI or Simple sent.
MAPI)": this email management protocol is used by The execution of the Email functions do not lock the rest
most Microsoft applications, and specifically MS of your program anymore.
Exchange 4.
Caution: the asynchronous mode is used only when ope-
•The email software of the user: this method simpli- ning a session on an SMTP server (EmailStartSMTPSes-
fies the sending of email from a WebDev site. Indeed, sion for sending emails). The asynchronous mode is
a single function (EmailOpenMail) is required to ignored in all the other cases.
open this software on the Web user’s computer and
to fill out the email information.
Part 7: Communication
2.2 Managing emails via the POP3/SMTP protocols
The POP3 and SMTP protocols are protocols for email
management recognized by all the service providers.
These protocols allow you to directly communicate with Principle for a WinDev application:
the email server, available at your service provider.
• The POP3 protocol is used to receive emails.
• The SMTP protocol is used to send emails
2.2.1 Principle
To send or read messages via the POP3/SMTP protocols,
you must:
1. In the case of a Pocket PC, connect the Pocket PC
to a PC (needed if the Pocket PC does not have an
Ethernet card or a GPRS modem).
2. Connect to the Internet service provider (if neces-
sary, WinDev and WinDev Mobile).
3. Start an email session with EmailStartSession.
4. Send and read the messages.
5. Close the email session with EmailCloseSession.
6. Disconnect (if necessary).
Tome1_2.book Page 402 Vendredi, 28. mai 2010 5:50 17
402
403
Part 7: Communication
used in your application or in your site. with the message (variables of the WLanguage email
You must specify the following parameters: structure) are initialized.
•The address of the POP3 server found at the host, The files attached to the message, if they exist, can be
saved on the current computer by EmailSaveAttach-
•The address of the SMTP server found at the host.
ment.
EmailStartSession returns the session identifier. This Each email read can be deleted from the email server by
identifier will be used by all the WLanguage functions for
EmailDeleteMessage.
email management.
Note: if you only want to open: 2.2.6 Step 5: Sending emails
• an email receiving session, use You can prepare the email to send. Indeed, the message
EmailStartPOP3Session. to send contains several variables (variables of the
• an email sending session, use EmailStartSMTPSes- WLanguage email structure). To send an email, use
sion. EmailSendMessage.
404
2.3.2 Step 1: Creating a user profile The following elements are defined in the user profile:
The user profile lets you configure the email management •the SMTP protocol used,
application (MS Exchange for instance). •the POP3 protocol used,
Tome1_2.book Page 405 Vendredi, 28. mai 2010 5:50 17
405
•the different communication services used. To use Example: the following procedure lets you open a messa-
the "email" functions of WLanguage, the user profile ging session from a profile. If an error occurs, the
must use Microsoft Exchange Server. Email.Error variable identifies the error.
Note: you need to create as many profiles on the compu- Function StartSession(Profile)
ter as there are users or email accounts. The name of the SessionNum is int
profile will be used to start the email session with SessionNum = EmailStartSession(…
EmailStartSession. Profile)
To create a profile (in MS Exchange 4 for example): IF SessionNum = 0 THEN
1. Start MS Exchange 4. Error ("The session "+…
2. In the window named "Choosing a profile", click "couldn’t be started. "+…
[New]. "Error :"+Email.Error)
3. Select the "Microsoft Exchange Server" service. END
4. Give a name to the profile: this name will be used RESULT SessionNum
in your programs.
5. Enter the name of the Microsoft Exchange server. 2.3.4 Step 3: Sending emails
The following functions are use to send emails via Simple
2.3.3 Step 2: Starting an email session MAPI:
EmailStartSession enables you to start an email ses- • EMailSendMessage: this feature lets you put the mes-
sion. This function must be the first "email" function sage in the outbox of the email software (MS Exchange
used in your application or in your site. 4 outbox for example).
EmailStartSession returns the session identifier. This • EMailUpdate: this function is used to synchronize the
identifier will be used by all the WLanguage functions for email server and the email management application;
email management. the new emails received are automatically transfered in
the inbox, the email found in the outbox are sent.
Example: the following code sends all the emails found in
a memory table ("TOSEND" table) through MS Exchange
4. Each table row corresponds to an email.
Part 7: Communication
Tome1_2.book Page 406 Vendredi, 28. mai 2010 5:50 17
406
For each email, the information found in the memory In this example, the incoming messages are deleted from
table is transferred into the email structure and the email the inbox and from the email server by EmailDeleteMes-
is sent. Then, the email server is updated. sage.
I is int // Receive the messages waiting
FOR I = 1 to TableCount(… // on the email server
"TOSEND") IF NOT …
// The mail is only sent EmailUpdate(SessionNum) THEN
// to one person Error("Error. Problem"+ …
Email.NbRecipient = 1 Email.Error)
Email.Recipient[1] = … END
ExtractString(TOSEND[I], 1) // Read the first unread message
// Subject and message IF NOT EmailReadFirst(SessionNum,…
Email.Subject = … "Not read") THEN
ExtractString(TOSEND[I], 2) Error("Error while "…
Email.Message = … "reading the first message")
ExtractString(TOSEND[I], 3) END
// No attachment // Read the unread messages and
Email.NbAttach = 0 // display them in a memory table
// Send the message to MS Exchange TableDeleteAll("Messages")
4 WHILE NOT Email.Out
EmailSendMessage(SessionNum,… // The reception date,
False) // the address of
END // the sender and the message are
// Send messages from MS Exchange 4 // assigned in the table
// to the email server TableAdd("Messages",…
IF NOT … Email.ReceiveDate + TAB +…
EmailUpdate(SessionNum) THEN Email.SenderAddress + …
Error("Error. Problem"+… TAB +Email.Message)
Email.Error) // Delete the message
END IF NOT …
EmailDeleteMessage(SessionNum) THEN
2.3.5 Step 4: Reading emails Error("Error: the message"…
Reading emails via Simple MAPI is performed by: "hasn’t been deleted")
Part 7: Communication
END
•EmailUpdate: this function synchronizes the email
// Read the next unread message
server and the email management application - the
IF NOT …
newly received emails are automatically transfered to
EmailReadNext(SessionNum,…
the inbox, the messages in the outbox are sent.
"Not read") THEN
•the functions for reading emails (EmailReadFirst, Error("Error while "…
EmailReadNext, etc.): these functions are used to "reading the next message")
initialize the WLanguage email structure with the cha- END
racteristics of the email being read (sender, subject, END
etc.).
Example: the following code reads emails. The incoming 2.3.6 Step 5: Ending the session
emails are stored in a memory table ("Messages"). The When the management of the incoming and outgoing
SessionNum variable corresponds to the identifier of the emails is completed, that session is closed by EmailClo-
session. seSession. This function must be the last "email" func-
tion used.
Example: the following code is a procedure used to close
a messaging session. In this code, the SessionNum
variable corresponds to the session identifier returned by
EmailStartSession .
Procedure CloseSession(…
SessionNum)
EmailCloseSession(SessionNum)
Tome1_2.book Page 407 Vendredi, 28. mai 2010 5:50 17
407
Part 7: Communication
The different steps for writing emails are as follows: a non-latin language).
1. Initialize the email structure, specifying the recipients, • You may want to specify a return address that differs
subject, etc. (Email.Recipient, Email.NbRecipient, from the sender address.
Email.NbCc, Email.Cc and Email.Subject). To customize these emails, the WLanguage enables you
2. If the email is in text format: to create the buffer of the email, to modify it and to send
•Initialize the Email.Message variable with text of the this email.
email. The following functions are used:
•Specify the attachments if necessary (Email.NbAt- • EmailImportSource: this function is used to read an
tach and Email.Attach). existing EML file and to automatically fill the variables
3. If the email is in HTML format: Use EmailImportHTML of the email structure.
to initialize the various email variables. If the email con- • EmailBuildSource: this function is used to generate an
tains images or multimedia files, they will be automati- email’s source code. This function allows you to entirely
cally added as attachments and the content of the HTML define the source code of the email by using the flexibi-
email will be modified to manage the attachments. lity of the Email structure.
4. Send the email using EmailSendMessage. • EmailSend: this function sends a "buffer" in EML for-
mat containing the structured email (created with
2.5.2 Example EmailBuildSource for instance).
Example: This example sends an email containing ima-
Tome1_2.book Page 408 Vendredi, 28. mai 2010 5:50 17
408
409
SenderAddress Character string containing the Recipient Array of character strings containing
address of the sender. the addresses of the recipients. The
Attach Array of strings containing the name number of recipients is limited to
of the attachments. The number of 20.
attachments is limited to 10. Out Boolean indicating whether a mes-
Category Character string containing a list of sage was read. Email.Out returns
keywords associated with the email. False when the message was read
The keywords are separated by and True when the message was not
semicolons. read.
CC Array of strings containing the Error Character string containing the error
addresses of the copied recipients: message.
their name is not listed in the mail Sender Character string containing the
received by the official recipients address where the answer to the
(Email.Recipient variable). message must be sent (up to 127
CC (continued) The addresses are limited to 127 character).
characters. The number of non-offi- HTML Character string containing the mes-
cial recipients is limited to 200. sage with HTML formatting. Limited
Bcc Array of strings containing the to 32,000 characters.
addresses of the non-official reci- AttachIdentifier Array of character strings containing
pients: their name is not listed in the the identifiers of the attachments
mail received by the official reci- included in an HTML message.
pients (Email.Recipient variable). Message Character string containing the text
The addresses are limited to 127 of the message (with simple text for-
characters. The number of non-offi- matting). Limited to 32,000 bytes.
cial recipients is limited to 200.
NbAttach Integer indicating the number of files
Confidentiality Integer constant containing the type attached to the message. The num-
of confidentiality for the email. The ber of attachments is limited to 10.
possible values are as follows:
• EmailCompanyConfidential: used NbCC Integer corresponding to the number
for in-house emails for instance of copied recipients (limited to
200).
Part 7: Communication
• EmailNoSensitivity: (default
value) no confidentiality NbCci or NbBcc Integer corresponding to the number
of non-official recipients (limited to
• EmailPersonal: used for personal
200).
emails for instance
• EmailPrivate: used for private NbRecipient Integer containing the number of
emails for instance recipients for the message. The
number of recipients is limited to
DispositionNotifi- Boolean (False by default) 20.
cation When sending mail, used to request Priority Integer constant containing the type
a read confirmation from the reci- of priority for the email.
pient. The recipient does not neces-
sarily have to send a read receipt. Subject Character string containing the sub-
When receiving mail, used to find ject of the message.
out whether the sender requested a
read confirmation. Advanced email management: to create an advanced
email description, you can access the MIME Content-
If a read receipt is requested, it has Type and the Content-Description fields of each attached
priority over the return receipt. file provided with the email.
ReceiveDate Date when the message was recei-
ved (128 characters).
Tome1_2.book Page 410 Vendredi, 28. mai 2010 5:50 17
410
411
EmailReadLast Reads the last pending message found on the email server
EmailReadLastHeader Reads the header of the last message waiting on the server (POP3 protocol only)
EmailReadMessageHeader Reads the header of a message identified by its number (POP3 protocol only)
EmailReadPreviousHeader Reads the header of the previous waiting message (POP3 protocol only)
EmailReadFirstHeader Reads the header of the first message (POP3 protocol only)
EmailReadNextHeader Reads the header of the next message (POP3 protocol only)
EmailReadMessage Reads a message identified by its number
EmailReadPrevious Reads the previous pending message
EmailReadFirst Reads the first message
EmailReadNext Reads the next message
EmailGetTimeOut Reads the value of the "time-out" for connecting to the SMTP and POP3 messaging
servers
EmailUpdate Sends the messages to the Internet email server and receive messages waiting on the
Internet server
EmailMsgError Returns the message corresponding to the identifier of the error
EmailNbMessage Enables you to find out the number of messages currently on the server
EmailOpenMail Opens the default email software of the Web user on the browser computer
EmailStartSession Starts an email management session
EmailStartPOP3Session Starts an email reading session with the POP3 protocol
EmailStartSMTPSession Starts a session for sending emails via the SMTP protocol
EmailReset Reinitializes the variables of the email structure
EmailSaveAttachment Copies the email attachments to the local computer
EmailDeleteMessage Deletes a message
EmailMessageLength Enables you to find out the length of an email before loading it
EmailCheckAddress Checks the validity of an email address
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Part 7: Communication
Tome1_2.book Page 412 Vendredi, 28. mai 2010 5:50 17
412
based to use, syntax 2). •the groups of contacts via the group functions (see
3. Start a document access session: NotesOpenDa- page 434)
tabase (specifying the connection identifier and the •the documents with the Notes functions (see page
local or remote Lotus Notes database to use). 434)
413
EmailSeekFirstNotes Searches for one or more emails according to specified criteria, in a local or remote Lotus
Notes or Domino database.
EmailBuildSource Generates the source code of the outgoing email from the variables currently found in the
email structure. The source code is generated in theEmail.Source variable.
EmailSendMessage Enables you to send a message.
EmailCloseSession Closes the session.
EmailImportSource Fills the variables of the email structure from the content of the Email.Source variable.
EmailProgressBar Manages a progress bar for sending and receiving emails.
EmailReadLast Reads the last incoming email.
Part 7: Communication
EmailReadLastHeader Reads the header of the last incoming email.
EmailReadMessageHeader Reads the header of an incoming email.
EmailReadPreviousHeader Reads the header of the email found before the current email.
EmailReadFirstHeader Reads the header of the first incoming email.
EmailReadNextHeader Reads the incoming email found after the current email.
EmailReadMessage Reads an incoming email.
EmailReadPrevious Reads the email found before the current email.
EmailReadFirst Reads the first message.
EmailReadNext Reads the next message.
EmailStartNotesSession Enables you to access the data handled by Lotus Notes (emails, contacts, groups of con-
tacts, tasks, appointments).
EmailReset Resets the variables of the email structure.
EmailDeleteMessage Deletes a message.
CloseSession Closes the session.
EmailCheckAddress Checks the validity of an email address.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 414 Vendredi, 28. mai 2010 5:50 17
414
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 415 Vendredi, 28. mai 2010 5:50 17
415
TaskAdd Adds a task to the task list of a Lotus Notes ou Outlook messaging
TaskLast Reads the last task found in the task list of a Lotus Notes or Outlook messaging
TaskRead Reads a task previously read in the task list of a Lotus Notes or Outlook messaging
TaskModify Modifies the current task in the task list of a Lotus Notes or Outlook messaging
TaskPrevious Reads the task found before the current task in the task list of a Lotus Notes or Outlook messa-
ging
TaskFirst Reads the first task found in the task list of a Lotus Notes or Outlook messaging
TaskReset Resets the Task structure.
TaskNext Reads the task found after the current task in the task list of a Lotus Notes or Outlook messa-
ging
TaskDelete Deletes the current task from the task list of a Lotus Notes or Outlook messaging
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Part 7: Communication
AppointmentNext Reads the appointment found after the current appointment in the calendar of Lotus Notes or
Outlook
AppointmentDelete Deletes the current appointment from the calendar of Lotus Notes or Outlook
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 416 Vendredi, 28. mai 2010 5:50 17
416
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
GroupAdd Adds a group of contacts into the address book of Lotus Notes or Outlook
GroupLast Reads the last group of contacts found in the address book of Lotus Notes or Outlook
GroupRead Reads a group of contacts previously read, found in the address book of Lotus Notes or Out-
look
GroupModify Modifies the current group of contacts in the address book of Lotus Notes or Outlook
Part 7: Communication
GroupPrevious Reads the group of contacts found before the current group in the address book of Lotus Notes
or Outlook
GroupFirst Reads the first group of contacts found in the address book of Lotus Notes or Outlook
GroupReset Resets the Group structure
GroupNext Reads the group of contacts found after the current group in the address book of a Lotus Notes
or Outlook messaging
GroupDelete Deletes the current group of contacts from the address book of a Lotus Notes or Outlook mes-
saging
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 417 Vendredi, 28. mai 2010 5:50 17
417
Part 7: Communication
NotesReset Creates an empty document in Lotus Notes
NotesDeleteItem Deletes the specified item from the current document in Lotus Notes
NotesDeleteAttachment Deletes an attachment from an item of the current document in Lotus Notes
NotesViewSeekLast Seeks the last document found in the current view in Lotus Notes
NotesViewSeekFirst Seeks the first document found in the current view in Lotus Notes
NotesViewListColumn Lists the columns found in the current view in Lotus Notes
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 418 Vendredi, 28. mai 2010 5:50 17
418
4.GOOGLE
4.1 Managing the Google contacts
4.1.1 Overview used to list the contacts. The contacts found are
The Google Contact service is used to manage the con- assigned to the array of gglContact variables
tacts on the Internet. WinDev and WebDev allow you to Example:
create an application for synchronizing the contacts of an // Retrieves all the contacts
existing program with the contacts of Google Contact. ArrContacts is array of …
Warning: before using a feature linked to a Google ser- 0 GglContact
vice, we recommend that you check the user license for ArrContacts = GglListContact(Cnt)
the service. Some restrictions may apply. The content of // Browse the contacts
the licenses may change over time. Contact is gglContact
PC SOFT is in no case responsible for the way the native FOR EACH Contact OF ArrContacts
access functions are used. Please make sure that you Trace(Contact.Name)
comply with the license of the service provider. END
4.1.2 How do I manage the Google contacts? 4.1.4 How do I modify or delete the Google
To manage the Google contacts: contacts?
1. Create a Google account if necessary. This Principle:
account can be created via the following address: The principle is straightforward: you need to seek then
http://code.google.com/intl/en/apis/maps/ point to the contact to modify or delete before you per-
signup.html. form the operation you want.
Caution: this page’s address may have changed
since this page has been written. To modify a contact:
The Google account is identified by an email address 1. Retrieve the list of contacts.
and the associated password. 2. Search for the contact to modify.
2. In the code of your application, create a gglCon- 3. Modify the characteristics of the contact.
nection variable. This variable contains the charac- 4. Validate the modifications with GglWrite
Part 7: Communication
419
Example:
// Retrieves all the contacts
ArrContacts is array of …
0 GglContact
ArrContacts = GglListContact(Cnt)
// Browse the contacts
Contact is gglContact
FOR EACH Contact OF ArrContacts
IF Contact.Name = "MOORE" THEN
// Deleting
GglDelete(Cnt, Contact)
END
END
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Part 7: Communication
4.2.1 Overview the service. Some restrictions may apply. The content of
The Google Calendar service is an Internet application the licenses may change over time.
supplied by Google that is used to manage a calendar on PC SOFT is in no case responsible for the way the native
the Internet. access functions are used. Please make sure that you
WinDev and WebDev enable you to create an application comply with the license of the service provider.
for synchronizing schedules with an existing program for
instance: using a meeting room, a vehicle, … 4.2.2 How do I manage a Google calendar?
These WLanguage functions also allow you to create spe- To manage a Google calendar:
cific interfaces (suited for your business requirements, 1. If needed create a Google account. This account
more user-friendly, etc.) and to add specific processes can be created via the following address: http://
(printing, etc.). code.google.com/intl/en/apis/maps/signup.html.
Caution: this page’s address may have changed
Examples of processes that can be implemented natively since this page has been written.
in WLanguage: The Google account is identified by an email address
• Retrieving the detailed calendar list (professional and the associated password.
calendars, personal calendars, etc.) 2. In the code of your application, create a gglCon-
• Retrieving the list of appointments from a calendar. nection variable. This variable contains the charac-
• Performing a search in the appointments of a calendar. teristics of the connection to your Google account.
• Adding, modifying and deleting appointments. To create a Google calendar:
Warning: before using a feature linked to a Google ser- A Google calendar can be created via the Google inter-
vice, we recommend that you check the user license for face or by programming with the WLanguage functions.
Tome1_2.book Page 420 Vendredi, 28. mai 2010 5:50 17
420
4.2.3 How do I retrieve a Google calendar and 4.2.4 How do I add, modify or delete events in
its elements? a Google calendar?
1st method: retrieving the list of calendars then their Principle:
events. The principle for modifying the events is straightforward:
To retrieve a Google calendar from the list of calendars: the calendar is retrieved locally, the modifications are
1. Declare an array of gglCalendar variables (to performed locally, then the calendar is updated on the
retrieve several calendars). server.
2. Use the GglListCalendar function. This function is Note: in the case of shared calendars, we recommend
used to list the available calendars. The calendars you regularly update the calendars on the server
found are assigned to the array of gglCalendar varia- To add events to a calendar:
bles. 1. Retrieve the calendar you want (and its events if
3. Use GglFillCalendar to retrieve the events. The needed).
events can be retrieved from a single calendar or 2. Declare a gglEvent variable.
from several calendars. The events to retrieve can be 3. Define the characteristics of the event via the pro-
filtered (between two dates for instance). perties of the variable.
Example: 4. Use GglWrite to update the calendar on the server
ArrCalendars is array of … Example:
0 gglCalendar
// Retrieve the calendar
Part 7: Communication
ArrCalendars = GglListCalendar(cnt)
// named "Work"
// First calendar
Calendar is gglCalendar = …
Calendar is gglCalendar …
GglGetCalendar(Cnt, "Work")
= ArrCalendars[1]
// Create an event
// Retrieve the events between
MyEvent is gglEvent
// the 01/01/2008 and the 01/01/2009
MyEvent.StartDate = …
// included
"20081201085000"
GglFillCalendar(Cnt, Calendar, ...
MyEvent.EndDate = …
"20080101", "20090102")
"20081201093000"
//Browse the events of a calendar
MyEvent.Title = "Appointment"
Evt is gglEvent
MyEvent.Content = …
FOR EACH Evt OF Calendar
"Appointment to discuss …
Trace(Evt.Title)
the November status report"
END
// Add the event to the calendar
2nd method: retrieving a specific calendar. Add(Calendar.Event, MyEvent)
// Update the calendar on
To retrieve a specific Google calendar as well as its // the server
events: GglWrite(Cnt, Calendar) ArrCalendar is
1. Declare a gglCalendar variable. array of …
2. Use the GglGetCalendar function. This function is 0 gglCalendar
used to retrieve the Google calendar (and its events) ArrCalendars = GglListCalendar(cnt)
corresponding to the specified title.
Tome1_2.book Page 421 Vendredi, 28. mai 2010 5:50 17
421
Part 7: Communication
dar are retrieved using a custom query.
GglRequest Sends a communication request (HTTP request) to a Google service.
GglDelete Deletes a calendar.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
4.3 Using the service for managing the Google Picasa photo albums
4.3.1 Overview • Retrieve and include photos found in Google Picasa
Picasa Albums Web is an application for managing online accounts.
images and photos proposed by Google. Warning: before using a feature linked to a Google ser-
Examples of processes that can be performed in WLan- vice, we recommend that you check the user license for
guage: the service. Some restrictions may apply. The content of
the licenses may change over time.
• Retrieve the list of albums as well as their details.
PC SOFT is in no case responsible for the way the native
• Retrieve the list of photos found in an album, the tags access functions are used. Please make sure that you
of a photo, … comply with the license of the service provider.
• Send photos, retrieve photos, …
Tome1_2.book Page 422 Vendredi, 28. mai 2010 5:50 17
422
423
2. To retrieve the album’s photos, browse through 4. To modify a photo in the album:
the album’s photos (..PhotoData property of the •modify the characteristics of the photo in the
GglAlbum variable) and use the GglFillPhoto func- album (via a gglPhoto variable if necessary).
tion. Different options allow you to specify the ele- •use GglWrite on the gglPhoto variable correspon-
ments that will be retrieved. ding to the photo to modify to update the album on
3. To add a photo to the album: the Google server
•describe the photo via a gglPhoto variable. Limitations
•Add the photo to the album (each photo is an ele- •No image in PNG format can be added from a Win-
ment of the PhotoData array found in the gglAlbum Dev Mobile application.
variable).
•The Google Picasa functions use the APIs supplied
•use GglWrite on the gglAlbum variable to update by Google. Some features may operate on the
the album on the Google server. online service and may be temporarily blocked by
Google via the APIs.
Part 7: Communication
GglFillAlbum Retrieves the data corresponding to the requested options from a Google Picasa
album.
GglFillPhoto Retrieves the data about the photos corresponding to the requested options from a
Google Picasa album.
GglDelete Deletes a Google Picasa album or photo.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
424
zoom factor, … Dev project. This control will be used to display the
• Drawing an itinerary on the map (point by point): a requested map.
route can be retrieved using a GPS device that records 3. In the code used to retrieve the map, assign the
the path taken. result of GglGetMap to the Image control. This func-
tion expects the following parameters:
Warning: before using a feature linked to a Google ser-
vice, we recommend that you check the user license for •the Google key
the service. Some restrictions may apply. The content of •the latitude and the longitude of the central point
the licenses may change over time. of the map
PC SOFT is in no case responsible for the way the native •the zoom performed
access functions are used. Please make sure that you •the size of the image to retrieve. The maximum size
comply with the license of the service provider. is set to 640 x 640. This limit is defined by the Goo-
gle Maps service at the date of publication of this
page.
•the type of requested map (road map, satellite,
etc.).
By default, this map has no border, it is in GIF format and
it contains no marker. The language displayed on the
map corresponds to the language of the country dis-
played.
Tome1_2.book Page 425 Vendredi, 28. mai 2010 5:50 17
425
Retrieving a map with advanced set- of the gglMapParameter variable containing the
tings (markets, etc.) requested options.
To include an advanced map that uses the Google Maps Notes:
service in your applications or in your sites: • No image is returned if the limitations defined by Goo-
1. Generate a Google key. This key is supplied by gle are exceeded (number of points in a path, number
Google. This key can be generated via the following of markers, size of the image, and so on). In this case,
address: http://code.google.com/intl/en/apis/ we advise you to modify the parameters of the map by
maps/signup.html. reducing the number of elements to display.
2. Create an Image control in your WinDev or Web- • If a proxy is used to access Internet, the proxy must be
Dev project. This control will be used to display the configured (Proxy) to use the Google functions.
requested map.
3. In the code use to retrieve the map: 4.5.3 Other services
•Create a gglMapParameter variable. This variable The Google Maps service can also be used to retrieve the
will allow you to define all the map’s settings: pre- coordinates of an address. This feature can be used via
sence of a frame, display of a path, format of the the WLanguage function named GglAddressToCoordina-
received image, markers, ... Only specify the tes.
options you want.
This function returns the latitude and the longitude of the
•Assign the result of GglGetMap to the Image con- address specified in a gglCoordinate variable.
trol. In <Advanced Parameters>, specify the name
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Part 7: Communication
Tome1_2.book Page 426 Vendredi, 28. mai 2010 5:50 17
426
5.GOOGLE ADWORDS
5.1 Management of accounts
5.1.1 Overview Note: if you use a proxy to access the Internet, you need
Google AdWords is a Google service used to promote a to configure the proxy (proxy function) in order to use the
company on the Internet. Google functions.
To use Google AdWords, you must create an AdWords Managing the simple accounts:
account. This account enables you to manage the cam- The following WLanguage functions are used to retrieve
paigns run on Google AdWords. This account must be and modify the information of the Google AdWords
created with Google AdWords. account:
The AdWords account can correspond to: •GglAdWGetAccountInfo is used to retrieve the cha-
•a single account. racteristics of the account associated with the
AdWords connection. These characteristics are
•a set of accounts, grouped in the multi-account cen- retrieved in a gglAdWAccountInfo variable. These
ter of Google AdWords (also called My Client Center). characteristics can be modified if necessary.
The multi-account center is useful by advertisers who
manage several accounts, for advertising compa- •GglWrite is used to take into account the modifica-
nies, ... If some Google AdWords accounts are grou- tions of the account characteristics on the server.
ped in a multi-account center, you have the ability to Managing the multi-account accounts:
directly access all the accounts found in the multi- The following WLanguage functions are used to retrieve
account center or one of the AdWords accounts. and modify the information of the Google AdWords
The WLanguage functions can be used to manage a sin- account:
gle account or a set of accounts grouped in a multi- •GglAdWListClientAccount is used to retrieve the list
account center. of primary email addresses for the accounts mana-
Note: to handle the Google AdWords service by program- ged by the multi-account center.
ming, you need to use the Google AdWords APIs. These •GglAdWListMCCAlert is used to retrieve the list of
APIs have a cost associated to them. GglAdWGetMetho- alerts for the multi-account center. These alerts are
dCost lets you estimate the cost of each function retrieved in an array of gglAdWMCCAlert variables.
Part 7: Communication
427
Note: to handle the Google AdWords service by program- the corresponding ad group.
ming, you need to use the Google AdWords APIs. These 3. Use GglWrite to write the criterion.
APIs have a cost associated to them. GglAdWGetMetho-
dCost lets you estimate the cost of each function. Note: to create different types of criteria and associate
Warning: before using a feature linked to a Google ser- them with different ad groups, we recommend you create
vice, we recommend that you check the user license for an array of variants. This array contains the necessary
the service. Some restrictions may apply. The content of gglAdWKeyword and gglAdWebWSite variables.
the licenses may change over time. To associate an ad with an ad group:
PC SOFT is in no case responsible for the way the native 1. Create an ad definition variable:
access functions are used. Please make sure that you •gglAdWLocalBusinessAd for local ads,
comply with the license of the service provider. •gglAdWImageAd for illustrated ads,
Caution: if you use a proxy to access the Internet, you •gglAdWMobileAd for mobile ads,
need to configure the proxy (proxy function) in order to •gglAdWMobileImageAd for mobile image ads,
use the Google functions.
•gglAdWTextAd for text ads,
5.2.2 How do I proceed? •gglAdWVideoAd for video ads.
Creating an ad group 2. In the variable that was just created, the GroupI-
Caution: before creating an ad group, you need to create dentifier property must correspond to the identifier
an advertising campaign. of the corresponding ad group.
1.Create a gglAdWAdGroup variable. This variable 3. Use GglWrite to create the ad.
contains the characteristics of the ad group to
create.
1.Use GglWrite. In this function, specify the identi- Updating an ad group:
fier of the advertising campaign associated with the To update an ad group:
ad group. 1. Retrieve the requested ad group (via the following
functions):
Associating criteria and ads with the ad group
GglAdWGetActi- Returns the list of active ad groups
An ad group must be associated with at least one ad and for a Google AdWords advertising
one display criterion. veGroup
campaign.
This criterion can be: GglAdWListAd- Returns the data found in several
groups of Google AdWords adverti-
•a keyword: the ad will be displayed when the keyword Group
sing campaigns.
Part 7: Communication
is used.
GglAdWLis- Returns the existing statistics for
•a web site: the ad will be displayed when the site is several Google AdWords ad groups.
displayed. tGroupStats
To associate a display criterion with an ad group: gglGetAdGroup Returns the data found in a Google
AdWords ad group.
1. Create:
•a gglAdWKeyword variable. 2. Modify the gglAdWAdGroup variable correspon-
ding to the requested ad group.
•a gglAdWWebSite variable.
3. Use GglWrite to update the ad group you want.
2. In the variable you’ve just created, the GroupIden-
tifier property must correspond to the identifier of
5.3 Ad management
5.3.1 Overview •Image ad:
Google AdWords proposes the "Ad Service" service. This The image ads are graphic AdWords ads. They are
service is used to manage the Google ads in an ad group. displayed on some sites of the Google network. The
Each ad group can contain one or more ads, that can image ads can be related to the content of the pages
have different formats. An ad can be enabled, disabled on which they are displayed
or paused. Only the enabled ads will be visible. An ad •Local business ad:
cannot exist on its own: it must be associated with an ad The local business ads are AdWords ads that are
group. associated with a specific business location. They are
The different types of ads are: displayed on Google, on Google Maps and on the
entire Google ad network.
Tome1_2.book Page 428 Vendredi, 28. mai 2010 5:50 17
428
429
Part 7: Communication
vice. This service is used to manage the display criteria each function.
for an ad group. Warning: before using a feature linked to a Google ser-
The criteria are used to define the display mode of the vice, we recommend that you check the user license for
ads: the service. Some restrictions may apply. The content of
the licenses may change over time.
•a keyword criterion is used to define the text used for
the search: the ad will be displayed when this PC SOFT is in no case responsible for the way the native
keyword is used. For example, a search performed on access functions are used. Please make sure that you
the "Trees" or a Web page about trees will display comply with the license of the service provider.
the ads for which the text of the criterion is "Tree". Caution: if you use a proxy to access the Internet, you
need to configure the proxy (proxy function) in order to
This type of criterion can be used with a content use the Google functions.
network or with a search network
•A Web Site criterion is used to define a targeting by 5.5.2 How do I proceed?
location: the ad will be displayed when the specified Caution: before creating a criterion, you need to create
site is displayed. This type of criterion can be used an ad group.
with a content network. 1. Create a variable corresponding to the type of cri-
Each ad group can have one or more criteria that will be terion to create:
used to display the ad. •a gglAdWKeyword variable for a keyword criterion.
This help page explains how to use the "CriterionSer- •a gglAdWWebSite variable for a Web Site criterion.
vice" service with the WLanguage functions. See the help In the variable, ..GroupIdentifier is used to asso-
of Google AdWords for more details. ciate the criterion with the ad group.
Reminder: to use the Google AdWords service by pro- If the criterion is an exclusion criterion (the ad must
gramming, you need to use the Google AdWords APIs. not be displayed), ..Excluded must be set to True.
2. Use GglWrite.
Tome1_2.book Page 430 Vendredi, 28. mai 2010 5:50 17
430
431
Part 7: Communication
5.9.1 Overview access functions are used. Please make sure that you
Google AdWords offers the "SiteSuggestion" service. comply with the license of the service provider.
This service is used to get site suggestions for publishing Caution: if you use a proxy to access the Internet, you
the Google AdWords ads. need to configure the proxy (proxy function) in order to
These suggestions can be made according to: use the Google functions
•category criteria.
5.9.2 How do I proceed?
•topic criteria.
Principle:
•demographic criteria.
The "Site Suggestion" service is used to get site sugges-
This help page explains how to use this service with the tions for your ads by specifying criteria. At each call, this
WLanguage functions. service returns an array of gglAdWSiteSuggestion varia-
Note: in the Google AdWords interface, this service cor- bles. Each suggestion contains the following
responds to the target by location tool. information :
Note: to handle the Google AdWords service by program- •URL of the suggested site.
ming, you need to use the Google AdWords APIs. These •Approximate number of times the ad was shown to
APIs have a cost associated to them. GglAdWGetMetho- the site visitors during one day.
dCost lets you estimate the cost of each function.
•Type of ads accepted by the site.
Warning: before using a feature linked to a Google ser-
vice, we recommend that you check the user license for You can then target your ads toward these URLs by crea-
the service. Some restrictions may apply. The content of ting campaigns targeted by location
the licenses may change over time. To use the "SiteSuggestion" service:
PC SOFT is in no case responsible for the way the native 1. Create a gglAdWLanguageGeoTargeting varia-
Tome1_2.book Page 432 Vendredi, 28. mai 2010 5:50 17
432
ble. This variable contains all the characteristics of GglAdWListSiteBy- Lists the suggestions of Web sites
the area for which the suggestions must be sought corresponding to the specified
(languages, countries, regions, etc.). Demographics
demographics criteria
2. To perform a search according to demographic Lists the suggestions of Web sites
GglAdWListSiteByTo-
criteria, create gglAdWDemographicsTarget varia- corresponding to the specified
ble. This variable will contain the preferences regar- pic
topics.
ding the ethnic origin, the children, the age, the Lists the suggestions of Web sites
incomes, the civil status, ... GglAdWListSite-
corresponding to the specified
3. Run the function corresponding to your search: ByURL
URLs.
GglAdWListSiteByCa- Lists the suggestions of Web sites
corresponding to the specified 4.The gglAdWSiteSuggestion variable contains all
tegory the site suggestions
categories. The list of available
categories is supplied by Google
433
Part 7: Communication
GglAdWListAdGroup Retrieves the data found in a several Google AdWords ad groups
GglAdWListClientAccountInfo Retrieves the list of primary email addresses for each account managed by the
multi-account center
GglAdWListReportJobs Retrieves the list of Google AdWords reports performed by the connected account.
GglAdWListSiteByCategory Retrieve the site suggestions by category.
GglAdWListByDemographics Lists the suggestions of Web sites corresponding to the specified demographics cri-
teria. You will then be able to publish the Google AdWords ads on these sites.
GglAdWListByTopic Lists the suggestions of Web sites corresponding to the specified topics. You will
then be able to publish the Google AdWords ads on these sites
GglAdWListByURL Lists the suggestions of Web sites corresponding to the specified URLs. You will then
be able to publish the Google AdWords ads on these sites
GglAdWListAdStats Retrieves the characteristics of the different accounts found in the multi-account
center (also called My Client Center). These accounts depend on the current
AdWords account
GglAdWListCampaignStats Retrieves the existing statistics for a set of Google AdWords marketing campaigns
GglAdWListCriterionStats Retrieves the statistics regarding a set of criteria linked to a group of Google
AdWords ads.
GglAdWListGroupStats Retrieves the existing statistics for several groups of Google AdWords marketing ads.
GglAdWListVideo Retrieves the list of videos available for the Google AdWords user account.
GglAdWSetOptimizedAdServing Enables (or not) the use of optimized ad serving for a Google AdWords campaign
Tome1_2.book Page 434 Vendredi, 28. mai 2010 5:50 17
434
GglAdWScheduleReportJob Schedules the execution of a Google AdWords report by the "Google AdWords
Report Service".
GglAdWGetAd Retrieves the characteristics of a Google AdWords ad.
GglAdWGetCampaign Retrieves a Google AdWords campaign from its identifier
GglAdWGetMethodCost Retrieves the execution cost of an API method of Google AdWords. Indeed, the Goo-
gle AdWords APIs are required to handle the Google AdWords service by program-
ming. These APIs have a cost associated to them.
GglAdWGetAdGroup Retrieves the data for in a Google AdWords ad group.
GglAdWGetAccountInfo Retrieves the information regarding an AdWords account.
GglAdWGetKeywordFromSite Retrieves the suggestions of keywords linked to the content of a Web page. This func-
tion uses the keyword generator of Google AdWords.
GglAdWGetOperationCount Returns the number of operations performed by the user during the specified period.
GglAdWGetUnitCount Returns the number of API units used by the user during the specified period
GglAdWGetUsageQuotaThis- Returns the total number of API units available during the current month for the spe-
cified user. This number of units combines the free units with the units that have a
Month
cost
GglAdWGetFreeUsageQuotaThis- Returns the number of free API units available during the current month.
Month
GglAdWGetUnitCountForClient Returns the number of free API units used by each client of a Google AdWords multi-
account account during the specified period.
GglAdWGetUnitCountForMethod Returns the number of API units used during the call to a specific method of the Goo-
gle AdWords API.
GglAdWGetReportJobStatus Retrieves the edit status for a Google AdWords report
GglAdWGetURLReport Returns the URL used to download the specified Google AdWords report
GglAdWGetURLReportGZip Returns the URL used to download the specified Google AdWords report, com-
pressed in GZip format
GglAdWGetKeywordVariation Retrieves the suggestions for the specified keywords. You have the ability to retrieve
the synonyms. This function uses the generator of keywords and it enables you to get
keyword suggestions for your ads.
Part 7: Communication
GglAdWReplaceExcludedCrite- Replaces the criteria excluded from a Google AdWords advertising campaign. The
previous data is erased and replaced by the new data
rion
GglAdWDeleteReport Deletes Google AdWords report (its description and the generated report if neces-
sary). A pending report can be deleted but no report in progress can be deleted
GglAdWValidateReportJob Validates the description of a Google AdWords report
GglAdWCheckAd Checks the validity of several Google AdWords ads. This function checks whether the
ads comply with the use conditions of the service.
GglAdWCheckCriterion Checks the validity of a set of criteria
GglAdWCheckKeywordTraffic Checks whether traffic will be generated by the specified keywords.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 435 Vendredi, 28. mai 2010 5:50 17
435
6. SALESFORCE
6.1 Using the Salesforce service
6.1.1 Overview 6.1.2 How do I proceed?
Salesforce is a very popular CRM software. It is commer- Connecting to Salesforce
cialized as Saas (Software as a Service), which means To use a WLanguage Salesforce function, you must con-
that the application and the data are hosted on server nect to the Salesforce platform. This connection is perfor-
farms by Salesforce. med by SFConnect and by a sfConnection variable.
However, specific requirements are often created by this Using the Salesforce features
type of software. The development of additional modules The WLanguage Salesforce functions are used to:
is a strong asset in order to use and to customize this
type of software. read, modify and add records in the files of the Sales-
force databases. These files can be preset files or custom
The WLanguage Salesforce functions allow your applica- files.
tions to natively interface with Salesforce.
Using the Salesforce features
Warning: before using a feature linked to a Salesforce
service, we recommend that you check the user license The WLanguage Salesforce functions are used to:
for the service. Some restrictions may apply. The content • read, modify and add records in the files of the Sales-
of the licenses may change over time. force databases. These files can be some preset files
PC SOFT is in no case responsible for the way the native or some custom files.
access functions are used. Please make sure that you • merge records.
comply with the license of the service provider. • Convert "Lead" into account, contact or opportunity.
• request the execution of a specific process. You can
submit records to the approval process or perform an
approval action.
Part 7: Communication
The following functions are used to manage the Salesforce databases:
436
SFSeekDeleted Seeks and retrieves the records (Salesforce objects) deleted during the specified
period.
SFUndelete Restores Salesforce records that were previously deleted.
SFDelete Deletes records from a Salesforce database.
SFEmptyRecycleBin Clears the specified records from the Salesforce recycle bin.
Part 7: Communication
Tome1_2.book Page 437 Vendredi, 28. mai 2010 5:50 17
437
7. RSS STREAM
7.1 Overview
WinDev, WebDev and WinDev Mobile allow you to pro- (consumed) by an application.
duce and/or consume a RSS stream (Rapid Simple Syn- A reader of RSS stream is used to display one or more
dication). RSS streams. WinDev is supplied with an RSS stream
A RSS stream is used to produce (make available) a data reader example: WD Read RSS.
stream in standard format. This data stream can be read
Part 7: Communication
>= 1 THEN
MyChannel is rssChannel
MyChannel = MyRSSStream.Channel[1]
…
438
8.LDAP SERVER
8.1 Overview
LDAP (Lightweight Directory Access Protocol) is Depending on the information stored in the LDAP direc-
increasingly used in the business world. tory, you can for instance identify a user when he con-
This protocol is used to manage network directories. This nects to an application, check the user rights for the
protocol defines the operations for accessing and sear- application, …
ching data, which allows one to make compatible sys- LDAP server management functions
tems that were not necessarily so. The LDAP functions are as follows:
LDAPAddAttribute Adds an attribute or adds a new value to an existing attribute.
LDAPConnect Used to connect to an LDAP server
LDAPStartAdd Initializes the addition of a new object into an LDAP server.
LDAPStartModify Initializes the modification of an existing object in an LDAP server.
LDAPDisconnect Used to disconnect from an LDAP server.
LDAPListAttribute Lists the attributes of an object in an LDAP server.
LDAPListChildren Lists the children of an object in an LDAP server.
LDAPNbValue Returns the number of values for an attribute.
LDAPReset Resets the LDAPSession structure used by LDAPConnect.
LDAPFind Performs a search in an LDAP server. The search is performed recursively.
LDAPReplaceAttribute Replaces all the values of an attribute by a specific value.
LDAPReplaceAttributeValue Replaces a specific value of an attribute by a new value.
LDAPRenameAttribute Renames an attribute. The value of the attributes is kept during this operation.
LDAPDelete Deletes an object from the LDAP server. For security reasons, the object will be dele-
Part 7: Communication
See the online help for more details about these functions.
Tome1_2.book Page 439 Vendredi, 28. mai 2010 5:50 17
439
9.1 Overview
WinDev allows you to easily manage the incoming and Dev. This tool is used to list the available TAPI lines and to
outgoing phone calls via the telephony functions. These specify the line that will be used by default by the tele-
functions are used to manage a voice box, an answering phony functions. This enables you to quickly detect the
machine, ... in a WinDev application directly. conflicts that may occur between the different TAPI lines.
Required WinDev configuration Note: TAPI lines are different from classic phone lines.
To be able to use the telephony features, you must have: Before using the telephony functions, you can define by
• a modem. programming the TAPI device on which the calls must be
To save and play back recordings, this modem must have detected or dialed. Use the following functions:
voice support. tapiCapability Enables you to find out the featu-
To identify the caller, the modem must support "Caller res of a TAPI device
ID" (caller ID).
tapiDeviceList Enables you to find out the list of
• the Tapi 2.0 protocol. This technology can be used on TAPI 2-compatible devices
all the systems; however, you must:
- install the service pack 4 (or later) if the system used is tapiDevice Enables you to select the device
Windows NT4 that will be used by the TAPI func-
- upgrade the system if the system used is Windows 95 tions.
(can be downloaded from ftp://ftp.microsoft.com/deve-
Required WinDev Mobile configuration
lopr/tapi/tapi2195.zip).
Address valid at the time of publication. To be able to use the telephony functions, the application
must be installed:
Check the configuration
• on a Pocket PC with phone access (GSM).
To check the configuration of your computer, we recom-
mend that you use WDTelDiagno.exe provided with Win- • and/or on a Smartphone.
Part 7: Communication
9.2 Managing the incoming calls
The management of the incoming calls is performed in a function runs a specific WLanguage procedure. This pro-
specific "thread". When an incoming call is detected, cedure will be automatically executed when an incoming
the procedure associated with the thread is executed. call will be detected.
The management of the call is performed in this proce- 3. In this procedure, you can:
dure. • find out the status of the call via the following cons-
tants:
9.2.1 The different steps
To manage the incoming calls in a WinDev application: tapiLineBusy The line is currently busy
1. If needed, define the TAPI device on which the call tapiLineConnected The line is connected
detection must be performed. Use the following func-
tions: tapiLineDialing Dialing in progress
tapiCapability Enables you to find out the featu- tapiLineDialTone The line gets a dial tone
res of a TAPI device tapiLineDisconnec- The correspondent has hung up
tapiDeviceList Enables you to find out the list of ted
TAPI 2-compatible devices tapiLineProceeding The call is dialed: looking for the
tapiDevice Enables you to select the device person called
that will be used by the TAPI func- tapiLineRingBack Ringing in progress
tions.
2. Start detecting the incoming calls with tapiListen. This
Tome1_2.book Page 440 Vendredi, 28. mai 2010 5:50 17
440
441
Part 7: Communication
9.3 Managing the outgoing calls
9.3.1 The different steps tapiLineDialing Dialing in progress
To manage the outgoing calls in a WinDev application:
tapiLineDialTone The line gets a dial tone
1. If needed, define the TAPI device on which the call dia-
ling must be performed. Use the following functions: tapiLineDisconnec- The correspondent has hung up
ted
tapiCapability Enables you to find out the featu-
res of a TAPI device tapiLineProceeding The call is dialed: looking for the
person called
tapiDeviceList Enables you to find out the list of
TAPI 2-compatible devices tapiLineRingBack Ringing in progress
tapiDevice Enables you to select the device 4. Pick up the phone receiver to communicate.
that will be used by the TAPI func- 5. During the communication, you can use WLanguage
tions. functions for handling the call (see below). There is no
need to specify the identifier of the call because the call
2. Dial the telephone number using a modem (tapiDial). processed will be the current call (which means the
3. This function calls a specific WLanguage procedure outgoing call).
that manages the call. In this procedure, the following 6. At the end of the call, close the line with tapiHangUp.
variables enable you to find out the status of the line:
7.Hang up the receiver.
tapiLineBusy The line is currently busy
tapiLineConnected The line is connected
Tome1_2.book Page 442 Vendredi, 28. mai 2010 5:50 17
442
9.3.2 Handling an outgoing call tapiCalledID Returns the phone number cal-
The following operations can be performed on the led
outgoing calls:
• performing specific operations:
• finding out the characteristics of the outgoing call:
tapiStop Forces the reading of a prere-
tapiCallStart Returns the date and time of the corded message to stop (tapi-
beginning of the call Play
tapiCallIsOver Enables you to find out whether tapiRecord Saves the current communica-
the call is over tion in a .WAV file.
tapiCallIsBusy Enables you to find out whether tapiPlay Plays a sound file (.WAV) for the
the number called is busy specified line. You can play the
tapiCallEnd Returns the date and time of the message found on the answe-
end of the call ring machine for instance.
tapiCallDuring Returns the duration of the call tapiSendKey Enables you to simulate the use
of the phone keys.
tapiNoAnswer Enables you to find out whether
an answer was given to the call tapiKeyPressed Enables you to find out the his-
tory of the keys pressed on the
tapiCallerID Returns the calling phone num- phone keypad.
ber
443
Part 7: Communication
Tome1_2.book Page 444 Vendredi, 28. mai 2010 5:50 17
444
10.1 Overview
WinDev Mobile allows you to: Required configuration
•send SMSs. To be able to use the SMS functions, the application must
•read incoming SMSs. be installed:
•delete one or more incoming SMS. • on a Pocket PC with phone access (GSM).
• and/or on a Smartphone.
An SMS (Short Message Service) is a text message (up to WinDev for Pocket PC only lets you send SMS. SMS are
160 characters) sent on a cell phone. received in a standard way by the device used (Pocket
PC, Smartphone, cell phone, etc.)
445
10.2.4 Managing the different types of num- 10.2.5 Operating mode in GO mode and at run
bers time
Two types of numbers can be used to send SMSs: In GO mode (simulation on the development computer),
•The short numbers (also called "National" num- a WLanguage error is generated when using one of SMS
bers). These numbers can be accessed from the structure’s variables.
country only.
•The standard numbers (also called "International"
numbers, in 06.xx.xx.xx.xx format). These numbers
can be accessed from anywhere.
See the online help for more details about these functions.
Part 7: Communication
Tome1_2.book Page 446 Vendredi, 28. mai 2010 5:50 17
446
11.1 Overview
A large number of WLanguage functions enable you to 3. Configure (if necessary) the options of the fax ser-
send faxes via the system fax server available in Windows ver by programming.
XP and Windows 2000.
Notes:
How do I send faxes? • iPreview/iDestination also allows you to send a print
To send faxes from an application or a site, you must: job to a fax.
1. Configure the computer from which the fax must • In Windows Vista, the management of faxes is availa-
be sent. ble in Windows Vista Professional Edition and Windows
2. Create the application or the site for sending Vista Ultimate Edition.
faxes.
1. Check the configuration of the modem Note: to create a cover page (.Cov), use the "Cover
Open the control panel of Windows ("Start .. Parameters page" tab.
.. Control Panel") and select "Phone and Modem
Options". 11.2.3 Configuring the fax server in Windows
2. Install a standard fax server XP
Windows XP and 2000 come with a fax server. To configure the fax server:
To install this fax server, select "Add/Remove Programs" 1. Select "Start .. Fax and Printer".
in the Windows control panel ("Start .. Parameters .. 2. Double-click "Fax". The Fax Configuration Wizard
Control Panel"). starts.
3. Check whether the standard fax service of Windows is 3. Select "Tools .. Configure".
in incoming mode. 4. Validate the default parameters until you reach
the "Configuration for receiving and sending faxes"
plane.
11.2.2 Configuring the fax server in Windows 5. Enable the feature for sending faxes in order to
2000 send faxes from an application or a site.
In Windows 2000, the fax server is called "Fax Service". 6. Validate. The fax server is started.
To configure the fax server: Note: to create a cover page (.Cov), use "Tool .. Custom
1. Open the control panel of Windows ("Start .. cover page".
Parameter .. Control Panel").
2. Double-click "Fax Service". If this option is not
Tome1_2.book Page 447 Vendredi, 28. mai 2010 5:50 17
447
Part 7: Communication
11.4 Configuring the fax server by programming
11.4.1 Options of the fax server Number of days before deleting Dirty Days
The standard fax server of Windows offers several options unsent faxes
that can be configured directly from the interface of the
Archive the outgoing faxes ArchiveOutgoingFax
fax server. These different options can be configured by
programming via the registry. You have the ability to con- Directory of the outgoing faxes ArchiveDirectory
figure and find out:
Print the top header Branding
• information about sending faxes (Windows 2000) :
The corresponding registry key is Forbid the custom cover pages ServerCoverPageOnly
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fax:
Time when the economy rate StartCheapTime
Number of attempts Retries starts
Number of minutes between Retry Delay Time when the economy rate StopCheapTime
two attempts ends
Tome1_2.book Page 448 Vendredi, 28. mai 2010 5:50 17
448
Business phone OfficePhone It is possible to consider that a fax whose status changed
from FaxStatusInit OR FaxStatusCall to FaxStatusInac-
Displays the status monitor VisualNotification tive was attempted to be sent once. This fax can be
when sending AND receiving resent then (it will not be resent automatically because
faxes "No retry for sending faxes" is set to True).
Status monitor always on top AlwaysOnTop
Sound notification SoundNotification
Invoicing code BillingCode
Note: iPreview iDestination also let you send a print job to a fax.
Tome1_2.book Page 449 Vendredi, 28. mai 2010 5:50 17
449
12.1 Overview
Very common among the PDAs, the Palm Pilot enables 12.1.2 WinDev and Palm Pilot
you to easily perform several operations: Two types of accesses are available in this version:
• entering information in the notepad • Write access, for adding data into the various palm
• managing a calendar and a task list Pilot databases: Notepad, task list, calendar and
• managing a contact book. address book.
The data is added to the Palm Pilot database found on
12.1.1 PC and Palm Pilot the PC and it is automatically included in the Palm Pilot
The Palm Pilot, supplied with the HotSync program, ena- during the next synchronization.
bles you to easily communicate with your PC and update • Read access, for reading all the messages from the
all your personal data. To do so, rest the Palm Pilot on its various Palm Pilot databases: Notepad, task list,
stand and press the [HOTSYNC] key. The information calendar and address book.
found in the Palm Pilot and in your PC are automatically The messages are read on the Palm Pilot database
synchronized. found on the PC and they can be updated after a syn-
chronization.
Caution: WinDev only supports tools that use PALM OS.
Part 7: Communication
data found in one of the Palm Pilot databases (Pal- 1. Open one or more accesses with PalmLoad.
mAdd, PalmModify or PalmDelete). 2. Use the records found in the Palm Pilot database with
• Second option: insert data directly from a HyperFi- the following functions:
leSQL database into the Notepad database (StringTo-
Palm and FileToPalm). PalmAdd Adds a record to one of the Palm Pilot
The following paragraphs present these two methods. databases
PalmModify Modifies the current record
12.2.1 First possibility: Adding, modifying and
deleting data PalmDelete Deletes the current record
WinDev enables you to directly add, modify and delete These functions let you easily manage the records
data found in the various Palm Pilot databases (note- through the Palm structure (page 469).
pad, calendar, task list and address book).
3. Close the accesses to the Palm data with PalmClose.
During the synchronization, HOTSYNC.EXE (the synchro-
Advice: before modifying the database, we recommend
nization tool) is directly synchronized with the Palm Pilot
you make a backup copy of the database (using fCopy-
database.
File for example). A backup copy is automatically perfor-
med before the synchronization (memodat.bak file).
Note: During the execution of the WinDev application,
you can:
• synchronize the Palm
Tome1_2.book Page 450 Vendredi, 28. mai 2010 5:50 17
450
• start and use the Palm Desktop. Caution: if modifica- the Palm Desktop application is automatically notified of
tions are made in the Palm Desktop, you will need to this modification and it is automatically updated. The
update the data of the WinDev application using Pal- data modified by the WinDev application is refreshed in
mRefresh. real time.
If the database was modified by the WinDev application,
Part 7: Communication
Tome1_2.book Page 451 Vendredi, 28. mai 2010 5:50 17
451
12.2.2 Second Possibility: Inserting data zation tool uses a specific WinDev DLL to manage the
directly from a HyperFileSQL database addition of new records into the Palm Pilot’s database.
WinDev enables you to add data to the Palm Pilot "Note- First, it synchronizes with the Palm Pilot database (1),
pad" database. The new data is written in specific files. then it synchronizes with the records added by the user
(2).
During the synchronization, the HOTSYNC.EXE synchroni-
Part 7: Communication
Tome1_2.book Page 452 Vendredi, 28. mai 2010 5:50 17
452
453
Part 7: Communication
Type and PalmAddressContact
Type array. arrays.
Variable in read/write mode. PalmAddress.Country Character string (up to 255
PalmAddress.Define Array of strings (array of 4 ele- characters).
ments maximum, each ele- Country corresponding to the
ment can have up to 255 address of the person.
characters)
Variable in read/write mode.
Additional information about
the contact, his address, … palmAddress.First- Character string (up to 255
Name characters).
Variable in read/write mode.
Contact First Name.
PalmAddress.State Character string (up to 255 Variable in read/write mode.
characters).
State corresponding to the PalmAddress.Com- Character string (up to 255
contact address. pany characters).
Variable in read/write mode. Name of the company where
the person works.
PalmAddress.Title Character string (up to 255 Variable in read/write mode.
characters).
Position of the contact in the
company (title, …).
Variable in read/write mode.
Tome1_2.book Page 454 Vendredi, 28. mai 2010 5:50 17
454
455
Part 7: Communication
Start time of the task saved in the calendar.
Only hours and minutes are taken into account (HHMM). If a task does not have a
scheduled time, palmOrganizer.StartTime and palmOrganizer.EndTime are set to
00:00.
Variable in read/write mode.
PalmOrganizer.EndTime Character string in HHMMSSCCC format
End time of the task saved in the calendar.
Only hours and minutes are taken into account (HHMM). If a task does not have a
scheduled time, palmOrganizer.StartTime and palmOrganizer.EndTime are set to
00:00.
Variable in read/write mode.
PalmOrganizer.Notes Character string (up to 511 characters).
Additional note about the task saved in the calendar.
Variable in read/write mode.
PalmOrganizer.EndDateRepetition Character string in YYYYMMDD format or Date variable. Mandatory information.
End time of the recurring task saved in the calendar. If this date is not specified
while a recurrence is requested, the recurrence will never end.
Variable in read/write mode.
PalmOrganizer.ExceptionsRepeti- Character string in the format "YYYYMMDD+CR+YYYYMMDD+CR+…"
tion Days to omit for the recurring task saved in the calendar.
Variable in read/write mode.
Tome1_2.book Page 456 Vendredi, 28. mai 2010 5:50 17
456
start date. For example, task starting Monday 08/19/02 and repeated every
3rd Monday of the month, or task starting Thursday 08/22/02 and repeated
every 4th Thursday of each month.
• palmDailyRepetition: task recurring every XX days.
PalmOrganizer.NoTime Boolean
True if the task does not have a specific schedule. This variable has priority over the
start and end task times.
If a task does not have a scheduled time, palmOrganizer.StartTime and palmOrga-
nizer.EndTime are set to 00:00.
Palm.Data Character string. Data for the record found in the Palm "Organize" database (in
binary format). Variable in read/write mode.
Palm.Position Integer. Position of the current record. The variable is read-only.
Tome1_2.book Page 457 Vendredi, 28. mai 2010 5:50 17
457
Conditions for reading PALM data: Caution: if you use PalmReset, your Palm data will not be Part 7: Communication
To read the PALM data, you must: accessible from Outlook.
1. have installed HOTSYNC.EXE (Palm Pilot synchro- Use principle
nization tool) on the current computer In order to read the records of a Palm Pilot database from
2. have synchronized the data once. a WinDev application, you must:
Special case: Using Outlook or another PALM data mana- 1. Open one or more accesses with PalmLoad.
ger (different from the PalmDeskTop) 2. Read the records found in the PALM database.
If your Palm Pilot data does not display in the PalmDesk- 3. Refresh the access to the records if necessary (after
Top manager, you will not be able to use the PALM data- synchronizing for instance).
base from a WinDev application. In this case, use 4. Close the accesses to the PALM data with PalmClose.
PalmReset to reinitialize your configuration.
Tome1_2.book Page 458 Vendredi, 28. mai 2010 5:50 17
458
459
Part 7: Communication
PalmRAZ Initializes all the PALM variables in order to build a new record
PalmReset Reinitializes the configuration of the Palm Pilot program (HotSync.EXE) if a problem occurs
PalmDelete Deletes the current record in the specified access
PalmToString Transmits the content of a text memo found on the Palm Pilot (in a character string format)
See the online help for more details about these functions.
Tome1_2.book Page 460 Vendredi, 28. mai 2010 5:50 17
460
InternetConnected Defines whether an Internet connection (by ADSL or modem) is active on the current compu-
ter
Proxy Specifies that the communication functions that use the HTTP protocol (HTTP, DotNet, J2EE
and SOAP functions) will go via a proxy to run their requests
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 461 Vendredi, 28. mai 2010 5:50 17
461
14.1 Overview
Several methods can be used to upload and download identifier.
files over the Internet: 2. Upload, download files.
• The WinDev FTP or RPC. These protocols require the 3. Close the connection to the server with NetDis-
use of a specific FTP/RPC server powered by WinDev connect.
• the standard FTP. This protocol requires the use of a Caution:
standard FTP server. See ’Communicating with an FTP The TCP/IP communication protocol must be installed
server’, page 484, for more details. and an IP address must be defined.
Note: A WinDev FTP or RPC server operates in 32-bit mode only.
• RPC: Remote Procedure Call
• FTP: File Transfer Protocol
14.1.2 Other features
You can also:
14.1.1 Uploading and downloading files via • Find out the name and IP address of a computer.
WinDev FTP or RPC: rules to follow • Run a program on a WinDev FTP or RPC server.
To upload and download files, you must comply with the • Trigger a Windows element on the WinDev FTP or RPC
following rules: server.
1. Connect to a WinDev FTP server with NetConnect. • Transmit a character string to a WinDev FTP or RPC ser-
This function establishes a connection between Win- ver.
Dev and the server and it provides a connection
Part 7: Communication
To transfer files, a connection must be established with a In the following example a file is transferred to the Win-
WinDev RPC or FTP server. The connection is established Dev FTP server (NetSendFile function). A progress bar
by NetConnect. The source code for establishing a con- enables you to follow the progress of the transfer.
nection must be found before the first "Net" function. - - Initialization code of the
The value returned by NetConnect must be stored - - "RPCClient" window
because it will be used by the other "RPC" and "FTP" GLOBAL
functions. Transfer_Done is boolean
The code used to connect to a RPC server is as follows: Transfer_Done = False
Function RPCConnection (Address,… Transfer_InProgress is boolean
User, Password) Transfer_InProgress = False
//Connection to a RPC server Event("ProgressBar_Transfer",…
ConnectionNum is int "RPCClient", "SendFile")
ConnectionNum = NetConnect(Address, ….
RPCServer, User, Password) hConnect is int
Result ConnectionNum hConnect = NetConnect(…
"148.61.125.245", FTPServer,…
"GUEST", "")
…
Tome1_2.book Page 462 Vendredi, 28. mai 2010 5:50 17
462
Note: you can easily get the list of directories and files
found on a WinDev FTP server. There is an example in the WinDev RPC/FTP server
description on how to use the NetDirList function. Once the files have been transferred, you must discon-
-- Opening code of the window nect from the WinDev RPC or FTP server. The disconnec-
// Request an available message tion is performed by the NetDisconnect function. The
// from Windows disconnection code must be found after the last "Net"
GLOBAL statement. The "ConnectionNum" variable, required for
WM_MYMESSAGE is int the disconnection, contains the value retrieved by Net-
lpString is string fixed on 20 … Connect.
lpString = "Gauge_Main" The code used to disconnect from a WinDev RPC server is
hConnect is int as follows:
// Connection //Disconnection from a WinDev RPC ser-
hConnect = … ver
NetConnect("148.61.125.245",… //ConnectionNum contains the value
FTPServer, "GUEST", "") // returned by NetConnect
WM_MYMESSAGE = … NetDisconnect(ConnectionNum)
CallDLL32("USER32", …
"RegisterWindowMessageA", …
&lpString)
Tome1_2.book Page 463 Vendredi, 28. mai 2010 5:50 17
463
Part 7: Communication
NetRemoteMessageBox Displays a dialog box on the screen of the FTP server (File Transfer Protocol) or RPC server
(Remote Procedure Call) created by WinDev
NetMsgError Returns the error message corresponding to the error number returned by NetOpenRemo-
teAccess and NetCloseRemoteAccess
NetMachineName Returns the name of the local computer
NetServerOption Manages the rights of the clients on the server (FTP server (File Transfer Protocol) or RPC
server (Remote Procedure Call) created by WinDev)
NetOpenRemoteAccess Establishes a remote connection to a modem
NetGetFile Retrieves an existing file from an FTP server (File Transfer Protocol) created by WinDev
NetRenameFile Renames (or moves) a file found on the FTP server (File Transfer Protocol) or RPC server
(Remote Procedure Call) created by WinDev
NetEraseFile Deletes a file from the FTP server (File Transfer Protocol) or from the RPC server (Remote
Procedure Call) created by WinDev
See the online help for more details about these functions.
Tome1_2.book Page 464 Vendredi, 28. mai 2010 5:50 17
464
modified by FTPCurrentDir.
15.1.3 Principle When connecting to an FTP site, the initial directory (the
To handle files on an FTP server from an application or user’s "home directory") is not necessarily found at the
site, you need to follow these rules: root of the FTP server. Therefore, we recommend that you
use relative paths.
Tome1_2.book Page 465 Vendredi, 28. mai 2010 5:50 17
465
15.1.5 Example • transfer the files from the local computer to this FTP
A full example is provided with WinDev: WD FTP. server and download the files found on the FTP server
to the local computer.
This example is used to connect to and to disconnect
from an FTP server. • create, rename and delete the files and/or the directo-
ries found on the FTP server.
Once the connection is established, all the files found on
the server and on the current computer are listed. • find out the characteristics of the files found on the FTP
server (file size and attributes, …)
You can:
Part 7: Communication
fer Protocol)
FTPDeleteFile Deletes a file from an FTP server (File Transfer Protocol)
FTPSize Returns the size (in bytes) of a file found on an FTP server (File Transfer Protocol)
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 466 Vendredi, 28. mai 2010 5:50 17
466
467
3. If a response to the message is required, the server recommended when sockets are used to communicate
sends a response to the client computer. between two WinDev applications, or between a WebDev
site and a WebDev server application.
Step 3: End of communication
The message is in the format: "11\r\nHelloWord"
To end the communication, close the socket from the
client computer with SocketClose. Method 2: Standard mode: the end of the message is
marked by a specific character, set in advance. This
Note: you can also end the communication from the ser- transmission mode is recommended when sockets are
ver machine. used to communicate between a WinDev application and
another application, or between a WebDev site and ano-
16.2.2 Transmission mode of information ther site. In this case, a specific character must be inclu-
The transmission mode of the message defines the mode ded in the message to indicate that the message is over.
used to specify the length of the message. The message has the following format: "Hello
Several methods are available to find out the length of World<EOF>"
the message during the communication between soc- Method 3: Standard mode with buffer: Corresponds to
kets. the standard mode optimized for the protocols that are
Method 1: WinDev/WebDev Mode: By default, the num- the most used on the Internet.
ber of characters in the message is specified at the SocketChangeTransmissionMode lets you change the
beginning of the message. This transmission mode is transmission mode used.
Part 7: Communication
16.3.1 Simplified server To read and write on the socket, the WinDev server appli-
cation must use SocketRead and SocketWrite.
Step 1: Creating the socket
Caution: A write operation must have been performed
To create the socket, the server uses SocketCreate. A before a read operation can be performed. For example:
socket is associated with a specific port. To simplify the
1. The client computer writes to the socket: it sends a
use of the socket by programming on the server, specify request to the server.
the name of the socket.
2. The server performs a read operation on the socket in
The client computer will connect to this socket in order to a thread. As soon as a message is received, the message
exchange data. The connection between the two compu- is processed by the server.
ters will be actually established during the first exchange
of data between the two computers (i.e. when the server 3. If a response to the message is required, the server
reads information for the first time). identifies the client computer (SocketClientInfo) and
returns a response to it.
The connection is established during the first successful
attempt of SocketRead on the server.
Tome1_2.book Page 468 Vendredi, 28. mai 2010 5:50 17
468
WinDev gives you the ability to create a standard socket in a specific thread. Therefore, this function is performed
server. This server enables you to manage the connection in background task. When a connection request is detec-
of several client computers to the same socket. This prin- ted, you can:
ciple is used to create a news server for instance. • accept the connection (SocketAccept): in this case, a
specific communication channel is created. To avoid
16.4.1 The standard socket server locking the applications, the management of the inco-
Step 1: Creating the socket ming messages is often performed by a specific thread
To create the socket, the server uses SocketCreate. A (see ’Managing the threads’, page 493, for more
socket is associated with a specific port. Several sockets details).
can be created, each socket using a specific port num- • refuse the connection (SocketDeny).
ber. A name (used to handle the socket by programming)
Part 7: Communication
469
To differentiate the threads, their name corresponds to 2. The server reads from the socket in a thread. As soon
the communication channel name (unique name). as a message is received, the message is processed by
IF NOT SocketCreate("Server", … the server.
8000) THEN 3. If a response to the message is required, the server
Error("creation error " +… identifies the client computer and sends a response to it.
ErrorInfo(errMessage))
ELSE Step 4: To end the communication, simply close the soc-
ThreadExecute("Thread1", … ket with SocketClose.
threadNormal,…
WaitProcedure)
16.4.2 Transmission mode of information
END The transmission mode of the message defines the mode
used to specify the length of the message.
Procedure WaitProcedure() Several methods can be used to define the length of the
LOOP message during the communication between sockets.
IF SocketWaitForConnection(… Method 1: WinDev mode: By default, the number of cha-
"Server") Then racters in the message is specified at the beginning of
Channel is string the message. This transmission mode is recommended
Channel = SocketAccept("Server") when sockets are used to communicate between two
ThreadExecute(channel, … WinDev applications.
threadNormal,…
The message is in the format: "11\r\nHelloWord"
ManagementProcedure, channel)
END Method 2: Standard mode: the end of the message is
END marked by a specific character, set in advance. This
transmission mode is recommended when sockets are
Step 3: Exchanging data used to communicate between a WinDev application and
another application. In this case, a specific character
When two computers use the same socket, a communi- must be included in the message to indicate that the
cation channel is established between these two compu- message is over.
ters. These two computers can read and write character
strings on the socket. The message has the following format: "Hello
World<EOF>"
To read and write on the socket, the WinDev server appli-
cation must use SocketRead and SocketWrite. Method 3: Standard mode with buffer: Corresponds to
the standard mode optimized for the protocols that are
Caution: to perform a read operation, a write operation the most used on the Internet.
Part 7: Communication
must have been performed. For example:
SocketChangeTransmissionMode lets you change the
1. The client computer writes to the socket: it sends a transmission mode used.
request to the server.
Tome1_2.book Page 470 Vendredi, 28. mai 2010 5:50 17
470
471
Part 7: Communication
stack used. • (*) TrendNet TBW-102UB - Bluetooth Class 2 Adapter
Some WLanguage functions can only be used with some (Bluetooth 1.1), …
types of stacks. This information is presented in details in This list is not exhaustive and it will be updated on a regu-
each relevant WLanguage function. lar basis.
The following keys use a Microsoft stack (without instal-
ling to driver supplied with the keys):
(*) Some keys do not directly operate in Windows, a dri-
• D-Link DBT-120, ver must be installed via the following operating mode:
• Broadcom Bluetooth 2.0 EDR USB, 1. If it was installed, uninstall the driver provided
• EMTEC Dongle Bluetooth 2.0 EDR - EKCOB110, with the key using the "Add/Remove program"
• HAMA Nano Bluetooth Adapter 2.0 EDR - 10m, option in the Control Panel,
• Conceptronic Dongle Bluetooth 2.0 EDR - 2. Insert the CD provided with the key in the drive,
CBT200U2A, DO NOT start the automatic launch,
3. Connect the key,
• Kensington Bluetooth USB Micro Adapter (Bluetooth 4. Tell Windows to look for the driver on the CD.
2.0 - USB 2.0),
This method enables you to have a key recognized by
• (*) Belkin Bluetooth 2.0 Adapter - F8T013FR1 - 10 Windows and therefore to use a Microsoft stack.
meter range (USB 2.0),
Tome1_2.book Page 472 Vendredi, 28. mai 2010 5:50 17
472
OBEXDisconnect Enables you to disconnect from a device that supports the OBEX protocol.
OBEXSendFile Sends a file to a device that supports the OBEX protocol.
OBEXSendVCard Sends a VCard file (virtual business card) to a device that supports the OBEX
protocol.
OBEXListFile Lists the files shared by a device that uses the OBEX protocol.
OBEXGetFile Retrieves a file from a device that supports the OBEX protocol.
OBEXGetVCard Retrieves a VCard from a device that supports the OBEX protocol.
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 473 Vendredi, 28. mai 2010 5:50 17
473
Part 7: Communication
application or site. The following functions are used to manage the threads:
This secondary thread will run in parallel to the main ThreadStop Stops a "secondary" thread.
application or site. All the processes that can be run in
background task can be performed in this thread: receive ThreadExecute Starts the execution of a secondary
emails, … "thread". This "thread" is a non-loc-
king thread.
Note: an efficient thread is a thread that waits for a speci-
fic event, such as a user action, an incoming call or email, ThreadMode Changes the management mode of
… the threads.
18.2.1 Simple management of threads 18.2.2 Characteristics of the threads
A secondary thread is created by ThreadExecute. In WLanguage, a secondary thread can be associated
A secondary thread is automatically stopped when: with:
• the procedure corresponding to the thread is over, • a procedure local to the current window or page,
• the object that created the thread is closed. • a procedure global to the project,
You can also force a thread to stop by using ThreadStop. • a method of a class,
• a global method of a class
Tome1_2.book Page 474 Vendredi, 28. mai 2010 5:50 17
474
18.2.3 Access to existing elements and Hyper- These two threads share the variables but they do not
FileSQL context manage the access to the common resources. If the
When creating a thread, all the declarations, objects, ele- thread 1 is run before the thread 2, i will be set to 1 ins-
ments and so on, ... are common: tead of 2.
• to the new secondary thread Note: to share an assignment among several threads,
you need to use semaphores.
• to the thread where the secondary thread was created
(the main thread in most cases). 18.2.4 Limits of the processes performed by
Therefore, these threads can access the variables, the thread
procedures, ... All the variables created once a thread is Forbidden processes
started are accessible in the thread where they have
been created. Caution: you cannot execute the following processes
inside threads:
Similarly, when creating a thread, the HyperFileSQL con-
text is automatically duplicated. Each thread handles a • Opening WinDev windows with WLanguage functions
specific HyperFileSQL context. The number of HyperFi- such as Open, Use, Close, ... A specific management
leSQL contexts is equal to the number of threads cur- mode must be implemented if some windows must be
rently run. The entire HyperFileSQL context is copied handled in the threads (very rare). See ’Opening a win-
(filter, search condition, …). The HyperFileSQL context dow from a secondary thread’, page 497, for more
evolves independently in each thread. details.
This enables you to perform two different browse opera- • Displaying WebDev page (or page contexts) with WLan-
tions on the same file in two different threads. guage functions such as ContextOpen, FramesetDis-
play, PageDisplay, PageUse, …
Example: a filter is created on the Customer file. Threa-
dExecute is called to create the CTX2 thread. The Custo- • Event management.
mer file is filtered in each thread. If the filter is activated • Timer management.
in the main thread, the filter will always be active in the
Processes of a WinDev application/WebDev site
CTX2 thread.
By default, any WinDev/WebDev process (click code of a
Caution: writing and assignment inside a thread: if write
button for instance), all the procedures as well as the
or assignment operations are performed in a thread, the
methods of classes can only be run by a single thread at
other running threads do not share this information. a given time.
Some inconsistencies may occur.
In order for several threads to execute these processes
Example: at the same time, you need to:
Code of Thread 1 Code of Thread 2
Part 7: Communication
475
18.3.2 Implementing a semaphore must be used in the same process (in a procedure for
The different steps for creating a semaphore are as fol- instance).
lows: Functions for managing the semaphores
1. Create a semaphore with SemaphoreCreate. The
The following WLanguage functions are used to manage
semaphore is associated with a name.
the semaphores:
2. Call SemaphoreStart before the piece of code to
Part 7: Communication
protect. SemaphoreCreate Creates a semaphore
3. Call SemaphoreEnd after the piece of code to
protect. The code lines found after SemaphoreEnd SemaphoreStart Locks the current thread while wai-
will not be protected. ting for the semaphore to open
4. Destroying the semaphore with SemaphoreDes- (i.e. waiting for an "available"
troy. spot in the protected area)
Notes: SemaphoreDes- Explicitly destroys a semaphore
troy
• The code sections protected by a semaphore must be
as short as possible and they must only affect the "cri- SemaphoreEnd Allows one or more threads to exit
tical" processes. the area protected by the sema-
• A semaphore with the same name can be used to pro- phore
tect several different code sections. A single thread
can be found at a given time in one of the sections pro- Example: to perform an assignment shared by several
tected by the semaphore. threads, you need to encapsulate in a semaphore the
• When a thread is pending, the resources of the proces- assignment of the variables as well as their reading.
sor are not used.
18.3.3 Limited Semaphore: Critical Section
• The semaphores apply to the main thread and to the
secondary threads (created by ThreadExecute). You A critical section is a semaphore limited to a single
must avoid locking the main thread. If the main thread thread on a single code section (process, procedure,
is locked (pending), the application or the site cannot etc.).
run anymore.
• The SemaphoreStart and SemaphoreEnd functions Unlike the semaphores, a critical section can only be
used once.
Tome1_2.book Page 476 Vendredi, 28. mai 2010 5:50 17
476
For example, a critical section can be used to protect a CriticalSectionEnd Marks the end of a critical sec-
procedure for updating the controls in a window or a tion: another thread will be able
page. to execute the code
Functions for managing the critical sections
The following functions are used to manage the critical
sections:
CriticalSectionStart Marks the beginning of a criti-
cal section: no other thread will
be able to run the code as long
as the current thread does not
exit the critical section
secondary thread for instance). One of the threads waits The following functions are used to perform a simple
for a specific action from the second thread before it can management of signals:
be run.
Example: application or site managing a spell checker ThreadWaitSignal The current thread is locked as
long as no signal is received
When the user enter the SPACE character in an edit con-
from another thread
trol, the spell checker is automatically run to check the
previous word. ThreadSendSignal The current "thread" sends a
In this case, the spell check is managed in a secondary signal to the specified
thread. "thread" to unlock it
Whenever the SPACE key is pressed, the main thread
sends a signal to the secondary thread in order to start 18.4.2 Advanced management of signals
the spelling checker. An advanced management of signals consists in commu-
The code is as follows: nicating between several threads (more than 2). Some
threads are waiting for a task performed by the main
thread. When the main thread performs this task, it
sends a signal to all the secondary threads.
Tome1_2.book Page 477 Vendredi, 28. mai 2010 5:50 17
477
Part 7: Communication
The solution consists in making the main thread open the IF gnIdEvent = 0 THEN
window. // Error while implementing
// the event for managing the
18.5.1 Opening a window from a secondary // "chat" window
thread Error("Unable to manage"+…
To open a window from a secondary thread: " the chat opening window",…
ErrorInfo())
1. When the secondary thread wants to open a window, it
// The application cannot
sends a message to the main thread with PostMessage.
// work without this event
This message indicates to the main thread the window
EndProgram()
that must be opened as well as the parameters required END
to open the window. // Listen for connection requests
2. The main thread manages a specific event, correspon- // and presence tests
ding to the window opening request. When this event ThreadExecute("ThreadPresence",…
occurs, the WLanguage procedure opens the specified threadNormal,…
window (with Open for instance) with the specified para- "ListenPresenceRequest")
meters. ThreadExecute("ThreadRequest",…
threadNormal,…
18.5.2 Example "ListenConnectionRequest")
The above-mentioned method is used in the example The window is opened in the code of the ListenRequestS-
named WD Instant Messaging. tartMessage procedure. This procedure is run in a
The code for opening the main window is used to: thread. The code used to open the window from the
Tome1_2.book Page 478 Vendredi, 28. mai 2010 5:50 17
478
ThreadSendSignal The current "thread" sends a signal to the specified "thread" to unlock it
ThreadState Returns the current status of a thread
ThreadExecute Starts the execution of a secondary "thread". This "thread" is a non-locking thread
ThreadMode Changes the management mode of the threads
ThreadPause Pauses the current thread during the specified duration
ThreadPriority Returns or modifies the priority level of a thread
ThreadResume Resumes the execution of a thread previously interrupted by ThreadSuspend
ThreadSuspend Temporarily suspends the execution of the specified "thread". The current processes is not
locked
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 479 Vendredi, 28. mai 2010 5:50 17
479
19. SOAP
19.1 Overview
"SOAP" (Simple Object Access Protocol) is a communi- Furthermore, the use of the HTTP protocol (for data trans-
cation protocol used to run procedures on a remote ser- fer) allows the SOAP protocol to go through firewalls
ver. without any problem.
This protocol is mainly based on the HTTP and XML proto-
cols. It can also be used with the SMTP protocol. 19.1.1 WinDev/WebDev and the SOAP protocol
The data is transmitted between the local computer and WinDev and WebDev let you create a SOAP client appli-
the SOAP server as text in XML format (Extensible Markup cation. This application uses the SOAP functions of
Language). WLanguage to make the SOAP server run procedures and
to retrieve their result.
Benefits of the SOAP protocol Furthermore, WinDev lets you create a SOAP server
The main benefit of the SOAP protocol is that it is based application. This application is made of procedures that
on two standard protocols: will be started by the client application.
•XML for the structure of the messages,
•HTTP for data transport. 19.1.2 Example
For this reason, the SOAP protocol is independent from WinDev is supplied with an example that uses the SOAP
the operating systems and from the programming lan- functions: WD Use SOAP.
guages. The SOAP protocol promotes interoperability.
Part 7: Communication
machine.
19.2.1 Principle 3. Check the result of the procedure.
All the parameters required to run a SOAP procedure are The result of SOAPRun or SOAPRunXML is used to find
supplied in the documentation of the SOAP server. out whether the connection was successfully esta-
To run a procedure on a SOAP server: blished.
1. Initialize the structure of the parameters of the If the connection was not established, ErrorInfo returns
procedure to run (see "structure of a SOAP proce- the error details.
dure"). If the connection was established, check the result of
Note (WinDev only): to perform additional checks on SOAPGetResult:
the SOAP server, add a procedure header ( SOA- •If the result is not an empty string (""), the proce-
PAddHeader). dure was successfully run.
2. Run the procedure (SOAPExecute or SOAPRun-
XML). The following operations are automatically •If the result is an empty string (""), the procedure
performed: was not run and/or an error was returned. To find out
the error details, use SOAPError.
•connect the current computer and the SOAP ser-
ver, Note: currently the transfers are not secured (no encryp-
tion of the transfered data). The SOAP protocol should
•transmit the procedure parameters to the SOAP not be used to transfer sensitive data.
server,
Tome1_2.book Page 480 Vendredi, 28. mai 2010 5:50 17
480
This structure must be used for each parameter. For This structure is equivalent to:
example: SOAP.XMLParam[1] = <ZipCode
SOAP.Value[1] = 94010 xsi:type="xsd:string">94010</ZipCode>
SOAP.Name[1] = "ZipCode"
SOAP.Type[1] = SOAPStringType
19.3.1 Principle
Part 7: Communication
Tome1_2.book Page 481 Vendredi, 28. mai 2010 5:50 17
481
19.3.2 How do I create a SOAP server applica- 5. Configure the SOAP administrator. See "Configu-
tion? ring the administrator" for more details.
To create a SOAP server application: 6. In order for the SOAP client to be able to contact
1. Create a WinDev project. the server, the server address used in the SoapRun
2. Create the global procedures. Each global proce- function must have the following format:
dure can be run by the SOAP client. Caution: the ser- <IP Address of Server>\Server.soap
ver application should not have any interface (no Note: if several soap server applications are installed on
windows, no reports, no trace windows or dialog the same computer, you must install:
boxes). This application is also limited by the rights
defined for the Web server. •all the libraries (WDL) in the same directory,
3. Enter (if necessary) the initialization code and the •all the WinDev DLLs used in the same directory.
closing code of the project. These two sections of
A single SOAP administrator will be installed and used.
code will be respectively run when loading and
unloading the library on the server. 19.3.3 Installing a SOAP server with Apache
4. Create the library of your project (.WDL file). This
file contains all the procedures of the project. To install the SOAP server for Apache, the Apache server
1.3.x must be installed on the computer:
Note: in the SOAP client application, to specify the name 1. Open the "httpd.conf" file in the Windows note-
of the library used (WDL), simply specify this name in the pad. This file is found in the conf sub-directory of the
NameSpace (SoapRun function). Apache setup. If you have chosen the default setup
Caution: Currently transfers are not secure (no encryption directory, this directory corresponds to: C:\Program
of the transfered data). The SOAP protocol should not be Files\Apache Group\Apache\conf.
used to transfer sensitive data. 2. Find the section regarding the support of shared
To run the test of your SOAP server application on the objects. To do so, find:
development computer: •the following line: " # Dynamic Shared Object
1. Create the library (.WDL file) of your server appli- (DSO) Support "
cation ("Project .. Create library"). •the "LoadModule" keyword.
2. Configure the Internet server installed on your 3. Add the line:
computer for your WinDev application (configuration •For tests from your machine:
for Apache, IIS5 or Netscape iPlanet 4.1). LoadModule windev_module <Setup
3. Configure the SOAP administrator (WDSOAPCon- directory of Win-
fig.EXE application in "Data" directory of WinDev). Dev>\Data\WD150sapa.dll
See "Configuring the administrator" for more
Part 7: Communication
details. •To install the final SOAP server:
4. Restart your Web server. LoadModule windev_module <Setup direc-
5. Run the test of your SOAP client application. tory of WD150SAPA.DLL>\WD150sapa.dll
Note: if the specified directory contains spaces, you need
To install your application on a SOAP server: to surround this path with quote signs ("Path with spa-
1. Create the library (.WDL file) of your server appli- ces").
cation ("Project .. Create library"). 4. Find the section regarding the "handlers" of
Caution: WinDev DLLs should not be renamed.
requests. To do so, find:
2. Create the setup procedure of your application
("Workshop .. Create the setup procedure"). The fol- •the line " # AddHandler allows you to map certain
lowing files must be selected for setup: file extensions to "handlers",
•WDSOAPConfig.EXE found in the "Data" directory •the " AddHandler " keyword.
of WinDev setup directory. 5. Add the line:
•the WinDev DLLs required to run your application. AddHandler windev-module .soap
Check that the following DLLs are selected: 6. The server is now installed.
WD150IMG.DLL, WD150OBJ.DLL, WD150STD.DLL
and WD150VM.DLL. 19.3.4 Installing a SOAP server with IIS
•the WinDev DLLs specific to the HTTP server used: To install the SOAP server with IIS 5.1 in Windows 2000
WD150SAPA.DLLfor Apache, WD150SIIS for IIS, (the IIS server must be installed on the computer):
etc. 1. In the control panel, select "Administration
3. Install the application on the server. Tools" and "Manager of Internet Services".
4. Configure the Internet server for your WinDev 2. In the list on the left, choose the server to which
application (configuration for Apache, IIS5 or Nets- SOAP support must be added.
cape iPlanet 4.1).
Tome1_2.book Page 482 Vendredi, 28. mai 2010 5:50 17
482
3. In the panel on the right, choose a Web site 6. Find the next line that starts with "Service". Add
("Default Web site" for example). the next line before this line:
4. Display the popup menu and choose "Proper- Service method=(POST) type=applica-
ties", "Home Directory" tab. tion/soap fn=WinDevHandler
5. Click "Configuration" and "Add". 7. Save your file and restart the server.
6. Click "Executable" and choose WD150SIIS.DLL. Note: the WD150sns.dll DLL is not NSAPI compatible.
•To run tests from your computer, this file is found in
the "Data" subdirectory of the WinDev setup 19.3.6 Configuring the SOAP administrator
directory. Configuring the SOAP administrator:
•To install the final SOAP server, this file is found in 1. Start the SOAP administrator (WDSOAPCon-
the setup directory of your application. fig.EXE). This administrator is found in the setup
•In the extension control, specify ".soap". Validate. directory of your application (or in a specific direc-
7. Your SOAP server is installed! tory if it is already installed).
2. Configure the different elements:
19.3.5 Installing a SOAP server with Netscape • Time before unloading an unused WDL: if several
iPlanet 4.1 libraries (WDL file) corresponding with SOAP server
To install a SOAP server with Netscape iPlanet 4.1 (Nets- applications are found on the computer, this
cape iPlanet 4.1 must be installed on the computer): option lets you configure the maximum amount of
1. To find the configuration file: time the application waits before clearing an
•select the installation directory of iPlanet (C:\Nets- unused library from memory. During the deletion,
cape\Server4 by default). the end of project code will be executed.
•select the sub-directory corresponding to the ser- • Maximum number of WDL in memory: if several
ver to configure. The name of the server corres- libraries (WDL file) corresponding to SOAP server
ponds to https-<user name>. applications are found on the computer, this
option lets you configure the number of WDLs loa-
•select the config sub-directory.
2. Open the "mime.types" file with WordPad. CAU- ded in memory at the same time. When this num-
TION: if you open this file with Notepad.exe, the file’s ber is reached, the less recent library is
format may get corrupted when saving. Do not open automatically closed. The end of project code will
be run during the closing.
it with Notepad.
3. Add the following line at the end of the file and •Keep a log file (.LOG): this option lets you save the
save (when saving wordpad signals that the layout operations performed on the SOAP server into a
Part 7: Communication
will be lost, answer yes. text file. The date and time are specified for each
type=application/soap exts=soap operation. This file can contain the following mes-
4. Open the obj.conf file. sages for instance:
5. Insert before this line: <Object name=default> Loading the WDL X
•the following lines for running tests from your com- Incoming request: call the X function
puter: of the Y WDL
Init fn=load-modules shlib="<Setup The call to the X function failed
Directory of WinDev>/Data/ The call to the X function was suc-
WD150sns.dll" \’ cessful
funcs="WinDevHandler,ModuleExit,Modu- Limit of WDL size in memory reached
leInit" Unloading WDL X
Init fn="ModuleInit" • Log File: Server directory where the log file must
•the following lines to install the final SOAP server: be created.
Init fn=load-modules shlib="<DLL •Location of the WDLs: server directory where the
Location>/WD150sns.dll" \’ libraries of the SOAP server applications are found.
funcs="WinDevHandler,ModuleExit,Modu- Note: if the directory does not exist, the WDLs will
leInit" be sought in the C:\modulessoap directory.
Init fn="ModuleInit" •Location of the WinDev DLLs: Server directory
Caution: the path use the format "d:/my directory/my where are found the WinDev DLLs used by the
file.dll". Use quotes and / characters (no \ character). SOAP server applications.
Note: if the directory does not exist, the DLLs are
sought in the C:\modulessoap directory.
Tome1_2.book Page 483 Vendredi, 28. mai 2010 5:50 17
483
Part 7: Communication
Tome1_2.book Page 484 Vendredi, 28. mai 2010 5:50 17
484
The following structure is used to pass parameters to a procedure executed on a .Net XML Web services server:
Variable Type Detail
DotNet.NameSpace Optional character string "NameSpace" of the parameter
DotNet.Name Character string Parameter name
DotNet.XMLParam Optional character string Parameter structures expressed in XML format. The other para-
meters (Value, Name, Type, NameSpace and EncodingStyle) are
ignored if this parameter is specified.
DotNet.EncodingStyle Optional character string Encoding style ("EncodingStyle") of the parameter
DotNet.Type Constant Parameter type
DotNet.Value Any type Parameter value
This structure must be used for each parameter. For This structure is equivalent to:
example: DotNet.XMLParam[1] = <ZipCode
DotNet.Value[1] = 94010 xsi:type="xsd:string">94010</ZipCode>
DotNet.Name[1] = "ZipCode"
DotNet.Type[1] = DotNetStringType
Tome1_2.book Page 485 Vendredi, 28. mai 2010 5:50 17
485
Part 7: Communication
Tome1_2.book Page 486 Vendredi, 28. mai 2010 5:50 17
486
This structure must be used for each parameter. For This structure is equivalent to:
example: J2EE.XMLParam[1] = <ZipCode
J2EE.Value[1] = 94010 xsi:type="xsd:string">94010</ZipCode>
J2EE.Name[1] = "ZipCode"
J2EE.Type[1] = J2EEStringType
Tome1_2.book Page 487 Vendredi, 28. mai 2010 5:50 17
487
Part 7: Communication
Tome1_2.book Page 488 Vendredi, 28. mai 2010 5:50 17
488
vice. These specific features are used to define the Therefore, if an XML Web service returns a structure, this
WLanguage functions that will be used in the genera- result will be processed in the procedure as a character
ted class (SOAP functions, .Net functions or J2EE string in XML format. You will then have to process this
functions). character string (in WLanguage) in order to extract the
Note: if you do not know the details of the XML Web requested information.
service, select the SOAP functions.
4. Select the name and file of the WinDev/WebDev 22.1.3 Distributing a WinDev application or a
class to generate (".WDC" file) and validate. The WebDev site that uses an XML Web service
corresponding class is automatically generated and To distribute an application or a site that uses an XML
associated with the current project. Web service, simply include the set of procedures of the
XML Web service in the application’s library.
22.1.2 Using the set of procedures of the XML
Web service In order for the application or the site to be able to run the
XML Web service, the end-user computers must have a
To use the set of procedures of the XML Web service, all permanent access to the Internet.
you have to do is call a procedure. For example:
Note: before distributing an application or a site that
// The "MyProc" procedure returns
uses an XML Web service, we recommend that you check
// information according to the passed
the user license and the re-distribution rights of this ser-
// parameter
vice (case of pay services).
// Display this information inside
// a dialog box
Info(MyProc(7))
Tome1_2.book Page 489 Vendredi, 28. mai 2010 5:50 17
489
Part 7: Communication
lowing files must be selected for setup:
rights defined for the WinDev SOAP server. •WDSOAPConfig.EXE found in the "Data" directory of
3. Enter (if necessary) the initialization code and the WinDev setup directory.
closing code of the project. These two sections of
code will be respectively run when loading and •the WinDev DLLs required to run your application.
unloading the library on the WinDev SOAP server. Check whether the following DLLs are selected:
WD150IMG.DLL, WD150OBJ.DLL, WD150STD.DLL,
4. Select "Workshop .. XML Web service .. Generate
and WD150VM.DLL.
the service from this project". The wizard for genera-
ting the XML Web service starts. •the WinDev DLLs specific to the HTTP server used:
5. Enter the name of the .XML file to create. By WD150SAPA.DLL for Apache, WD150SIIS for IIS, ….
default, the name of this file is "<Project 2. Install the application on the WinDev SOAP ser-
Name>.XML". ver.
6. Enter the Internet address where the XML Web 3. Configure the Internet server for your WinDev
service will be installed. application (configuration for Apache, IIS5 or Nets-
For example: "http://Server/MyService.soap". cape iPlanet 4.1).
7. The next screen allows you to select the elements 4. Configure the SOAP administrator.
that will be included in the library. The library and the 5. In order for the SOAP client to be able to contact
current project will have the same name. You can: the server, the server address used in the SoapRun
•Add elements: function must have the following format:
<Name or IP Address of Server>\Service.soap
Any type of file can be added to the list of elements
inserted into the library: images, text files, …
Tome1_2.book Page 490 Vendredi, 28. mai 2010 5:50 17
490
Note: if several XML Web services are installed on the "documentroot" keyword.
same computer, you must install: 7. Copy the XML file containing the description of the
• all the libraries (WDL) in the same directory. XML Web service in the specified directory after the
• all the WinDev DLLs used in the same directory. "documentroot" keyword.
To access this XML file, use the following command
A single SOAP administrator will be installed and used. line:
Caution: the rights defined by the user of the http site are "http://<Name or IP Address of SOAP Server>/
very important. If a WinDev SOAP server must write into a <Name of XML File>.XML"
file, read/write rights must be granted to the user of the Note: you can also copy this .XML file into another direc-
site (Internet guest). tory. See the documentation about the HTTP server used
for more details.
22.2.2 Installing a SOAP server with Apache 8. The XML Web Service has been installed on the
To install the SOAP server for Apache, the Apache server SOAP server.
1.3.x must be installed on the computer:
1. Open the "httpd.conf" file in the Windows note- 22.2.3 Installing a SOAP server with IIS
pad. This file is found in the conf sub-directory of the To install the SOAP server with IIS 5.1 in Windows 2000
Apache setup. If you have chosen the default setup (the IIS server must be installed on the computer):
directory, this directory corresponds to: C:\Program 1. In the control panel, select "Administration
Files\Apache Group\Apache\conf. Tools" and "Manager of Internet Services".
2. Find the section regarding the support of shared 2. In the list on the left, choose the server to which
objects. To do so, find: SOAP support must be added.
•the following line: " # Dynamic Shared Object 3. In the panel on the right, choose a Web site
(DSO) Support " ("Default Web site" for example).
•the "LoadModule" keyword. 4. Display the popup menu and choose "Proper-
3. Add the line: ties", "Home Directory" tab.
5. Click "Configuration" and "Add".
•For tests from your machine: 6. Click "Executable" and choose WD150SIIS.DLL.
LoadModule windev_module <Setup
•To run tests from your computer, this file is found in
directory of Win-
the "Data" subdirectory of the WinDev setup
Dev>\Data\WD150sapa.dll
directory.
•To install the final SOAP server: •To install the final SOAP server, this file is found in
LoadModule windev_module <Setup the setup directory of your application.
Part 7: Communication
directory of
•In the extension control, specify ".soap". Validate.
WD150SAPA.DLL>\WD150sapa.dll
7. Copy the XML file containing the description of the
Note: if the specified directory contains spaces, you need XML Web service in the directory specified in the
to surround this path with quote signs ("Path with spa- "Access path" option.
ces"). To access this XML file, use the following command
4. Find the section regarding the "handlers" of line:
requests. To do so, find: "http://<Name or IP Address of SOAP Server>/
•the line " # AddHandler allows you to map certain <Name of XML File>.XML"
file extensions to "handlers", Note: you can also copy this .XML file into another direc-
•the " AddHandler " keyword. tory. See the documentation about the HTTP server used
5. Add the line: for more details.
AddHandler windev-module .soap 8. The XML Web Service has been installed on the
6. In the "httpd.conf" file, find the section regarding SOAP server.
the default directory of the files. To do so, find the
Tome1_2.book Page 491 Vendredi, 28. mai 2010 5:50 17
491
22.2.4 Installing a SOAP server with Netscape To access this XML file, use the following command line:
iPlanet 4.1 "http://<Name or IP Address of SOAP Server>/
<Name of XML File>.XML"
To install a SOAP server with Netscape iPlanet 4.1 (Nets-
cape iPlanet 4.1 must be installed on the computer): Note: this .XML file can also be copied into another direc-
1. To find the configuration files: tory. See the documentation about the HTTP server used
•select the installation directory of iPlanet (C:\Nets- for more details.
cape\Server4 by default). 9. Restart your server. The XML Web Service has
been installed on the SOAP server.
•select the sub-directory corresponding to the ser-
ver to configure. The name of the server corres- Note: the WD150sns.dll DLL is not NSAPI compatible.
ponds to https-<user name>.
22.2.5 Configuring the SOAP administrator
•select the config sub-directory.
2. Open the "mime.types" file with WordPad. CAU- Configuring the SOAP administrator:
TION: if you open this file with Notepad.exe, the file’s 1. Start the SOAP administrator (WDSOAPCon-
format may get corrupted when saving. Do not open fig.EXE). This administrator is found in the setup
it with Notepad. directory of your application (or in a specific direc-
3. Add the following line at the end of the file and tory if it is already installed).
save (when saving wordpad signals that the layout 2. Configure the different elements:
will be lost, answer yes. •TTime before unloading an unused WDL: if several
type=application/soap exts=soap libraries (WDL files) corresponding with SOAP ser-
4. Open the obj.conf file. ver applications are found on the computer, this
5. Insert before this line: <Object name=default> option lets you configure the maximum amount of
time the application waits before clearing an
•the following lines for running tests from your com-
unused library from memory. During the deletion,
puter:
the end of project code will be executed.
Init fn=load-modules shlib="<Setup
Directory of WinDev>/Data/
• Maximum number of WDL in memory: if several
WD150sns.dll" \’
libraries (WDL file) corresponding to SOAP server
applications are found on the computer, this
funcs="WinDevHandler,ModuleExit,Modu-
option lets you configure the number of WDLs loa-
leInit"
ded in memory at the same time. When this num-
Init fn="ModuleInit"
ber is reached, the less recent library is
•the following lines to install the final SOAP server: automatically closed. The end of project code will
Init fn=load-modules shlib="<DLL be run during the closing.
Part 7: Communication
Location>/WD150sns.dll" \’ •Keep a log file (.LOG): this option lets you save the
funcs="WinDevHandler,ModuleExit,Modu- operations performed on the SOAP server into a
leInit" text file. The date and time are specified for each
Init fn="ModuleInit" operation.
Caution: the path use the format "d:/my directory/my • Log File: Server directory where the log file must
file.dll". Use quotes and / characters. be created.
6. Find the next line that starts with "Service". Add •Location of the WDLs: server directory where the
the next line before this line: libraries of the SOAP server applications are found.
Service method=(POST) type=applica- Note: if the directory does not exist, the WDLs will
tion/soap fn=WinDevHandler be sought in the C:\modulessoap directory.
7. Open the webpub.conf file and find the "NS-doc- •Location of the WinDev DLLs: Server directory
root" keyword.
where are found the WinDev DLLs used by the
8. Copy the XML file containing the description of the
SOAP server applications.
XML Web service in the specified directory after the "
Note: if the directory does not exist, the DLLs are
NS-doc-root" keyword. sought in the C:\modulessoap directory.
Tome1_2.book Page 492 Vendredi, 28. mai 2010 5:50 17
492
23. XML
23.1 Managing XML documents
23.1.1 Overview • the content of an XML file.
WinDev proposes several functions used to work with • an answer from an XML Web service.
XML code. The XML code used must comply with the XML The WinDev XML functions enable you to:
standard. See a documentation specific to XML for more
details. • read, find and analyze the content of an XML file.
• Analyze the answers received from XML Web services.
Reminder: XML is both a standard and a language deri-
• Import data (HImportXML).
ved from HTML (Web pages, Internet, …), which allows to
structure a document that contains data. 23.1.3 Principle
XML code is used for example:
To work with XML code:
• in information systems (Intranet, and so on). 1. Store the XML code in a string variable. This code
• in dialog with Web services. See ’XML Web services’, can come from an XML file or from an XML Web ser-
page 508, for more details. vice.
2. Create an XML document (XMLDocument). This
23.1.2 Definition document is stored in memory and contains the
XML is a language containing tags and attributes (called entire XML code to use.
"elements" in this help). 3. Handle your XML document with the WLanguage
The structure of the XML code corresponds to a tree functions. You can:
structure: information is organized in a treelike way. •Read XML code (XMLFirst, XMLNext, XMLLast,
The following terms are used to describe the different XMLPrevious, XMLParent, XMLChild, XMLRoot).
parts of an XML code: •Perform searches (XMLFind, XMLCancelSearch,
XMLExtractString).
Opening tab •Retrieve information on the elements (tags or attri-
Data or "Value" XML code found in butes) found in the document. (XMLElementType,
Attribute a tag
XMLElementName, XMLParentName, XMLData).
Part 7: Communication
493
XMLLast Points to the last element of the current tree level or the last tag of the tree
XMLDocument Creates or defines a new XML document
XMLData Returns the value of the current element or of a tag
XMLWrite Writes the value of an XML element or the value of an XML element’s attribute
XMLOut Enables you to find out whether the current position is valid or if the tag you want to
point to is outside the file
XMLExecuteXPath Runs an XPATH query in an XML document
XMLExtractString Extracts data from an XML code
XMLExtractDocument Creates a new XML document from an existing XML document
XMLChild Points to the first child element of the current element or the first child tag of the current
tag
XMLChildExist Indicates whether the current tag contains child elements corresponding to the sought
type (tag, attribute)
XMLInsertDocument Inserts an XML document into another XML document
XMLInsertElement Inserts an XML element (tag or attribute) into an XML document
XMLRead Returns the value of an XML element or the value of the attribute of an XML element.
XMLModify Modifies the content of the current element found in the XML document
XMLNamespace Returns the prefix of the namespace linked to the current tag in an XML document
XMLNamespaceURI Returns the URI of the namespace linked to the current tag in an XML document
XMLElementName Returns the name of the current element or tag
XMLParentName Returns the name of the parent element of the current element or of the parent tag of
the current tag
XMLParent Points to the parent element of the current element or the parent tag of the current tag
XMLPath Returns the current position in the document in XPATH format
XMLPrevious Points to the previous element in the current tree level or to the previous tag
XMLFirst Points to the first element of the current tree level or the first tag found
XMLRoot Points to the root tag of the XML document
XMLFind Performs a search in an XML document
XMLRename Renames the current element (tag or attribute) in an XML document
Part 7: Communication
XMLResult Returns the result of an XPATH calculation query. This query was run by XMLExecutePath
XMLRestorePosition Restores the context of an XML document (previously saved by XMLSavePosition). The
filter used when saving the position can be restored.
XMLSavePosition Stores the current position in an XML document. This enables you to temporarily sus-
pend the current process so that the XML document can be used somewhere else (to
perform checks for instance)
XMLNext Points to the next element in the current tree level or to the next tag in the same level
XMLDelete Deletes the next element in the current tree level
XMLClose Closes an XML document created by XMLDocument
XMLFound Enables you to find out whether an element was found during the browse
XMLElementType Returns the type of the current element or the type of the value for the current tag
XMLToText Converts a character string in XML format into a character string in ANSI format
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 494 Vendredi, 28. mai 2010 5:50 17
494
495
Part 7: Communication
origin.
4. Select the WinDev classes (".WDC" files) that
• specify the ".SNK" file to use. This file contains the
must be made accessible. encryption keys used for authenticating the .NET
These classes can be handled from the application assembly.
that will use the .NET assembly.
5. Configure the error message if necessary. • specify whether the delayed signature mechanism
This message will be displayed if an error occurs should be used. This mechanism allows you to not
when using the .NET assembly. authenticate the .NET assembly during its develop-
The "Default" button enables you to configure a ment.
default error message.
Tome1_2.book Page 496 Vendredi, 28. mai 2010 5:50 17
496
PART 8
Managing
data files
Tome1_2.book Page 498 Vendredi, 28. mai 2010 5:50 17
Tome1_2.book Page 499 Vendredi, 28. mai 2010 5:50 17
499
1. FILE MANAGEMENT
WinDev, WinDev Mobile and WebDev enable you to easier, we recommend that you only read the chapters
manage files in "WinDev/WebDev" format, in xBase for- that are relevant to you. You can always go back and read
mat and in any database accessible by an OLE DB driver. the other chapters when you want to use another feature.
Files in "WinDev/WebDev" format are called "HyperFi- Sometimes we refer to programming functions. These
leSQL" files. functions are detailed in the online help.
This chapter presents concepts for managing files in for-
mat recognized by WinDev/WebDev. WB The HyperFileSQL functions can be
To make reading and understanding these concepts used only in server code.
500
501
502
tant because it determines the sort order. For exam- Simply specify the affected file, the key name and the
ple, the "Name + State" composite key will be component values in HBuildKeyValue.
sorted first by name then by state. Example: to build the name of the composite key
5. Specify the search direction and the search para- "NAMEDATE" corresponding to "CUSTOMER-
meters for each key component. NAME+DATE_ENTERED" of the Customer file, simply use
6. Validate. The composite key is displayed in the list the following line of code:
of file items. HBuildKeyValue(Customer, NAMEDATE, …
Composite key and link "SMITH","03/11/85")
Composite keys can be used in file links. When descri- Using an array of values
bing the analysis, the composite key found in the linked Just specify the values of the composite key directly in the
file appears not as a composite key but as a binary key search or in the filter.
them. You will not be able to access the different compo- Example: to build a filter on the "Customer" file, using a
nents of the composite key in the linked file. composite key made of the name and date, simply write:
Note: the referential integrity is managed on a composite HFillter(Customer,DATENAME, …
key type link key. ("SMITH","03/11/85"))
Value of a composite key Other solution to build the value of a composite key
A composite key is stored as a binary file. Its value cannot (compatibility WinDev 5.5/WebDev 1.5)
be displayed (neither in a control nor in the debugger, …). To build the value of a composite key without using
HBuildKeyValue, you must:
Adding a record containing a composite key • Entirely fill the text components up to their size using
When adding or modifying a record containing a compo- the hMinVal constant.
site key, the value of the composite key is automatically • Convert the numeric components with HConvert.
defined according to the values of the different key com-
Tome1_2.book Page 503 Vendredi, 28. mai 2010 5:50 17
503
504
505
506
index points to is the last record loaded in memory, then • browse through the file according to the specified
HOut returns True. selection condition. The file’s search key is returned
When browsing through a file, you need to test the HOut by the HFilter function according to the specified con-
function after running one of the functions mentioned dition.
above. The selection of the records according to the filter is
managed automatically then.
3. Changing search key The filter (mini and maxi bounds or selection condition) is
The search key can be modified with HChangeKey. In this described with HFilter .
case, the current record is kept, even though the search The filter is automatically activated. It can be enabled/
key has been changed. disabled by programming using HActivateFilter and
HChangeKey can be used to find a record after pointing HDeactivateFilter.
to a record through direct access by using HRead. Filter and composite key
For instance, the line: Two methods can be used to create a filter on a compo-
HChangeKey(CUSTOMER,CUNAME) site key:
• Using advanced filter functions (HFilterStartsWith,
HFilterIncludedBetween, HFilterIdentical). Simply
specify for each component of the composite key the
value to take into account for the filter.
This method is recommended.
See the documentation for these functions for more
details.
• Using HFilter combined with HBuildKeyValue. This
method is presented in the paragraphs below.
Tome1_2.book Page 507 Vendredi, 28. mai 2010 5:50 17
507
508
1.1.7 Schemas: the form mode and the table 1.1.8 Moving and positioning inside a file
mode WLanguage offers 3 functions to point or move quickly
inside a file without actually reading the file.
HSetPosition Points inside a file according to a key
or returns the position of the current
record relative to a key in respect to
the total number of records
HForward Lets you move forward several records
at a time from the current position
according to a given key
HBackward Lets you move backward several
records at a time from the current
Managing a file in form to form mode position according to a given key
Example
// points to 50% of CUSTOMER on
// the CUNAME key from the last one
RecMax is int
RecMax = HNbRec()
HLast(CUSTOMER,CUNAME)
HBackward(CUSTOMER,CUNAME,RecMax/2)
IF HOut() THEN
Error("Pointing outside")
ELSE
Info("Position: rec="+…
hRecNum()+" Customer = "+…
CUSTOMER.CUSTNAME)
Managing a file in table mode
END
Part 8: File management
509
2. Specify whether the data must be kept in current • Management of an automatic identifier
format (option required to use the Native xBase/Fox- • Managing expressions in HFilter
Pro Access). • Ability to use HChangeDir
3. Select the access mode to the files (Native xBase
Access for WinDev) and specify the directory of data • Limitation: no creation or reindexing of a FoxPro file.
files. Dynamic description of an xBase file
4. Select the tables that will be imported into the An xBase file can be described by programming by the
WinDev analysis. These tables can be handled by
following functions:
programming with the Hyper File functions of Win-
Dev. These tables will be displayed in blue in the HDBCreation Ends the dynamic description of the
data model editor. file structure. The file that was just
Note: the FoxPro databases (.dbc extensions) are described is created on the disk in the
not supported. Each file (.dbf extension) must be path specified in HDBDescribeFile.
individually imported into the analysis. The data, memo and index files are
5. Validate. The tables are imported into the analy- created on the disk
sis. The xBase sub-type of the imported file can be HDBDescribe- Dynamically describes a file in dBase
found in the file description (dBase3+, dBase4, Fox- File 3 format (most common format). This
Pro/FoxBase, Clipper5, Clipper87). function is used to specify the name,
Notes: the abbreviation and the access path
of the xBase file.
• A Numeric item in FoxPro can be imported as a Cur-
rency item into WinDev or WebDev (if the size of the HDBDescri- Dynamically describes the different
items exceeds the size of a real for instance). beIndex index files that will be created. An
index file must be described for each
• The Logical items in xBase/FoxPro are imported as Text
search key. The created index file will
items. Indeed, for a boolean in xBase, you have the
ability to specify True and False with the strings ’T’ and be in dBase 3 format.
’F’. HDBDescribe- Dynamically describes each item of
Field the structure of an xBase file descri-
bed with HDBDescribeFile.
Taking into account the changes made
to the xBase files Example:
WinDev and WebDev enable you to take into account the // Describe an xBase file
changes made to the tables imported into the data // that contains the following items :
510
However, the available size on a Pocket PC being restric- databases contain the "Tasks", "Contacts" and
ted and the operating system of the Pocket PC being limi- "Calendar" data files, …
ted, the following features are not supported by • the other CEDB databases (called custom databases),
HyperFileSQL Mobile: that correspond to Access databases (".MDB" files)
• the transactions. previously exported from a PC.
• the log process. When an Access database (".MDB" file) is copied to a
• the HyperFileSQL logged replication. Pocket PC, this database is automatically changed into a
• the management of file locks and record locks. CEDB database (".CDB" file).
• the management of files in Hyper File 5.5 format. Handling a Pocket PC database (CEDB)
Handling a HyperFileSQL Mobile data- 1. Handling a Pocket PC database (CEDB) from the Poc-
base ket PC
Handling a HyperFileSQL Mobile database from the Poc- A Pocket PC database (called CEDB) corresponds to a
ket PC ".CDB" file. A Pocket PC database can contain several
A HyperFileSQL Mobile database corresponds to a set of data files (also called "tables").
".FIC", ".NDX" and ".MMO" files. This database can be handled by a WinDev Mobile appli-
Each data file can be handled by a WinDev Mobile appli- cation. These operations are performed via the cdbxxx
cation. These operations are performed via the HyperFi- functions.
leSQL functions. 2. Handling a Pocket PC database (CEDB) from the PC
Note: the computer’s sleep mode may have unintended If you own WinDev, you also have the ability to create a
effects on your data files. We recommend that you close WinDev application used to directly handle the Pocket PC
the data files (HClose) when the computer might go into database. These operations are also performed via the
sleep mode. cdbXXX functions.
Tome1_2.book Page 511 Vendredi, 28. mai 2010 5:50 17
511
Note: To handle a Pocket PC database from a standard These operations are performed via the cdbxxx func-
WinDev application, the PC must be connected to the tions.
Pocket PC (ceConnect). The synchronization between the database of Pocket PC
and the data viewed via Outlook is performed by Active-
3. Synchronizing a Pocket PC database (CEDB) with an Sync.
Access database
Note: to handle a Pocket PC database from a standard
An Access database (".MDB" file) is found on the PC. WinDev application, you need to connect the PC to the
This database is exported to the Pocket PC: ActiveSync Pocket PC (with ceConnect).
automatically transforms it into a Pocket PC database
(".CDB" file). The format of the "CDB" files is not compatible with Win-
dows CE 3.0 and Windows CE 4.X. Therefore, the same
This Pocket PC database can be handled by a WinDev ".CDB" files cannot be used on Pocket PCs not equipped
Mobile application. with the same operating system.
If you own WinDev, you also have the ability to create a
WinDev application used to handle the Pocket PC data- Structure of the standard databases
base. The structure of the standard databases is a preset struc-
These operations are performed via the cdbxxx func- ture of WLanguage (no declaration is required).
tions. This structure enables you to:
The synchronization between the database of Pocket PC • create a record,
and the Access database is performed by ActiveSync. • modify a record,
Notes : • retrieve the content of a record.
• To handle a Pocket PC database from a standard Win- cdbReset enables you to reset all the variables of a struc-
Dev application, a connection must be established ture.
between the PC and the Pocket PC (ceConnect).
Note: the variables of the standard database structure
• The standard WinDev application can also handle the vary according to the database used - Contacts, Calen-
Access database via the native Access access. dar and Tasks. See the online help for more details.
Handling a standard Pocket PC data-
base
A standard database (containing the data files for mana-
ging tasks, contacts, and so on) is found on the Pocket
512
cdbReadFirst Points to the first record of a file and reads this record
cdbReadSeek Points to the first file record whose value for a specific column is equal to a sought value
cdbReadNext Positions on the next record in a file and reads this record
cdbModify Modifies the specified record or the record found in memory in the data file
cdbNbCol Returns the number of columns found in the record in memory
cdbNbRec Returns the number of records found in a data file
cdbRecNum Returns the number of the current record in the data file
cdbOpen Opens a database (".CDB" file) on the pocket PC connected to the current computer
cdbReset Resets all the variables found in one of the structures of the standard databases
cdbDelete Deletes the current record or the specified record from the data file
cdbFound Checks whether the current record corresponds to the current search
Part 8: File management
Tome1_2.book Page 513 Vendredi, 28. mai 2010 5:50 17
513
2. ADVANCED FEATURES
This chapter presents the features for advanced data- • transaction management,
base management: • file log,
• alias management, • automatic modification of the files,
• NULL management in HyperFileSQL (WinDev only), • exchange and sharing of data among several pro-
• protection and data encryption, grams,
• referential integrity check, • temporary file,
• management of "memo" files, • retrieve a file’s structure,
• file reassignment, • use of an ODBC driver on HyperFileSQL Classic.
• full-text search and index,
The two files will be handled the same way with the
HyperFileSQL standard functions.
Tome1_2.book Page 514 Vendredi, 28. mai 2010 5:50 17
514
2.1.2 Several logical files linked to a single • Query created with the query editor
physical file • HyperFileSQL view (HyperFileSQL Classic format)
You can perform several parallel searches on the same • Alias
physical file, or a search and a filter in parallel on the file.
Example: The Customer.Fic file is associated to the Cus- 2.1.5 Characteristics of an alias
tomer logical file in the analysis. To filter the records of • Physical file associated with an alias:
the Customer.fic file and at the same time browse By default, the name specified for the alias is assigned
through all the records of this file, you must: to the physical file corresponding to the alias. To asso-
• "Copy" the description of the CUSTOMER file in the ciate the alias with a physical file of different name,
analysis: simply create an alias using HAlias. use HChangeName and HChangeDir.
• associate the alias description with the Customer.fic • Alias password:
physical file (HChangeName function). By default, the password of an alias file is identical to
the password of the initial file. This password can be
Note: this method allows you to manage several HyperFi- modified by HPass. The name of the file used in this
leSQL contexts for the same physical file. function corresponds to the name of the alias.
• Reindexing:
2.1.3 Functions for managing aliases The alias files can be reindexed.
Several functions are available for working with aliases: • Automatic modification of the data files:
HAlias Creates a logical alias of a file or can- This operation can be applied to alias files.
cels all the existing aliases
2.1.6 Handling the alias file and its items
HCancelAlias Cancels an alias previously declared • Code editor: to avoid the "Unknown identifier" error
by HAlias when using an alias file and its items, you need to
define a data source to declare the name of the alias
before using HAlias.
Other functions can intervene in the definition and use of For example:
aliases:
Order2000 is data …
HChangeName Modifies the physical name of a data source
file HAlias(Orders,Order2000)
Caution: it is possible to use the Extern keyword but it
Part 8: File management
515
•of the "Default to NULL" option available in the option selected. In this case, you can run the following
"General" tab of an item description. This option test before saving the data:
enables you to define the null value as the default ScreenToFile()
value for the item. IF Grade= NULL THEN
• In programming, two properties: Lesson.Grade..Null = True
END
Null Enables you to: //Add or modify
•define the NULL value as the //the record
default value for a file item during HAdd(Lesson)
its dynamic description. Caution: the "NULL if empty" option of edit controls has
•associate (or not) the NULL value no relation with the management of the NULL value in
with a file item. HyperFileSQL data files. See the online help for more
details about this option (keyword: "Null if empty").
NullSuppor- Enables you to:
ted •define the management mode of Note: If the default value of the item is NULL (option
the NULL value for a file during its selected in the editor), the HReset function resets the
dynamic description. Null property to True.
•find out the management mode of
the NULL value for a file Query: selection condition
In the query editor, you have the ability to take into
Limits: account or to ignore the records that have a null item. To
The NULL value cannot be used: do so, create a selection condition and choose "Is null"
•on the array items. or "Is not null".
•on the automatic identifiers. In a selection query that performs a calculation, all the
•on the composite keys. records that have a null value (for the calculation item)
will be ignored.
Caution: writing records by an application using a WinDev
version older than version 75205 may cause the Null
property to be inconsistent (will return True or False).
Example
Writing a record in an application using WinDev version
The following example is a query used to calculate the
516
517
2.4.3 Testing a key uniqueness queness when modifying a record in the file.
Whether the identifier is managed manually or automati- The check for key uniqueness was presented in details in
cally by WinDev/WebDev, you need to check the key uni- the previous chapter of this section.
The check of the referential integrity depends on the 2.5.3 The different types of links
nature of the link between the files. The different types of links available are presented in the
’Characteristics of the links defined in an analysis’ chap-
2.5.1 Benefit of the referential integrity check ter, page 73.
For example, when deleting a record from a file, you need
to check that the records in the linked file corresponding Reminder: links between files can be of several types:
to the deleted record have been deleted as well. • parallel,
• optional,
Let’s look at an order management made of the following
files, for example: • complement,
• "ORDERS" containing the order’s references. The • shared,
identifier is the order number. • complex.
• "PRODUCT" containing the product references. The
identifier corresponds to the product number.
2.5.4 Programming the referential integrity
518
Otherwise
Error(HErrorInfo())
End
End
End
Tome1_2.book Page 519 Vendredi, 28. mai 2010 5:50 17
519
520
2.6.2 Image, sound, OLE and other binary - assign it to the item using HLinkMemo.
memos • When an image control is modified by the drawing
There are 4 types of items: image, sound, OLE and other functions of WLanguage, to assign the image to an
binary memo. These types of memos let you store binary image binary memo item, you need to:
files (for example images, sounds, OLE files, etc.) in the - save the image using dSaveImage,
item. - assign it to the item using HLinkMemo.
The items can be handled in WLanguage to assign them • ScreenToFile/PageToFile does not automatically
or get their contents. assign the content of an image control with the image
The following functions are used to manage binary binary memo item that is associated with it. You have
memos: to assign the item with HLinkMemo.
• HLinkMemo to assign the item. • HLinkMemo provides information:
• HExtractMemo to get the item’s content and save it - about the file type,
into a file. - about the memo itself.
• HInfoMemo to get some information about the item.
WB The sound, binary memo and OLE
Note: Binary memo items can be managed by the fol- items exist for compatibility with Win-
lowing functions: Dev.
• Sound if the binary memo item is in WAV format (Win-
Dev only).
• iPrintImage if the binary memo item is in IMG format. Retrieval
• BitmapInfo if the binary memo item is in IMG format. A binary memo is retrieved with HExtractMemo. This
function saves the content of the binary memo into a
Initialization file.
A binary memo can contain any type of file. A binary Note: FileToScreen/FileToPage automatically assigns the
memo can be initialized: content of an image control with the content of the
• from another item of binary memo type (simple assign) binary memo item that is associated to it, if the item’s
ANIMAL.PHOTO=DOG.PHOTO content is in a known format (BMP, PCX, JPEG, TIFF, …).
• from a file via HLinkMemo Information about the memo
HLinkMemo(ANIMAL,... HInfoMemo lets you retrieve information about the
PHOTO,"DOG1.TIF",hMemoImg) binary memo item:
Part 8: File management
521
522
Functions for managing the .REP file 4. Writing into the file
1. Management of .REP To write into the .REP file, use the functions for managing
the external files:
HSetREP Enables or disables the management
of .REP file. When the management of fOpen Opens the file
the .REP file is enabled, you can spe- fWriteLine Writes a new line in the file
cify the name and path of the .REP file.
A HFREP.INI file will be created in the fClose Closes the file
Windows directory. The management
of ".REP" file is enabled by default. The structure of the added line must be as follows:
LOCALIZATION= File Tab Logical file Tab Path of
2. Creating and modifying the .REP file GUID name physical
file
HCreation Creates a physical data file (and adds
information to the .REP file if .REP is The GUID of the file corresponds to the identifier of the
enabled) logical file. This identifier can be found in the data model
editor, in the file description window ("Notes" tab).
HCreationIfNot- Creates a physical data file if it does
Found not exist (and adds information to the Structure of .REP file
.REP file if .REP management is ena- The first line contains information about the analysis
bled) where the files have been described. This analysis corres-
HOpen Opens a physical data file and adds ponds to the analysis of the current project.
fills the .REP file if necessary (opening The structure of this line is as follows:
a file that does not belong to the ana- ANALYSISGUID= Analysis GUID
lysis for instance)
The GUID of the analysis is the unique identifier of the
Note: The information provided by HChangeDir, HSubs- analysis linked to the project, containing the description
tDir, and HChangeName will be applied when creating of the files. This identifier can be found in the data model
the update of the ".REP" file. editor, in the analysis description ("Options" tab).
3. Reading the .REP file The following lines describe the different files used by the
application or by the site. A single line is created for each
Part 8: File management
HListREP Lists the different files found in the physical file used. This line contains the following infor-
.REP file as well as their physical path mation:
LOCALIZATION= File Tab Logical file Tab Path of
Note: if an application or a site uses several physical files GUID name physical
with the same logical name (usual case of a multi-com- file
pany accounting software or of some "archive" file), the
".REP" file will contain several lines for the same logical The GUID of the file corresponds to the identifier of the
file: each line will reference a physical file. logical file. This identifier can be found in the data model
editor, in the file description window ("Notes" tab).
Example of .REP file:
Tome1_2.book Page 523 Vendredi, 28. mai 2010 5:50 17
523
524
category,
QRY_SRCH.ContactID,… Two words separated by a Searches for one of the
QRY_SRCH.CategoryID, … space character words.
.IDConnectedUser, … Example: "WinDev Web-
QRY_SRCH.LName, QRY_SRCH.FName) Dev" find the texts that con-
END tain either "WinDev" or
CASE ERROR: "WebDev".
Error(HErrorInfo()) A word preceded by the "+" The specified word is man-
sign datory.
Example: "+WinDev" sear-
ches for the texts that
Note: Query with a parameter on a full-text index: how to necessarily contain "Win-
ignore the parameter? Dev".
The "MATCH" of the query must not be found in the result A word preceded by the "-" The specified word must not
of the query but in the WHERE. Indeed, if the pertinence sign be found in the text.
must be included in the result, the parameter must be Example: "-Index" find the
specified to evaluate the result. texts that do not contain the
"Index".
In order for a query created with the query editor to have
the MATCH included in the WHERE, the pertinence must A word preceded by the "~" If the text contains the spe-
not be displayed in the result. sign cified word, the relevance
will be reduced.
Tome1_2.book Page 525 Vendredi, 28. mai 2010 5:50 17
525
One or more words enclosed The specified words are •the ratio between the records that contain the sought
in quotes searched in group and in words and the records that do not contain the sought
order. words. Indeed, the more the sought word is found in
Caution: if the "Ignore word all the records, the less the relevance will be impor-
less than " is different from tant.
0, the words between
quotes whose size is less
•…
than the specified size will The result of a "full-text" query can then be processed as
not be sought. any other query result: you can for example display the
A word followed by the "*" The type of the search per- result in a table, sorted according to relevance, …
sign formed is "Starts with" the
specified word. 2.8.6 Managing the full-text indexes by pro-
gramming
2.8.5 Analyzing the result of a "full-text" query Several WLanguage functions are used to manage the
The result of a full-text query gives, for each record found full-text indexes:
in the data file, the relevance of the record in relation to
HDescribeFull- Describes a full-text index by pro-
the search value.
TextIndex gramming for a data file created by
This relevance depends on several factors: programming.
•the number of times the sought word is found in the HListFullTextIn- Returns the list of full-text indexes for
record. dex a file (a query or a view) recognized
•the number of words in the record and their number by the HyperFileSQL engine
of repetitions.
Notes:
•The creation of a full-text index in a data file created
by programming can be done via a FullText Index
526
2.9.2 Knowing how to use transactions accor- your code in order to run them in a transaction. The code
ding to your needs executed during the transaction should not display any
Here are some advices for optimizing transaction mana- windows or pages, read files, etc. This code must contain
gement: only the file modifications operations.
Each operation performed during the transaction is
• Performing transactions in applications installed on saved into a transaction file. The record used is locked in
reliable computers or on sites installed on reliable ser- write mode until the validation or cancellation of the tran-
ver computers: disk transaction saction.
In this case, transactions are only used in order to be
able to cancel a series of operations. It is possible to dis- 2.9.3 Principles
play windows or pages in the middle of a transaction, to Principle of transactions on HyperFileSQL files
perform various lengthy processes, …
Each operation performed during the transaction is Each write operation performed during a transaction is
saved into a transaction file. The record used is locked in stored in a transaction file. The transaction can be cance-
write mode until the validation or cancellation of the tran- led at any time: all the operations performed since the
saction. beginning of the transaction will be canceled.
• Performing trusted write operations in files (banking Once the write operations included in the transaction are
sector, accounting, …): disk transaction completed, the program can validate the operations of
the transaction.
Transactions insure the security of a set of operations. In
this case, you need to group all the write operations in
Tome1_2.book Page 527 Vendredi, 28. mai 2010 5:50 17
527
528
Note: to find out whether you need to restore the integrity rence.
of the database, test the result of HTransactionInterrup-
ted in the project initialization code (for instance). 2.9.6 Advanced management
Tip: restoring the database consistency Transactions: the created files
To restore the integrity of the database, the following Two types of HyperFileSQL data files are created when
operations are recommended: implementing transactions:
1. Check the result of HTransactionInterrupted in • The log of operations in transaction: temporary file in
the initialization code of the project for instance. HyperFileSQL format containing the different opera-
2. If the transaction was interrupted, perform one of tions performed on the application or site’s files taken
the following operations to restore the database into account by the transaction. This file is created by
integrity: HTransactionStart. By default, its name is <Project
•call strong>HTransactionCancel, Name>_$TRS_OPERATION. You can modify this name
with the strong>HTransactionStart function.
•call HTransactionStart/HTransactionEnd,
• The values log: temporary file associated with each
•Running WDTRANS. data file taken into account by the transaction.
Example: This file is named <File Name>_$$_TRSVAL.Fic. For
If HTransactionInterrupted() then
each operation performed in the transaction, this file
If Confirm("The transaction "+…
contains:
"performed by "+… •the content of the record after the operation (during
h.trsPost +… a deletion for instance),
" was interrupted. "+… •the content of the record after the operation (during
"Do you want to restore the "+... an addition for instance).
"coherence of the files?")
Then Identifier of the computer that performs
// Cancel the interrupted the transaction
// transactions By default, the computer is identified by a unique number
If HTransactionCancel()=False and by the name of the computer (defined in Windows).
then
To easily identify the computer that performs the opera-
Info("Unable to cancel "+\xac …
tions in transaction, the HPost function lets you define an
"the transaction")
identifier specific to the computer. This identifier replaces
Part 8: File management
End
the name of the computer. This identifier is saved in the
End
log of operations in transaction and it can be consulted
End
with WDTRANS.
Other solution: you can manage error 70034 in the pro- WB By default, the computer performing
ject initialization code by using the WHEN EXCEPTION the transaction corresponds to the
keyword. Therefore, when error 70034 occurs, the inte- Web server. This computer is identi-
grity of the database will be restored either by HTransac- fied by a unique internal number and
tionCancel, or by HTransactionStart/HTransactionEnd. its name (name defined in Windows).
Note: after a power outage, we recommend you reindex To easily identify the user computer
the application’s data files. that performs the operations in tran-
Error while using the program saction, the HPost function lets you
define an identifier specific to the user
When the application or the site’s execution stops computer. To define a unique identifier
because of a programming error (divide by zero for ins- for each user, use the BrowserIPAd-
tance), the current transaction is automatically canceled. dress function. This identifier is saved
Deleting the transaction log in the log of operations in transaction
The transaction log is a HyperFileSQL file created and and it can be consulted with
present only during the time of the transaction. You WDTRANS.
should not delete this file for fear of database incohe-
Tome1_2.book Page 529 Vendredi, 28. mai 2010 5:50 17
529
2.10 Logs
2.10.1 General points The types of log
Keeping "logs" of the files from the analysis is an inte- The following options allow you to log your data files.
resting features. Depending on the selected option, different files will be
created automatically.
What is a log?
The log is a special file in which WinDev/WebDev auto- Option Action performed Files automati-
matically stores all the operations performed on one or cally created
more data files from a given time (file creation, last auto- No log None
matic data modification, last backup performed by (default
WDLog, etc.) option)
Write-to- All the addition, modifi- <File
WB The log is saved on the server compu- file log cation and deletion Name>.JNL.fic
ter.
operations are recorded
The log contains the historic of the file use, which means: in this log.
When to choose this
• the full record before it is used or modified by the user, option?
• the full record after it is used or modified by the user, To find out at anytime
• the author of the operation or modification, who modified the file
• the date of the operation or modification, and what modification
was performed.
• the nature of the performed operation: add, modify,
delete, read. History of Only the HyperFileSQL JournalOpéra-
File Acces- commands used to tion.fic
What is a log used for? ses access the file will be JournalIdentifi-
The log can be handled by WDLog. The following opera- stored. cation.Fic
tions can be performed from a log: When to choose this
• Restore the content of a logged data file if the data file option?
is lost or destroyed. To find out the opera-
• Restore the content of a logged data file up to a given tions performed on this
530
2.10.2 Implement the log process 2.10.3 Files created when setting up the log
Define the log process for the data files process
The log process for the HyperFileSQL data files is imple- When a log option has been requested for an analysis
mented in the data model editor. file, the following files can be created:
To implement the log process on a file described in the JournalOpéra- List of all the operations perfor-
analysis: tion.Fic med on the logged HyperFileSQL
1. Back up the data files in their current state using data files used by the application
the WDLog tool. or by the site. An operation cor-
2. In the data model editor, display the file descrip- responds to a HyperFileSQL func-
tion you want ("File structure .. Description"). tion.
3. In the "Misc." tab, select the type of log to
manage for this file. JournalIdentifica- List of the physical locations of all
4. Depending on the selected option, specify (if tion.Fic the logged files found in the appli-
necessary) the directory of the different files created cation or site.
by the log process. *JNL.Fic File created for each logged file.
Caution: the JournalIdentification and JournalOperation Contains the backups of the
files are always located in the same directory. By default, records for all the operations per-
these files are created in the application’s directory or in formed by the user.
the site’s directory. This directory is defined in the analy-
sis options ("Analysis .. Analysis description", "Log" See the online help for more details.
tab) and can be modified for each individual file. To configure the location of these files and their pas-
Advice: log files let you store the operations performed swords:
on a file to replay them on a backup in case of a problem • JournalOpération and JournalIdentification file: by
(damaged disk for instance). We recommend that you default, these files are created in the application or
save the log files in directories (and even disks) different site’s directory. To modify this directory:
from the ones used for the data files. 1. Display the description of the analysis
Defining the log process for the items ("Analysis .. Analysis Description").
2. Display the "Log" tab.
By default, all the items of a logged file are automatically 3. Select the directory of the file and its password if
logged. However, you can specify whether some items necessary.
Part 8: File management
must be logged or not. Note: this directory can also be modified for each
For example, if one of the data files uses a memo item to logged file ("File Structure .. Description", "Misc."
store an image (information not that important and that tab). In this case, the JournalOperation and JournalI-
does not change very often), you have the ability not log dentification files will be created for each file at the
this item. specified location.
To avoid logging an item : • *JNL file: by default, this file is created in the applica-
1. Display the description of the file. tion or site’s directory. To modify this directory:
2. Display the description of the requested item. 1. Display the file description ("File structure .. Des-
3. In the "Advanced" tab, uncheck "Log the item". cription").
2. Display the "Various" tab.
Generating the analysis
3. Select the file directory.
When the log process has been defined in the data Note: the password of the *JNL.fic file will be identi-
model editor, the analysis can be generated. cal to the password of the data file.
Attention: before performing this operation, we recom-
mend you backup the data files with the WDLog tool 2.10.4 WDLog:Log management tool
(seepage 587). WDLog enables you to:
Automatic data modification and log • Save and restore your data files.
process • Check the consistency of a log and clear it if necessary.
When an automatic data file modification is performed • Restore a data file from its log.
on logged files: • Find out who modified a record, when, ...
1. The log files are automatically saved.
2. The log files are flushed out. This tool can be freely distributed. See ’WDLog’, page
587, for more details.
Tome1_2.book Page 531 Vendredi, 28. mai 2010 5:50 17
531
2.10.5 Handling the logs by programming HLogStop Stops the log process on a file.
The logs are managed automatically. However, several WLan- The operations performed in the
guage functions let you handle logs: logged file are not saved any-
more.
HChangeLogDir Dynamically modifies the loca-
tion of the log files correspon- HRegenerateFile Regenerates a file from its log.
ding to a HyperFileSQL file (*JNL
files and JournalOperation and Some WLanguage properties can also be used to
JournalIdentification files). manage the logged files:
HSetLog Enables or disables the manage- LogFile Enables you to find out whether
ment of the logs. This manage- a data file is a log file or not.
ment is enabled by default. Log process Identifies the log mode used for
a data file (defined in the data
HLogInfo Adds comments to the log when model editor or dynamically).
saving the logged operation.
These comments can be viewed LogDirectory Enables you to manage the
in WDLog. directory of the log file descri-
bed in the analysis. You can:
HLogRecreate Recreates an empty log. This • Find out the directory of the
function is used to reset the log log for a file defined in the
to 0 for instance after a backup data model editor or dynami-
or a replication. The content of cally.
the existing files is lost. • Define the log file directory for
a file defined dynamically.
HLogRestart Restarts the log process on a
file. This log operation was stop-
ped by HStopLog.
532
Note: in the case of a network installation, the automatic file can be given to the application or site manager.
modification of the data files modify both the data files By default, this file is named "LOGMODAUTO.TXT" and
Part 8: File management
found on the server computer and the ones found on the it is created in the setup directory of the application or
user computers (WinDev only). site.
• List the data files in HyperFileSQL format onto which
2.11.3 Perform automatic data modification the automatic modification will be performed. You will
Development computer have the ability to add to this list:
The automatic modification of the data files is systemati- - additional data files,
cally performed when the analysis is generated on the - additional directories containing data files.
development computer. • Specify additional directories containing data files in
To apply the automatic modification to the data files Hyper File 5.5 format that are not automatically found
found on the end-user computers or on the data servers, during the update.
the automatic modification must be performed when ins- Notes:
talling the application or site’s update. The configuration
of the automatic modification can be performed when • During the update, the data files automatically found
creating the setup program. are:
- the files found in the setup directory of the applica-
Deployment Computer tion or site,
When installing an update with automatic modification of - the files listed in the ".REP" file.
data files, the user or the site manager will be able to See ’Reassigning files’, page 543, for more informa-
configure the automatic modification by clicking the tion about the ".REP" file.
"Advanced" button. This button is found on the first • To prevent the user from accessing the options for con-
plane of the setup program. A window comes up allowing figuring the automatic modification, the WDINST setup
you to: editor enables you to hide the "Advanced" button in
• Create a report file for the operations performed by the the setup program (WinDev only).
automatic data modification. If a problem occurs, this
Tome1_2.book Page 533 Vendredi, 28. mai 2010 5:50 17
533
534
Several management features are enabled by default performed on the database. See ’Transactions’, page
when creating a WinDev application or a WebDev site. 548, for more details.
To optimize the response time of your applications or If no file is in transaction, transaction management is
sites, we recommend that you "disable" the manage- useless. It can be disabled by HSetTransaction.
ment features you don’t need. Here are the various
management features that are enabled by default: 2.14.2 Managing the log
• the transactions, The log file is a special file where all the write operations
• log, performed on a data file since the last backup are stored.
• memos, Its operating mode is described in the ’Logs’ paragraph,
• the .REP, page 551.
• the replication, If no file is logged, HSetLog lets you disable the log
management.
• the triggers,
• RPC. 2.14.3 Memo Management
For each of these management features, here is a brief Memo management is needed when files contain memo
summary of the feature and how to disable it by program- type items. Their management is described in the ’Mana-
ming. ging "memo" file’ paragraph, page 541.
Caution: all the features must be disabled in the project If no file contain memo items, you can disable their
initialization code. management with HSetMemo.
535
See the ’Reassigning files’, page 543, for more details on cation action performed on a record from one or more
its use. files. Its use is described in the ’HyperFileSQL triggers’
If your application or site does not need ".REP" manage- paragraph, page 576.
ment, you can disable it using HSetREP. If no trigger is used in the application or the site, the trig-
ger management can be disabled with HSetTrigger.
2.14.5 Management of replication
Data replication lets you keep data files found on diffe- 2.14.7 RPC management
rent computers up to date. Its use is described in the RPC lets you consult a HyperFileSQL database via Inter-
’Data replication’’ paragraph, page 578. net/Intranet or phone lines. RPC management is detailed
If your application or your site does not use the replica- in the online help.
tion, you can disable its management with HSetReplica- If your application or site does not manage remote
tion. access, we recommend you disable its management
using HSetDistantAccess.
2.14.6 Trigger management
A trigger is the association of a procedure and a modifi-
536
537
3. SQL LANGUAGE
3.1 Overview
A program developed with WinDev or WebDev can access This chapter presents how to access:
a database using several modes: • HyperFileSQL files via SQL,
• Native Access • third party database files through SQL.
• OLE DB
• ODBC via OLE DB
538
All the other SQL commands not listed here are not cur- "Address FROM CUSTOMER WHERE "+…
rently supported. "CUSTOMER.City LIKE ’PARIS%’") THEN
Note: we will not go into details about these commands. Error(HErrorInfo())
We recommend you read a specialized book or the ELSE
online help if needed. HReadFirst(QuerySource)
While Not HOut()
// Browse the result of the query
HReadNext()
END
END
539
Sample SQL DELETE query: For example, to find a customer whose number has been
IF Not HExecuteSQLQuery(… entered on the screen:
"DeletionQuery",…
"DELETE FROM CUSTOMER WHERE "+… CSQLQry is string
"CUSTOMER.CustomerNum=346") THEN QuerySource is data …
Error(HErrorInfo()) data
ELSE // CustomerNumberControl is an edit
Info("Deletion performed") // control of the window
END cSQLQry="SELECT CustomerName FROM "+…
"CUSTOMER WHERE CUSTOMER.Customer-
Passing parameters to a query Number="+…
A query on a database can receive parameters (the CustomerNumberControl
selection of customers in state XX for instance). IF Not HExecuteSQLQuery(…
To do so, HExecuteQuery lets you pass parameters to the QuerySource,cSQLQry) THEN
query built in the query editor. For more information, see Error(HErrorInfo())
the help about the query editor and the HExecuteQuery ELSE
function. HReadFirst(QuerySource)
Info(SourceQuery.CustomerName)
A query in SQL language (initialized by HExecuteSQL- // Display the name of the found cus-
Query) can also accept parameters. To do so, the string tomer
making up the SQL query must be built by concatenating END
the parameters.
540
541
542
4.2.1 Example demonstrating the need for Important: locks remain active as long as an unlocking
locks function (on the file or a record) or a write function
Several examples of lock processing are presented (unlocks the written record) has not been executed.
below. They illustrate the need to lock the files.
4.2.3 Dead lock (inter locking)
• To display a list where one or more records can be When managing locks, a situation can arise where all the
selected, there is no need to lock the displayed files are locked and cannot be unlocked. This is called a
records. "Dead lock".
However, once the selection is performed, in most
cases, the corresponding record must be read in order To avoid a dead lock, we recommend you follow these
to make sure it exists and must be locked so it can be three steps:
modified if needed. 1. Lock all the files used in a process according to
their alphabetical order.
• If one or more records are added to a file, the file must 2. Perform the process you want.
be locked so the value of one item can be calculated 3. Unlock the files.
based on another record (customer number for ins-
tance). In other cases, you don’t need to lock the file. Let’s look at a specific example. The example below pre-
sents a dead lock case.
Part 8: File management
• During a statistical process that calculates the weight Let’s assume that the P1 and P2 programs perform the
of one or more items in respect to all the items, the file following process (do not do!):
must be locked or modifications must be forbidden
before the process in order to insure that the file’s con- Program P1 Program P2
tent will not be modified during the calculations. LOCK(F1) LOCK(F2)
• Lock management often depends on the situation in LOCK(F2) LOCK(F1)
which a file is used. To simplify lock management, for < Process 1 > <Process 2>
example in the case of a cash register program, the
same customer cannot be at several cash registers at UNLOCK(F1) UNLOCK(F2)
the same time. Therefore the record in the customer UNLOCK(F2) UNLOCK(F1)
file does not need to be locked when processed even
though it is being modified. The programs set their locks in the following order:
• P1 locks F1;.
4.2.2 Lock structure • P2 locks F2.
Two lock levels are offered: • P1 wants to lock F2, but it is already locked by P2.
• lock an entire file, • P2 wants to lock F1, but is already locked by P1.
• lock a given record.
Both programs wait for the file to unlock: there is no solu-
Locking an entire file automatically locks all the records tion if neither of the two programs releases a file!
in the file.
Locking an entire file is only possible if no record in this To avoid this situation, let’s follow our previous advice:
file is locked by another computer or another program. 1. Lock the files in alphabetical order (F1 then F2).
2. Perform the process you want.
Unlocking a file automatically unlocks all the records loc- 3. Unlock the files.
ked by the same program.
Tome1_2.book Page 543 Vendredi, 28. mai 2010 5:50 17
543
There are two file and record lock modes. • A program developed in Single-user mode cannot be
This chapter: run several times in Windows.
• helps you choose the right mode for your programs, How are the files locked in Single-user
• explains how to lock a file or a record, mode?
• goes into details about each mode. The Single-user mode is the default lock mode of WinDev.
In Single-user mode, as soon as a file is opened by a
4.3.1 Single-user Mode function (HOpen or any other function, for example
The Single-user mode is the default lock mode of WinDev. HReadFirst, HCreation, …), the file is locked automati-
It is characterized by the automatic locking of each file cally for reading and writing.
right after its opening. The file will be unlocked when it is If access to the file is refused (the file is already locked by
closed. another program), the program’s execution is terminated
WinDev 5.5 user: this mode corresponds to the HMo- after the display of a message indicating that this mode
deAuto function of WinDev 5.5. is not appropriate.
544
• P2 opens and locks the "ORDERS" file are detailed at the end of this section.
• P1 opens the "ORDERS" file even though it is locked. You will notice that none of these programs contains file
HOpen(hORead/hOReadWrote) opens the file locking functions.
whether it is locked or not. // Search for a customer according to
• P1 can read the file and P2 can modify the file. his or her name
Caution: if P2 deletes the "X" record from the HReadSeek(CUSTOMER,NAME,"MARTIN")
"ORDERS" file at the same time P1 reads the "X" IF HFound() THEN
record in the "ORDERS" file, P1 will not see that record Info ("Customer found")
"X" has been deleted from the file. Otherwise
Info("Unknown customer")
To share a file between a program modifying a file and End
one or more programs reading the file, the program
modifying the file must call a function to open and lock Note: after calling HReadSeek, the "CUSTOMER" file is
this file, the other programs must call HOpenNoLock to opened and locked. It is unlocked at the end of the pro-
access the file even though it is locked. gram’s execution.
Note: functions are detailed at the end of this section.
4.3.2 Multiuser mode
Caution: if the file is opened by HOpen(hORead/
hOReadWrite), the file is not locked. Therefore the file is The Multiuser mode is the default lock mode of WebDev.
not protected against potential modifications. The multiuser mode is characterized by:
this is why HOpen(hORead/hOReadWrite) should only • the locks are managed by the developer in the pro-
be used in programs that do not modify the file. grams,
Therefore the following instructions should not be execu- • the lock report status (to find out if any record from a
ted after HOpen(hORead/hOReadWrite): file is already being locked by another program) are
- HAdd- HWrite managed in the programs by the developer who deci-
- HFree- HModify des on the processes to perform.
- HCross- HDelete
Tome1_2.book Page 545 Vendredi, 28. mai 2010 5:50 17
545
WinDev 5.5 use: this mode corresponds to the HMode- The multiuser mode is well suited for programs that
Perso function of WinDev 5.5. manage files that can be shared. The programs process a
logical update operation of several files that cannot be
WB WebDev 1.5 user: this mode corres- interrupted.
ponds to the HModeAuto function of
WebDev 1.5. 4.3.3 The possible locks in multiuser mode
When should this mode be used? File locking by programming
The multiuser mode should be chosen over the single- There are several ways of locking a file or a record:
user mode when one or more files from one program • lock the file,
must be shared with other programs. • lock record by record.
Therefore, the multiuser mode must be used as soon as a
logical update operation on several files should not be Locking the file
interrupted: either all the files are updated or none. You need to lock the entire file if the following two condi-
tions are met:
In WinDev, the multiuser mode automatically manages: • if several records must be locked at the same time,
• lock errors, • to simplify programming.
• modification conflicts.
This automatic management can be customized at any Here are the functions than lock a file:
time by using HOnError. See the online help for more • HLockFile: the file is write-locked.
details. • HLockFile(hLockRead/hLockWrite): the file is locked
both for reading and writing.
Note: the management of locks used in WinDev 5.5 is
still available for compatibility. • HNoModif: the file is write-locked including for the
program that locked it.
Calling the multiuser mode Here are the functions that can unlock a file:
To call the Multi mode in a program, simply execute the • HUnlockFile: the file was locked by HLockFile.
HMode(hModeMulti) function at the beginning of the • HEndNoModif: the file was locked by HNoModif.
program • HLock: the file is closed and unlocked.
There are two methods for setting up locks: Locking record by record
546
Note: assisted error management is available for files in • Default assisted management (WinDev and WebDev)
HyperFileSQL Classic format, for files handled via native When an integrity error occurs, a window or a page
access or via an OLE DB provider. comes up, allowing the user to cancel the operation or
If your files are used via an OLE DB provider, only the fol- to modify the data entered.
lowing will be managed: • Processing the error (WinDev Mobile)
• The duplicate error Test HErrorIntegrity after each call to a HyperFileSQL
Caution: some duplicates error may not be recognized function that may trigger an integrity error (HAdd or
by the OLE DB access. These errors will not be mana- HModify for instance). The text of the error is returned
ged as duplicates errors but they will be considered as by HErrorInfo.
being fatal errors. Example: the WinDev analysis and
the description of the external database are out-of- Password error
synch and the description of the file in the analysis
• Cause of the error
does not contain all the unique keys defined in the
The program tries to handle a password-protected file
database. (opening, first read operation, …). The password was
• The errors of mandatory input not specified by programming: a password error
Caution: the mandatory input error only comes up if occurs.
the OLE DB provider indicates that the item is associa- • Default assisted management (WinDev and WebDev)
ted with the "NULL forbidden" property. Otherwise, When a password error occurs, a window or a page
the error will be processed like a fatal error.
comes up, allowing the user to enter the file’s pas-
If your files are handled via a native access, only the sword.
management of mandatory password is not available. • Processing the error (WinDev Mobile)
Check HErrorPassword after each call to a HyperFi-
leSQL function that may trigger a password error
(HOpen or the first HyperFileSQL function that handles
Tome1_2.book Page 547 Vendredi, 28. mai 2010 5:50 17
547
the file for instance). The text of the error is returned by 1. User X edits the form for the state of "California".
HErrorInfo. 2. User Y edits the form for the state of "California".
3. User X renames the state to "California_01".
Error of modification conflict and error 4. User Y modifies the name of the state
of modification status conflict ("California_02") and saves. A modification conflict
occurs during this backup.
• Cause of the error A modification conflict occurs.
When using an application or a site over a network, A modification status conflict occurs when the form is
conflicts may occur due to conflicting data entered by deleted by user X for instance.
different users.
For example:
548
The different cases are presented in the table below: application continues to run properly.
Record read • Processing the error (WinDev Mobile)
Check HErrorLock after each call to a HyperFileSQL
Record on Active Crossed Deleted function that may trigger a lock error.
disk
Mandatory Input (database accessed
Active Modifica- Modification Modifica- via OLE DB)
tion conflict conflict tion conflict • Cause of the error
Crossed Conflict of Modification Modifica- Some file items must have a value. An error of manda-
modifica- conflict tion conflict tory input occurs if this value was not specified.
tion status • Default assisted management (WinDev and WebDev)
When an error of mandatory input occurs, the manage-
Deleted Conflict of Conflict of XXXX ment of mandatory input is automatically performed by
modifica- modification the HyperFileSQL engine.
tion status status A window or a page comes up, notifying the user that
the item must be entered and offering him to renter a
• Default assisted management (WinDev and WebDev)
value.
If a conflict occurs when modifying a record, a window
or a page comes up, offering the user the different pos- • Processing the error (WinDev Mobile)
sible values for the record: The error number associated with this problem is
- the value read in the file (before modification), 70710: Mandatory input.
- the value modified by another user, These error numbers are returned by HError.
- the value entered by the current user. Reindex in progress
The user can choose the value of the item that will be • Cause of the error
saved. The file handled is currently reindexed. The file cannot
If a status conflict occurs when a record is modified, a be used (read, write) while it is being reindexed.
window is displayed, allowing the user to: • Default assisted management (WinDev or WebDev)
- re-enable the deleted data, A window or a page comes up, notifying the user that
- keep the data in its current status. the file is being reindexed. This window or page
The user can choose the value of the item that will be remains displayed during the entire reindex and cannot
saved. be closed. A progress bar indicates the status of the
Part 8: File management
549
550
551
See the online help to check the availability of these WinDev Mobile).
functions in the different products (WinDev, WebDev,
552
553
6. HYPERFILESQL TRIGGERS
6.1 Overview
6.1.1 Definition When using one of these table handling functions, if a
A trigger is the association of a procedure and a write trigger is defined for the corresponding HyperFileSQL
function on a HyperFileSQL file. function, it is automatically triggered.
Triggers allow you to easily execute processes when
modifying a record. 6.1.2 Benefits of using triggers
Procedures called by triggers can be executed before or The triggers enable you to associate processes to all the
after the write operation performed on the file. HyperFileSQL functions for file management without
worrying about the location of these functions in the
A BEFORE trigger is called before executing a HyperFi- source code.
leSQL function. It can check the coherence of a record’s The triggers associated with the HyperFilesSQL functions
items for instance. In this trigger, a HyperFileSQL state used are run even if it is a window or a source code crea-
variable can be used to cancel the function’s execution. ted by a wizard.
An AFTER trigger is called after the execution of the Using triggers enables you to reduce the size of the code,
HyperFileSQL function (except if the program has been make its reading easier and make future changes easier,
interrupted during this function). It can centralize the by grouping processes.
error processing for instance.
For more information, the diagram on the following page
Note: trigger on table handling functions; The functions presents the detailed operating mode of triggers.
for handling tables (TableAdd, TableAddLine, TableDe-
lete, TableModify, TableSave, ... ) implicitly uses the fol- Note: triggers are also available in HyperFile Client/Ser-
lowing HyperFileSQL functions: HAdd, HDelete and ver mode.
HModify.
554
555
556
557
7.4 Limitations
Here are the limitations: •During the replication, the memory consumption may
•Each file or table must have at least one unique key. be very high. Therefore, only the necessary records
•You must have the ability to associate a date with a should be replicated toward a subscriber computer.
record. If the item used to associate a date with the •Caution: special case: only part of the linked tables
record is automatically filled by trigger, this trigger are not replicated.
must be disabled when HSynchronizeReplica is run In this case, the replication may redo some modifica-
(to avoid filling this item with the replication date). tions as an {addition, deletion} couple. If a non-repli-
•The replication does not open the files or the tables. cated table is linked with cascading modifications,
The files or the tables must have be opened by the the linked records may be wrongly deleted.
program before the replication is started.
558
The remote access enables you to consult a HyperFi- Mode 1: WinDev Back Office application
leSQL database via Internet/Intranet or via STN (Swit- and database on the Web server
ched Telephone Network).
The database is located on the Web server. The database
There are three use modes: is updated directly by the WebDev site according to the
• Mode 1: Web users’ actions.
A Back Office application interrogates the database The users of the Back Office application query and
located on the Web server (where the WebDev site is update the database from the WinDev application.
located). The Back Office application talks to the database
• Mode 2: through the remote access.
The Web server accesses a database located on the
computer of the Back Office application. Note: the WinDev Back Office application can be
accessed on an application server (see diagram) or dis-
• Mode 3: tributed on the user computers. In this case, each user
A WebDev site located on a server A queries a data- starts a remote access.
base located on a server B (where another WebDev site
is located). Mode 2: database on the computer of
The WLanguage functions used to manage remote the WinDev Back Office application
access are: HOpenAnalysis and HConnectRemoteAc- The database is located on the computer of the WinDev
cess. application. The database is updated directly by the
WebDev site during the Web users’ actions through the
remote access.
The users of the Back Office application query and
update the database directly from the WinDev applica-
tion.
Tome1_2.book Page 559 Vendredi, 28. mai 2010 5:50 17
559
Mode 3: two WebDev sites on two • directly by the WebDev site located on the same com-
remote servers for a single database puter.
Depending on the site where the users connect, the data- • from the WebDev site using remote access (see the
base is updated: online help for more details).
560
561
562
563
HFilterStartsWith Defines and enables a "Start with" filter on a file, view or query. The "Starts with" fil-
ter enables you to select all the records that start with a specific set of characters
HFilterIncludedBetween Defines and enables an "Included between" filter on a file, view or query. The "Inclu-
ded between" filter enables you to select all the records found between two values
HFilterIdentical Defines and enables a filter used to search for the exact value of a string item. This fil-
ter can be used on a file, a view or a query
HEndNoModif Unlocks a file locked by HNoModif
HFlush Forces the operating system of the computer where the data files are found to write
the data directly to the disk
HMergeView Creates a HyperFileSQL view from two views that were previously created
HSetDistantAccess Temporarily disables the remote access in order to access local HyperFileSQL Classic
data files
HSetDuplicates Enables or disables the management of duplicates on a unique key
HSetIntegrity Enables or disables the management of an integrity constraint on a file link
HSetLog Enables or disables the management of the log for a logged file
HSetMemo Enables or disables the management of memo items
HSetREP Enables or disables the management of .REP file
HSetReplication Temporarily enables or disables the management of replication
HSetServer Enables you to find out and modify some server settings.
HSetTransaction Enables or disables the management of transactions
HSetTrigger Enables or disables the management of triggers
HImportHF55 Imports a Hyper File 5.5 file into a file in HyperFileSQL Classic format
HImportText Imports a text file into a file in HyperFileSQL Classic format
HImportXML Imports an XML file into a file in HyperFileSQL Classic format
HInfoLog Returns information about the server logs.
HInfoMemo Returns the characteristics of binary memos
HInfoReplica Returns information about the specified replica
HInitSubscriber Initializes the range of automatic identifiers for the description file of a subscriber
564
HListItem Returns the list of items found in a file recognized by the HyperFileSQL engine
HListTrigger Returns the list of triggers applied to one or more HyperFileSQL data files
HRead Reads a record in a file according to a given record number
HReadLast Points to the last record of a file, reads the record and updates the HyperFileSQL
variables
HReadPrevious Points to the previous record of a file, reads the record and updates the HyperFileSQL
variables
HReadFirst Points to the first record of a file, reads the record and updates the HyperFileSQL
variables
HReadSeek Points to the first file record whose value for a specific item is greater than or equal to
a sought value
HReadSeekLast Points to the last file record whose value for a specific item is less than or equal to a
sought value
HReadSeekFirst Points to the first file record whose value for a specific item is greater than or equal to
a sought value
HReadNext Points to the next record of a file, reads the record and updates the HyperFileSQL
variables
HMigrateLinkedCompositeKey Migrates the values of linked composite keys
HRefreshSet Creates or updates a set of procedures on a HyperFileSQL server
HMode Changes the mode and the method used to lock the files
HModify Modifies the specified record or the record found in memory in the data file
HNbRec Returns the number of records in a file or in a HyperFileSQL view
HRecNum Returns the number of the current record in the file or in the HyperFileSQL view
HOptimize Optimizes the access to the indexes of HyperFileSQL files: the indexes are loaded into
the system cache. Speeds up the first file browse operations and the first query exe-
cutions
HOptimizeQuery Used to handle the idle periods of a software (period without processes) to optimize
the queries. Optimizes the access to the indexes of HyperFileSQL files
HOpen Opens a file
Part 8: File management
565
566
HCheckStructure Defines the mode for comparing the files. This comparison is performed when opening
the data files between:
• the structure of the file defined in the data model editor
• the structure of the physical file
HVersion Enables you to find out whether the content of the file was modified
HToFile Copies a data source (view, query, …) to a physical HyperFileSQL file with the same
description
HToItem Assigns the specified value to an item of the current record
HViewToFile Saves the modifications made to a view in the corresponding file
PageToFile Automatically initializes the memory value of the file items with the value of the page
controls
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Part 8: File management
Tome1_2.book Page 567 Vendredi, 28. mai 2010 5:50 17
567
568
CtOLEDBProvider Manages the name of the OLE DB provider (taking into account the modifications per-
formed by HConnect)
CtDescribedOLEDBProvider Manages the name of the OLE DB server (while ignoring the modifications performed
by HConnect)
CtCacheSize Enables you to find out and modify the maximum number of records that can be con-
tained in the cache of the Native MySQL Access
CtUserName Manages the user name during an OLE DB connection (takes into account the modifi-
cations performed by HConnect)
CtDescribedUserName Manages the user name during an OLE DB connection (takes into account the modifi-
cations performed by HConnect)
ExecutionCompleted Enables you to find out whether the execution of a query or view (Hyper File Classic or
Client/Server) is completed
Extension Enables you to find out and modify the extension of a data file
LogFile Enables you to find out whether a data file is a log file
InitialFile Enables you to find out the name of the initial file corresponding to an item defined by
an alias
LinkedFile Configures the name of the linked file used in the link
SourceFile Configures the name of the source file used in the link
TransactionFile Enables you to find out whether a data file is a transaction file
FilterWithBounds Enables you to find out whether bounds have been specified on the filter implemen-
ted by HFilter on a data file, a HyperFileSQL view or a query
Format Configures the format of the data found in the data file (ANSI or Unicode)
KeyExpression Configures the components of a composite key
GèreHTLM Configures the management mode of the HTML format in a full-text index.
ManageRTF Configures the management mode of the RTF format in a full-text index.
HugeFile Configures the maximum size of a data file
GUIDAnalysis Returns the GUID of the analysis that was used to create the data file
GUIDFile Returns the GUID of the file defined in the analysis that was used to create the data
file
Part 8: File management
MaxThumbnailHeight Enables you to find out or define the maximum height of the Nth thumbnail
Hour Retrieves or modifies the hour or the number of hours in a Date item ("Date and
Time" or "Duration" format) or in a Time item
MaxAutoID Enables you to find out the maximum automatic identifier for a replicated file
MinAutoID Enables you to find out the minimum automatic identifier for a replicated file
Subscript Returns the physical subscript of the item in the record
InfoThumbnailGeneration Enables you to find out whether the thumbnail was generated or enables you to find
out the generation error
ExtendedInfo Returns and modifies the additional information on a data file or an item accessed via
Native Access
Day Retrieves or modifies the day or the number of days in a Date item ("Date", "Date
and Time" or "Duration" format)
LogMethod Configures the log mode of a data file
MaxThumbnailWidth Enables you to find out or define the maximum width of the Nth thumbnail
Language Defines the parameters of the language used to perform the comparisons and the
sort for a Unicode item (takes into account the modifications performed by the H.Lan-
guageCreationUnicode variable).
LanguageDescribed Defines the parameters of the language used to perform the comparisons and the
sort for a Unicode item (ignores the modifications performed by the H.LanguageCrea-
tionUnicode variable).
Caption Returns the caption associated with the item
MinimumLength Enables you to define and find out the minimum length of the words to index in a full-
text index.
Tome1_2.book Page 569 Vendredi, 28. mai 2010 5:50 17
569
570
OperationLogDirectory Enables you to manage the directory for the operation file of the log associated with a
logged file
ReplicationDirectory Enables you to manage the directory of the replica (".RPL" or ".RPM" file)
LogBackupDirectory Enables you to find out and modify the backup directory of the log files
Replication Enables you to find out the replication mode used for a data file (defined in the data
model editor or dynamically). For dynamically defined files, you can specify whether
this file is in replication mode or not
FilteredItem Enables you to find out the item on which a filter was implemented by HFilter on a
data file, a HyperFileSQL view or a query
InitialItem Enables you to find out the name of the initial item corresponding to an item defined
by an alias
Items Enables you to define and find out the different items included in the full-text index.
TextItemCompleted Configures the management mode of the text items in a HyperFileSQL file (the text
items can be automatically filled with space characters or not)
Second Retrieves or modifies the seconds or the number of seconds in a Date item ("Date
and Time" or "Duration" format)
Secure Configures the security level for file encryption
AccentuationSensitive Configures how the accented characters will be taken into account in the different
searches performed on the item
CaseSensitive Configures how the case (uppercase/lowercase characters) will be taken into
account in the different searches performed on the item
PunctuationSensitive Configures how the punctuation (comma, dot, and so on) will be taken into account in
the different searches performed on the item
Server Enables you to find out and modify the data source of a connection
Source Enables you to find out and modify the data source of a connection
Size Configures the size of a text item (character string, text memo, character)
CacheSize Enables you to find out and modify the maximum number of records that can be con-
tained in the cache of the Native MySQL Access
KeySize Enables you to find out and modify the size of the indexed section of a text memo
Part 8: File management
RecordSize Returns the size of a record without taking the composite keys into account
Text Identifies a text item
Type Identifies and modifies the type of an item
KeyType Configures the characteristics of a key item
SortType Configures the characteristics of the sort on an item
User Enables you to find out and modify the user of a connection
DefaultValue Configures the default value of an item
Thumbnail Enables you to find out the value of the Nth thumbnail
VisibleEndUser Enables you to find out whether an item is visible (or not) to the end users and to
define whether an item must be visible (or not) to the end users
WDD55 Path of the WDD file in 5.5/1.5 format used to handle the files in 5.5/1.5 format in a
WinDev 15 application or a WebDev 15 site
See the online help for more details.
See the online help to check the availability of these properties in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 571 Vendredi, 28. mai 2010 5:50 17
571
572
Example: the following SQL code extracts the last 5 cha- SUBSTRING(CharacterString or …
racters of the customer name: Item, StartPosition,…
NbCharactersToExtract)
Part 8: File management
SELECT RIGHT(CUSTOMER.Name, 5)
FROM CUSTOMER Example: the following SQL code extracts the third and
fourth characters from the customer name:
12.1.3 MID, SUBSTR and SUBSTRING SELECT SUBSTRING(CUSTOMER.Name, 3,
The MID, SUBSTR and SUBSTRING functions enable you 2)
to: FROM CUSTOMER
• extract a substring from an item’s content starting at a
given position,
12.1.4 LTRIM
• extract a substring from a string starting at a given
position. The LTRIM function returns a character string:
• without the space characters on the left,
MID
• without a list of characters.
The MID function can only be used with an Access type The characters are deleted from the left to the right.
data source. This deletion is case sensitive (uppercase/lowercase).
Use format: This deletion stops when a character that does not
MID(…
belong to the specified list is found.
CharacterString or Item, …
The deletions of specific characters cannot be perfor-
med on an Access or SQL Server data source.
StartPosition,…
NbCharactersToExtract) The character string passed as parameter to the function
corresponds to:
• the content of an item,
• a character string.
Tome1_2.book Page 573 Vendredi, 28. mai 2010 5:50 17
573
574
575
the LOWER function cannot be used on an Access type Example: the following SQL code lets you obtain the size
data source. of the customers’ names:
Use format: SELECT LENGTH(CUSTOMER.Name)
LOWER(CharacterString or Item) FROM CUSTOMER
576
Example: the following table shows the position of the Use format:
first occurrence found according to the different values
AVG(Item)
sought:
AVG(DISTINCT Item)
Sought Value
Example: the following SQL code returns the average
City name ’%E%’ ’%E_’ ’%AR%’ wage of employee:
MONTPELLIER 6 10 0
SELECT AVG(EMPLOYEE.Salary)
PARIS 0 0 2 FROM EMPLOYEE
TARBES 5 5 2
TOULOUSE 8 0 0 12.1.20 MAX
VIENNE 3 0 0 MAX returns the greatest of the values found in an item
for all the records selected in the file.
12.1.17 POSITION MAX used in a query without grouping must return a sin-
gle record. If the query contains groupings, a record will
POSITION returns the position of a string in an expres- be returned for each grouping.
sion.
If the data source contains records, the record returned
Use format: by the query will contain the maximum value.
POSITION(String to find, … If the data source contains no record, the value of MAX in
Initial expression) the record returned is NULL.
POSITION(String to find, … Use format:
Initial expression, …
Start position) MAX(Item)
MAX(DISTINCT Item)
12.1.18 COUNT Example: the following SQL code returns the maximum
COUNT returns: wage of the employees:
• the number of records found in a file. SELECT MAX(EMPLOYEE.Salary)
• the number of non-null values of an item. FROM EMPLOYEE
• the number of different values and non-null values of
an item 12.1.21 MIN
Part 8: File management
Use format: The MIN function returns the smallest value found in an
COUNT(*)
item for all the records selected in the file.
COUNT(Item) Use format:
COUNT(DISTINCT Item) MIN(Item)
Examples: Example: the following SQL code returns the minimum
• The following SQL code is used to find out the number wage of the employees:
of products found in the Product file:
SELECT MIN(EMPLOYEE.Salary)
SELECT COUNT(*) FROM EMPLOYEE
FROM PRODUCT
• The following SQL code is used to find out the number 12.1.22 SUM
of products onto which a VAT rate of 5.5 % is applied: SUM returns:
SELECT COUNT(PRODUCT,VATRate)
• the sum of the non-null values found in an item for all
FROM PRODUCT
the records selected in the file.
WHERE PRODUCT.VATRate = ’5.5’ • the sum of the different and non-null values found in
an item for all the records selected in the file
12.1.19 AVG Use format:
AVG calculates: SUM(Item)
• the mean for a set of non-null values. SUM(DISTINCT Item)
• the mean of a set of different values, not null.
Tome1_2.book Page 577 Vendredi, 28. mai 2010 5:50 17
577
Example: the following SQL code returns the total sum of mers:
all the wages:
SELECT TOP 10 SUM(ORDERS.TotalIncTax)
SELECT SUM(EMPLOYEE.Salary) AS TotalIncTax,
FROM EMPLOYEE CUSTOMER.CustomerName
FROM CUSTOMER, ORDERS
Note: the item handled by the SUM function should not WHERE CUSTOMER.Customer-
correspond to the result of an operation. Therefore, the Num=ORDERS.CustomerNum
following syntax generates an error: GROUP BY CustomerName
SELECT (A*B) AS C, SUM(C) ORDER BY TotalIncTax DESC
FROM MYFILE
Note: we recommend using the TOP function os a sorted
This syntax must be replaced by the following syntax: query. Otherwise, the records returned by the TOP func-
tion will be selected according to their record number.
SELECT (A*B) AS C, SUM(A*B)
FROM MYFILE 12.1.25 ASCII
ASCII returns the ASCII code:
12.1.23 BOTTOM • of a character.
The BOTTOM function returns only the n last records of a • of the first character in a string.
query result. If the specified character or character string is an empty
BOTTOM can be used only on a HyperFileSQL type data string (""), ASCII returns 0.
source. Use format:
Use format:
// ASCII code of a character
BOTTOM NbrOfLastSelectedRecord ASCII(Character)
// ASCII code of the first character
Example: the following SQL code lists the 10 worst custo- // in a string
mers: ASCII(Character string)
SELECT BOTTOM 10 SUM(ORDERS.Tota-
lIncTax) AS TotalIncTax, 12.1.26 SOUNDEX, SOUNDEX LIKE
CUSTOMER.CustomerName SOUNDEX returns the phonetic presentation of a string
578
Use format:
NVL is used to replace the null values found in a column
NEW_TIME(Date, Time Zone 1, Time by a substitution value. IS_NULL and IF_NULL are identi-
Zone 2) cal.
NEW_TIME is not supported by SQL Server, MySQL, Pro- IS_NULL is used in SQL Server and IF_NULL is used with
gress, Informix, DB2 or Sybase. the MySQL or Progress databases.
Use format:
12.1.32 NEXT_DAY
NVL(Column name, …
NEXT_DAY is used to find out the first day of the week fol- Substitution value)
lowing the specified date or the specified day.
Use format: 12.1.38 DECODE
NEXT_DAY(Date, Day) DECODE is used to find out the operating mode of an IF ..
THEN .. ELSE statement.
NEXT_DAY is not supported by SQL Server, MySQL, Pro-
gress, Informix, DB2 or Sybase. Use format:
DECODE(Column_Name, Compared value 1,
12.1.33 ROUND Returned value 1, [Compared value 2,
ROUND is used to round the date to the specified format. Returned value 2][, Default value])
579
580
HManageTask Enables or disables a scheduled task on a Hyper File Client/Server server. This
function can also be used to find out the status of a scheduled task.
HInfoLock Returns information about a lock performed on a file, on a record or on all the
records found in a file
HInfoDatabaseRights Enables you to find out the rights granted to a user or to a group on a database
HInfoFileRights Enables you to find out the rights granted to a user or a group for a data file
HInfoServerRights Enables you to find out the rights granted to a user or to a group on a server
HInfoFile Returns the characteristics of a file located on a HyperFileSQL server
HInfoGroup Returns information about the specified group of users
HInfoDatabaseProperty Enables you to find out the properties of a database found on a HyperFileSQL ser-
ver
HInfoFileProperty Enables you to find out the properties of a data file found on a HyperFileSQL ser-
ver
HInfoServerProperty Enables you to find out the properties of a HyperFileSQL server
HInfoBackup Returns information about one or more backups performed on a Hyper File Client/
Server server.
HInfoServer Returns the specified information about a server
HInfoTask Returns the characteristics of a scheduled task in a hScheduledTask advanced
type variable.
HInfoUser Refreshes the variables for user management with the information about the spe-
cified user
HNoDatabaseAccess Forbids all the accesses to a database or to all the databases accessible via a
connection
Tome1_2.book Page 581 Vendredi, 28. mai 2010 5:50 17
581
582
PART 9
Appendices
Tome1_2.book Page 584 Vendredi, 28. mai 2010 5:50 17
Tome1_2.book Page 585 Vendredi, 28. mai 2010 5:50 17
585
586
587
Note: WDSQL is provided with an evaluation version of data between several computers that use the same
Oracle native access and SQL Server native access. application.
WDSQL enables you to easily test these native accesses Caution: to use WDReplic, the database of the applica-
in WinDev pr WebDev. tion or site must be configured to support logged replica-
WDSQL can be redistributed. WDSQL can be installed tion. See the online help for more details.
along with the applications developed by WinDev and on Use conditions: WDReplic can be redistributed. WDRe-
the Web server where your site is deployed. The WinDev plic can be installed with the applications or the Web ser-
or WebDev user license is fully enforced. ver where your site is deployed. The WinDevor WebDev
license is fully enforced.
When creating the setup procedure, WDSQL can be pro-
vided with your applications. When creating the setup procedure, WDReplic can be
added to the modules installed with your applications.
1.1.8 WDReplic See ’Data replication’, page 578, for more details about
WDReplic is used to manage the logged replication of replication.
588
1.2.6 WDClip • List of sites where the users were before getting to your
WDClip is a tool used to create windows with original sha- site.
pes. To do so, WDClip uses a shape defined by an image. • Number of downloaded files.
•…
Use condition
WDClip cannot be redistributed. WDClip cannot be ins- These statistics are displayed in:
talled along with the applications developed by WinDev. • Summary table.
These tables can be saved in Word, Excel or XML format
1.2.7 WDAPI (right-click the table).
WDAPI simplifies the use of the Windows APIs in a Win- • Chart. These charts can be customized (right mouse
Dev application. WDAPI generates the WLanguage code click on the chart). You have the ability to change the
and structures required for using a given Windows API. type of chart, add legends, modify the font, etc.
Caution: WDAPI does not let you find an API according to Use conditions: WDStatistics cannot be redistributed.
a given feature. To use WDAPI, you must know the name WDStatistics cannot be installed on the Web server
of the API to use. where your site is deployed.
WDAPI does NOT document the use of each Windows API To use WDstatistics, WebDev development version must
of the system! However, WDAPI gives you the ability to be installed on the current computer.
directly start a site or a document (chosen by yourself)
corresponding to the documentation of the Windows
Tome1_2.book Page 589 Vendredi, 28. mai 2010 5:50 17
589
Part 9: Appendices
Tome1_2.book Page 590 Vendredi, 28. mai 2010 5:50 17
590
591
592
This file is generated by WDInt (tool for translating the error mes- WinDev tools
sages)
.WDO List of the different elements supplied with a WinDev component WinDev compo- X
(data files, .INI files, and so on). nent
.WDP WinDev project WinDev editors X
.WDR WinDev query WinDev editors X
Caution: in WinDev 5.5, this extension corresponded to the
"include" module of the data files
.WDU Name and full path of the elements integrated to a WinDev WinDev editors
library
.WDV Description of the file conversions (generated by WDConver or by WinDev tools X
the data model editor)
.WDW WinDev window WinDev editors X
Tome1_2.book Page 593 Vendredi, 28. mai 2010 5:50 17
593
.WDY Template file at run time. This file is required to apply a skin tem- WinDev editors X
plate dynamically (ChangeSkinTemplate).
If the project is associated with a skin template, the WDY file cor-
responding to the skin template is automatically included in the
WDL (WinDev library).
.WDZ Archive file (created by WDZip for instance) WinDev editors X
.WEP Compilation errors of the project Compilation
.WL WLanguage code that can be included in a WinDev application WinDev editors X
(by the EXTERN keyword)
Several files are supplied with WinDev (\Personal\Extern direc-
tory):
• "WinConst.wl": standard Windows constants.
• "Limits.wl": Constants corresponding to the limits of the Win-
Dev data types.
• "ListeDefinitionHF.wl": HyperFileSQL constants used for logs.
• "EXCEPT.wl": most common exception codes (to retrieve with
ExceptionInfo(errCode)).
• "KeyConst.wl": standard Windows constants used for all
the keyboard keys. These constants can be used by Key-
Pressed, in the "Key Down" or "Key Up" optional processes
with the _EVE.wParam variable.
.WPF Statistical file saved and handled by the performance profiler WinDev editors X
.WRC List of references for the WinDev classes Compilation
.WRE List of references for the WinDev reports Compilation
.WRG List of the references of the WinDev sets of procedures Compilation
.WRP List of references for a WinDev project Compilation
.WRW List of references for the WinDev windows Compilation
.WXF Temporary file containing the description of the installation pro- Setup
Part 9: Appendices
gram (Created by WDInst)
Tome1_2.book Page 594 Vendredi, 28. mai 2010 5:50 17
594
.ENV Parameters for the WebDev editor environment and for the pro- WebDev editors
jects used
.ERR Error message of each component WebDev editors X
.FIC HyperFileSQL data file HyperFileSQL X
.LST File containing the name of the HyperFileSQL files to save (crea- WebDev tools
ted by WDLog)
.MCD Description of Conceptual Data Model (CDM) Analysis X
.MDE Procedures of the RAD models RAD X
.MDL Description file of the RAD patterns RAD X
.MLD Description of Logical Data Model (LDM) Analysis X
.MMO HyperFileSQL memo file HyperFileSQL X
.NDX HyperFileSQL index file HyperFileSQL X
.RAD RAD information about the analysis Analysis X
Tome1_2.book Page 595 Vendredi, 28. mai 2010 5:50 17
595
.REP Correspondence between the logical files and the physical files HyperFileSQL
used by a site
See ’What is the .REP for?’, page 543, for more details
.RPL Description of the subscriber replicas WebDev tools X
.RPM Description of the master replicas WebDev tools X
.SQL Query saved by WDSQL WebDev tools X
.SRP Scenario created and used by WDReplic to perform a replication WebDev tools X
.TKC Archive file of a WebDev class (created whenever the class is Archive
saved)
.TKE Archive file of a WebDev report (created whenever the report is Archive
saved)
.TKG Archive file of a set of WebDev server procedures (created whe- Archive
never the set of procedures is saved)
.TKH Archive file of a WebDev page (created whenever the page is Archive
saved)
.TKN Archive file of a set of WebDev browser procedures (created whe- Archive
never the set of procedures is saved)
.TKP Archive file of WebDev project (created whenever the project is Archive
saved)
.TKR Archive file of a WebDev query (created whenever the query is Archive
saved)
.TRS Log of operations in transaction HyperFileSQL
.TRX Log the values before the transaction HyperFileSQL
.WBC List of identifiers of the WebDev classes Compilation
Caution: in WebDev 1.5, this extension corresponded to the com-
pilation information of a class.
.WBE List of identifiers of the WebDev reports Compilation
Caution: in WebDev 1.5, this extension corresponded to the com- Part 9: Appendices
pilation information of a report.
.WBG List of identifiers for the sets of WebDev server procedures Compilation
.WBH List of identifiers for the WebDev pages Compilation
Caution: in WebDev 1.5, this extension corresponded to the com-
pilation information of a page.
.WBN List of identifiers for the sets of WebDev browser procedures Compilation
.WBP List of identifiers of a WebDev project Compilation
Caution: in WebDev 1.5, this extension corresponded to the com-
pilation information of a project.
.WCC Compilation information of a WebDev class (recreated after each Compilation
compilation)
Tome1_2.book Page 596 Vendredi, 28. mai 2010 5:50 17
596
597
.WL WLanguage code that can be included in a WebDev site (by the WebDev editors X
EXTERN keyword)
Several files come with WebDev (\Personal\Extern directory):
• "WinConst.wl": standard Windows constants.
• "Limits.wl": Constants corresponding to the limits of the Web-
Dev data types.
• "ListeDefinitionHF.wl": HyperFileSQL constants used for logs.
• "EXCEPT.wl": most common exception codes (to retrieve with
ExceptionInfo(errCode)).
.WRC List of references for the WebDev classes Compilation
.WRE List of references for the WebDev reports Compilation
.WRG List of the references of the WebDev server sets of procedures Compilation
.WRH List of references of the WebDev pages Compilation
.WRN List of the references of the WebDev browser sets of procedures Compilation
.WRP List of references of a WebDev project Compilation
.WWF Parameter file for the setup of a site through physical media WebDev editors
.WWH WebDev Page WebDev editors X
.WWP WebDev project WebDev editors X
.WWS Style sheet of the WebDev project WebDev editors
Part 9: Appendices
Tome1_2.book Page 598 Vendredi, 28. mai 2010 5:50 17
598
599
Part 9: Appendices
.WDV Description of the file conversions (generated by WDConver WinDev tools X
or by the data model editor)
.WDY Template file at run time. WinDev editors X
If the project is associated with a skin template, the WDY file
corresponding to the skin template is automatically included
in the WDL (WinDev library).
.WDZ Archive file (created by WDZip for instance) WinDev editors X
.WEP Compilation errors of the project Compilation
.WFP Parameter file for a project’s custom setup WinDev editors X
.WL WLanguage code that can be included in a WinDev applica- WinDev editors X
tion (by the EXTERN keyword)
Several files are supplied with WinDev (\Personal\Extern
directory):
• "WinConst.wl": standard Windows constants.
• "Limits.wl": Constants corresponding to the limits of the
WinDev data types.
Tome1_2.book Page 600 Vendredi, 28. mai 2010 5:50 17
600
601
602
Options and sub-options in a menu; maximum total number 2 billions (2GB) of options and sub-options
Level of options in a menu: maximum number 2 billions (2 GB) of option levels
Caption of a menu option: maximum number of characters 2 billions (2GB) characters
Help message of the menu option: maximum number of charac- 2 billions (2GB) characters
ters
Processes of a menu option: maximum number of lines 65,500 lines
Tome1_2.book Page 603 Vendredi, 28. mai 2010 5:50 17
603
604
5.7 Limits regarding the analyses, the file descriptions and the items
605
5.8 Limits regarding the physical data files, the index files and the memo files
in HyperFileSQL format
Maximum size of: • If the operating system supports NTFS and if the
•Data file (*.FIC) partition supports NTFS: 233 GB
•Transaction file (*.FIC) • Otherwise: 2 GB.
•Log file (*JNL.FIC)
Index file (*.NDX): maximum size • If the operating system supports NTFS and if the
partition supports NTFS: 233 GB
• Otherwise: 2 GB.
Memo file (*.MMO): maximum size • If the operating system supports NTFS and if the
partition supports NTFS: 234 GB
• Otherwise: 4 GB.
Files open at the same time: maximum number Unlimited
Locked items per file: maximum number Unlimited
Records per file: maximum number • In Windows NT, 2000 and XP: depends on the
size of a record (for a 20-byte record: maximum
329 millions of billions records; for a 4,096-byte
record: maximum 2 millions of billions records)
• In Windows 95, 98 and me: depends on the size
of a record (for a 20-byte record: maximum 76
millions records; for a 4,096-byte record: maxi-
mum 523,000 records)
File password: maximum number of characters Unlimited
.REP file: maximum number of characters for the full name of the 255 characters
physical file
.REP file: maximum number of characters for the logical name of 255 characters
the file
606
Maximum size of the library file (".WDL" file) Available size on the disk (or up to 2 GB)
Maximum number of elements Unlimited
Maximum size of the executable program (".EXE" file) Available size on the disk (or up to 2 GB)
607
6. WEBDEV LIMITS
6.1 Limits regarding the project
608
butes
Options and sub-options in a menu; maximum total number 2 billions (2GB) of options and sub-options
Level of options in a menu: maximum number 2 billions (2 GB) of option levels
Sub-menu in a menu: maximum number 4 sub-menus
Caption of a menu option: maximum number of characters 2 billions (2GB) characters
Processes of a menu option: maximum number of lines 65,500 lines
Tome1_2.book Page 609 Vendredi, 28. mai 2010 5:50 17
609
610
6.7 Limits regarding the analyses, the file descriptions and the items
611
6.8 Limits regarding the physical data files, the index files and the memo files
in HyperFileSQL format
Maximum size of: • If the operating system supports NTFS and if the
•Data file (*.FIC) partition supports NTFS: 233 GB
•Transaction file (*.FIC) • Otherwise: 2 GB.
•Log file (*JNL.FIC)
Index file (*.NDX): maximum size • If the operating system supports NTFS and if the
partition supports NTFS: 233 GB
• Otherwise: 2 GB.
Memo file (*.MMO): maximum size • If the operating system supports NTFS and if the
partition supports NTFS: 234 GB
• Otherwise: 4 GB.
Files open at the same time: maximum number Unlimited
Locked items per file: maximum number Unlimited
Records per file: maximum number • In Windows NT, 2000 and XP: depends on the
size of a record (for a 20-byte record: maximum
329 millions of billions records; for a 4,096-byte
record: maximum 2 millions of billions records)
• In Windows 95, 98 and me: depends on the size
of a record (for a 20-byte record: maximum 76
millions records; for a 4,096-byte record: maxi-
mum 523,000 records)
File password: maximum number of characters Unlimited
.REP file: maximum number of characters for the full name of the 255 characters
physical file
.REP file: maximum number of characters for the logical name of 255 characters
the file
612
Maximum size of the library file (".WDL" file) Available size on the disk (or up to 2 GB)
Maximum number of elements Unlimited
Files included in the Maximum number 6000 files among the files proposed by
setup the setup wizard
2000 other files
WEB server Maximum number of installations of the same 1,000 Web servers
site (remote installation)
Scheduled installation Minimum delay between the creation of the ins- 5 minutes
tallation and the actual installation
Part 9: Appendices
613
INDEX
Symbols B Client
Types 334
614
615
616
617
618
619
620
Font
Item description
185
184
V WDCapture
WDCEDB
589
589
Link description 183 WDDeploy 146
Validate a page 277
Links 70 WDExplorer 589
Variable
Numeric 167 WDInst 587
Advanced type 173
Page 273 WDRegistry 589
Automation object 180
Reports 89 WDSESSION 96
Buffer type 168
Simple array 173 WDSQL 586
Composite variable 177
Sites 84 WDSynchro 589
Currency type 167
Time 169 WDTool 585
Data source 181
Variant 170 Web Server
Date type 169
Typer Dedicated 143
DateTime type 169
Duration 170 Web server
Duration type 170
Configuration 46
U Dynamic array
Dynamic automation object
174
180
WebDev
Deploying a site 140, 146
Dynamic structure 179
UMC 131, 265 PHP generation 135
File description 182
UML 63 WebDev Administrator
Fixed array 175
Activity diagram 65 Dynamic sites 148
Font 185
Class diagram 63 Test page 151
Global 189
Collaboration diagram 65 WebDev administrator 147
Integer type 167
Component diagram 64 Configuration 147
Item description 184
Deployment diagram 66 Connections 147
Link description 183
Object diagram 64 Development 147
Local 189
Sequence diagram 65 WebDev files 594
Numeric type 167
State-transition diagram 65 WebDev tools
Presentation 165
Use case diagram 64 WDDeploy 146
Scope rule 190
UML diagram WinDev 47
Simple array 173
Activity 65 JAVA generation 133
Simple type 165
Classes 63 Miscellaneous functions 359
Structure 178
Collaboration 65 Previous versions 46
Time type 169
Components 64 Setup 45
Variant type 170
Deployment 66 Start 56
Variant (Variable) 170
Objects 64 WinDev (Back Office) 558
Version
Sequence 65 WinDev component 115
Analysis 76
State-transitions 65 .WDO file 125
Page 86
Use case 64 Automatic documentation 123
Window 81
UML model 63 Creating 116
Version information 131
Unique key 500, 516, 517 Deploying an application 120
Version number 131
Index
621
Index
Tome1_2.book Page 622 Vendredi, 28. mai 2010 5:50 17
622
Index