Sie sind auf Seite 1von 622

Tome1_2.book Page 1 Vendredi, 28.

mai 2010 5:50 17

Programming
Tome1_2.book Page 2 Vendredi, 28. mai 2010 5:50 17

WinDev 15, WebDev 15, WinDev Mobile 15


Documentation version 15(1) - 0510

Remember to visit our site (www.windev.com) on a regular basis to find out whether upgraded versions are
available.

Email address of Free Technical Support: freetechnicalsupport@windev.com

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

PART 1 - OVERVIEW OF WINDEV, WEBDEV, WINDEV MOBILE

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.8.1 Distributing WinDev applications ..................................................................................................... 49


2.8.2 Deploying WebDev sites .................................................................................................................. 49
2.8.3 Distributing WinDev Mobile applications .......................................................................................... 49
2.9 Multilingual projects ..................................................................................................................49

PART 2 - CREATING AN APPLICATION, A SITE

1. CREATING AN APPLICATION OR A SITE 53


1.1 Creating a WinDev application ..................................................................................................53
1.2 Creating a WebDev site .............................................................................................................54
1.3 Creating a WinDev Mobile application .....................................................................................55
1.4 What is an application or a site? ...............................................................................................56
Tome1_2.book Page 4 Vendredi, 28. mai 2010 5:50 17

1.5 Starting WinDev, WebDev, WinDev Mobile .............................................................................. 56


1.5.1 Running WinDev ..............................................................................................................................56
1.5.2 Running WebDev .............................................................................................................................56
1.5.3 Running WinDev Mobile ...................................................................................................................56
1.5.4 Identification ...................................................................................................................................57

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

3. THE UML MODEL (OPTIONAL STEP) 63


3.1 Overview ....................................................................................................................................63
3.2 The various UML diagrams ....................................................................................................... 63
3.2.1 Class diagram..................................................................................................................................63
Programming

3.2.2 Use case diagram ............................................................................................................................64


3.2.3 Object diagram ................................................................................................................................64
3.2.4 Component diagram ........................................................................................................................64
3.2.5 Activity diagram ...............................................................................................................................65
3.2.6 Sequence diagram...........................................................................................................................65
3.2.7 Collaboration diagram .....................................................................................................................65
3.2.8 State-transition diagram ..................................................................................................................65
3.2.9 Deployment diagram .......................................................................................................................66

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

4.2.4 Creating a link................................................................................................................................. 68


4.3 Characteristics of the links defined in an analysis ....................................................................69
4.3.1 Owner file and member file .............................................................................................................. 69
4.3.2 Cardinalities ................................................................................................................................... 69
4.3.3 The advanced cardinalities .............................................................................................................. 70
4.3.4 Referential integrity ......................................................................................................................... 70
4.3.5 The different types of links ............................................................................................................... 70
4.4 Operations available on an analysis .........................................................................................71
4.4.1 Duplicating/Copying a LDM............................................................................................................. 71
4.4.2 Deleting a LDM ............................................................................................................................... 72
4.4.3 Renaming a LDM............................................................................................................................. 72
4.4.4 Associating a LDM with a project...................................................................................................... 72
4.4.5 Enlarging or reducing the display of a LDM ....................................................................................... 72
4.4.6 Moving the display of the LDM ......................................................................................................... 72
4.5 Handling a file in the data model editor ..................................................................................72
4.5.1 Duplicate/copy a file....................................................................................................................... 72
4.5.2 Deleting a file.................................................................................................................................. 72
4.5.3 Renaming a file ............................................................................................................................... 72
4.6 Handling an item ......................................................................................................................72
4.6.1 Duplicating/copying an item ........................................................................................................... 72
4.6.2 Deleting an item.............................................................................................................................. 73
4.6.3 Renaming an item........................................................................................................................... 73
4.7 Creating a CDM (Conceptual Data Model) ...............................................................................73
4.7.1 Creating a CDM............................................................................................................................... 73
4.7.2 Creating an entity ............................................................................................................................ 73
4.7.3 Creating an association................................................................................................................... 73
4.7.4 Creating a property.......................................................................................................................... 73
4.7.5 Creating a relationship .................................................................................................................... 73
4.7.6 Defining cardinalities ...................................................................................................................... 74
4.8 Main operations that can be performed on a CDM .................................................................74
4.8.1 Deleting a CDM............................................................................................................................... 74
4.8.2 Renaming a CDM ............................................................................................................................ 74
4.8.3 Modifying the display of a CDM........................................................................................................ 74
4.8.4 Moving the display of the CDM......................................................................................................... 74
Programming

4.9 Handling an entity ....................................................................................................................74


4.9.1 Duplicating/copying an entity.......................................................................................................... 74
4.9.2 Deleting an entity ............................................................................................................................ 74
4.9.3 Renaming an entity ......................................................................................................................... 74
Tome1_2.book Page 6 Vendredi, 28. mai 2010 5:50 17

4.10 Handling an association ......................................................................................................... 74


4.10.1 Duplicating/copying an association ...............................................................................................74
4.10.2 Deleting an association..................................................................................................................74
4.10.3 Renaming an association...............................................................................................................75
4.11 Handling a property ................................................................................................................. 75
4.11.1 Deleting a property ........................................................................................................................75
4.11.2 Renaming a property......................................................................................................................75
4.12 Generating the LDM from the CDM ........................................................................................ 75
4.13 Generating the analysis (LDM) ................................................................................................ 76
4.14 Managing the analysis versions .............................................................................................. 76
4.14.1 Restoring an analysis .....................................................................................................................76
4.14.2 Canceling the last generation .........................................................................................................76
4.14.3 Resetting the version number to 1 ..................................................................................................76

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

6.3.5 Modifying the tab order ....................................................................................................................80


6.3.6 Viewing a window in the 3 dimension mode ......................................................................................81
6.4 Managing a window’s versions .................................................................................................81
6.4.1 Saving a version...............................................................................................................................81
6.4.2 Opening a version ............................................................................................................................81
6.4.3 Deleting a version ............................................................................................................................82
6.4.4 Opening files after a system lockup...................................................................................................82

7. PAGES AND FRAMESETS 83


7.1 Overview ....................................................................................................................................83
7.1.1 Page types.......................................................................................................................................83
7.1.2 Site types ........................................................................................................................................84
7.1.3 Languages supported in a page........................................................................................................84
7.2 Creating a page ........................................................................................................................ 84
7.2.1 Creating blank pages .......................................................................................................................84
Tome1_2.book Page 7 Vendredi, 28. mai 2010 5:50 17

7.2.2 Creating preset pages ..................................................................................................................... 85


7.2.3 Creating the project pages by automatic site building (R.A.D.) .......................................................... 85
7.3 Simple operations on a page ...................................................................................................85
7.3.1 Opening a page............................................................................................................................... 85
7.3.2 Saving and copying a page.............................................................................................................. 85
7.3.3 Importing and exporting a page ....................................................................................................... 85
7.3.4 Modifying the tab order ................................................................................................................... 86
7.4 Managing a page’s versions ....................................................................................................86
7.4.1 Saving a version.............................................................................................................................. 86
7.4.2 Opening a version ........................................................................................................................... 86
7.4.3 Deleting a version ........................................................................................................................... 86
7.4.4 Opening files after a system lockup.................................................................................................. 86
7.5 Creating a frameset ..................................................................................................................87
7.5.1 Creating a blank frameset................................................................................................................ 87
7.5.2 Creating a preset frameset............................................................................................................... 87
7.6 Simple operations on a frameset or on a frame ......................................................................87
7.6.1 Associating a frame with a page....................................................................................................... 87
7.6.2 Opening a frameset......................................................................................................................... 87
7.6.3 Saving and copying a frameset ........................................................................................................ 87
7.6.4 Importing and exporting a frameset.................................................................................................. 87
7.6.5 Modifying the dimensions of a frame................................................................................................ 88
7.6.6 Adding a frame ............................................................................................................................... 88
7.6.7 Deleting a frame.............................................................................................................................. 88

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

9.4 Using the referencing wizard ................................................................................................... 91


9.5 Including a home page in your site .......................................................................................... 91
9.6 Listing your site in the search engines ...................................................................................... 91

10. TESTING AN APPLICATION, A SITE 92


10.1 Overview ...................................................................................................................................92
10.2 Running the test of a project and debugging it on the development computer ....................92
10.2.1 Overview....................................................................................................................................... 92
10.2.2 Running the test of the current project and debugging it ................................................................. 92
10.2.3 Running and debugging the executable on the development computer ........................................... 93
10.2.4 Debugging an executable that is already running on the development computer ............................. 93
10.2.5 Starting the debugger and stopping the test ................................................................................... 93
10.2.6 Configuring the test mode ............................................................................................................. 93
Tome1_2.book Page 8 Vendredi, 28. mai 2010 5:50 17

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

10.9.1 Debugging principles .................................................................................................................. 101


10.9.2 Overview of the debugger ............................................................................................................ 101
10.9.3 Starting the debugger ................................................................................................................. 101
10.9.4 Running code ............................................................................................................................. 102
10.9.5 Hierarchy of processes................................................................................................................ 102
10.9.6 Viewing the content of the variables............................................................................................. 102
10.9.7 Expression to evaluate ................................................................................................................ 102
10.9.8 Status Report ............................................................................................................................. 102
10.9.9 Debugging without the debugger ................................................................................................. 103
10.10 Performance test ..................................................................................................................104
10.10.1 Overview .................................................................................................................................. 104
10.10.2 Starting the performance profiler............................................................................................... 104
10.10.3 Saving or opening a statistics file .............................................................................................. 104
10.10.4 Reading the result of the performance profiler............................................................................ 104
10.10.5 Choosing a process to optimize................................................................................................. 104
Tome1_2.book Page 9 Vendredi, 28. mai 2010 5:50 17

10.10.6 Optimizing a process................................................................................................................. 105


10.11 Regression tests .................................................................................................................... 105
10.11.1 Overview................................................................................................................................... 105
10.11.2 Automatic tests......................................................................................................................... 105
10.11.3 WDTest..................................................................................................................................... 105
10.11.4 WDTestSite............................................................................................................................... 105
10.12 Debugging functions ............................................................................................................ 106

11. THE USER GROUPWARE 107


11.1 Overview ................................................................................................................................. 107
11.2 How does the user groupware work? ................................................................................... 107
11.2.1 The user level .............................................................................................................................. 107
11.2.2 The supervisor level..................................................................................................................... 107
11.3 Implementing the user groupware ........................................................................................ 108
11.3.1 Adding user groupware to an application ..................................................................................... 108
11.3.2 Running the test of the application .............................................................................................. 108
11.3.3 Creating the WinDev executable .................................................................................................. 109
11.3.4 Installing an application that uses user groupware ....................................................................... 109
11.4 Configuring the application that uses the user groupware ................................................... 109
11.4.1 Managing the users..................................................................................................................... 109
11.4.2 Managing the rights .................................................................................................................... 110
11.5 Tips for developing an application with user groupware ....................................................... 110
11.5.1 Using groups of controls .............................................................................................................. 110
11.5.2 Visibility of controls ..................................................................................................................... 110
11.5.3 Defining the rights....................................................................................................................... 110
11.6 User groupware elements ....................................................................................................... 110
11.6.1 WinDev windows ......................................................................................................................... 110
11.6.2 The WebDev pages...................................................................................................................... 111
11.6.3 The data files .............................................................................................................................. 111
11.7 Modifying user groupware ...................................................................................................... 112
11.7.1 Customizing the windows or pages of groupware .......................................................................... 112
11.7.2 User groupware and multilingual application................................................................................ 113
11.7.3 Modify the first window/page of the application according to the user........................................... 113
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

12. WINDEV/WEBDEV COMPONENTS 115


12.1 Overview .................................................................................................................................. 115
12.1.1 Definition.................................................................................................................................... 115
12.1.2 What is a component made of? ................................................................................................... 115
12.1.3 What is included in a component?............................................................................................... 115
Tome1_2.book Page 10 Vendredi, 28. mai 2010 5:50 17

10

12.2 Creating and generating a component ................................................................................. 116


12.2.1 Overview .................................................................................................................................... 116
12.2.2 Developing a component ............................................................................................................ 116
12.2.3 Creating a component................................................................................................................. 116
12.2.4 Advanced options of the component ........................................................................................... 116
12.2.5 Generating a component............................................................................................................. 117
12.3 Distributing a component ....................................................................................................... 118
12.3.1 Overview .................................................................................................................................... 118
12.3.2 Direct use of the component ....................................................................................................... 118
12.3.3 Simple distribution of a component............................................................................................. 118
12.3.4 Distribution via a setup procedure ............................................................................................... 119
12.4 Using a component in an application or in a site .................................................................. 119
12.4.1 Including the component in the project........................................................................................ 119
12.4.2 Handling a component in your programs...................................................................................... 119
12.4.3 Updating a component ............................................................................................................... 120
12.4.4 Creating the executable .............................................................................................................. 120
12.5 Deploying an application or a site that contains a component ............................................120
12.5.1 Updating the components and the deployed executables/sites.................................................... 120
12.5.2 Share a component among several applications/sites (on the same server) ................................. 121
12.6 Modifying a component ......................................................................................................... 121
12.6.1 Modifying a component .............................................................................................................. 121
12.6.2 Regenerating the modified component: managing compatibility between different versions .......... 122
12.6.3 The different types of compatibility .............................................................................................. 122
12.7 Advanced component settings ...............................................................................................123
12.7.1 Automatic documentation .......................................................................................................... 123
12.7.2 Visibility of a component element................................................................................................ 124
12.7.3 The WDO file ............................................................................................................................... 125
12.8 Managing components ("Wizards, Examples and Components" pane) ...............................126
12.8.1 What does the "Wizards, Examples and Components" pane contain? ......................................... 126
12.8.2 What actions can be performed from the "Wizards, Examples and Components" pane?............... 126

13. INTERNAL COMPONENT 127


13.1 Overview .................................................................................................................................127
Programming

13.2 Creating an internal component ............................................................................................127


13.2.1 The different steps ...................................................................................................................... 127
13.2.2 Modifications performed during the creation................................................................................ 128
13.2.3 Internal component and analysis: case of the full autonomy......................................................... 128
13.3 Sharing the internal components (via SCM) ...........................................................................128
13.3.1 Overview .................................................................................................................................... 128
13.3.2 Using an internal component found in SCM ................................................................................. 128
13.3.3 Handling a shared internal component ........................................................................................ 128

14. PROJECT DOCUMENTATION 129


14.1 Documentation of the complete project .................................................................................129
14.1.1 Type of documentation ............................................................................................................... 129
14.1.2 Content of the documentation..................................................................................................... 129
14.1.3 Cover of the documentation ........................................................................................................ 130
Tome1_2.book Page 11 Vendredi, 28. mai 2010 5:50 17

11

14.1.4 Edit mode of the documentation.................................................................................................. 130


14.2 Documentation of the current element ................................................................................. 130
14.2.1 Content of the documentation ..................................................................................................... 130
14.2.2 Edit mode of the documentation.................................................................................................. 130
14.3 Print areas ............................................................................................................................. 130
14.3.1 Overview..................................................................................................................................... 130
14.3.2 Print format................................................................................................................................. 130

15. CREATING THE EXECUTABLE 131


15.1 Creating the executable program of a WinDev application ................................................... 131
15.2 Creating the executable program of a WinDev Mobile application ..................................... 132
15.2.1 Splash screen............................................................................................................................. 132
15.2.2 Smartphone: Creating executable with file copy ........................................................................... 132

16. JAVA GENERATION 133


16.1 Overview ................................................................................................................................. 133
16.1.1 What is a Java application? ......................................................................................................... 133
16.1.2 Why develop a Java application with WinDev? ............................................................................. 133
16.1.3 Principle for generating a Java application with WinDev ............................................................... 133
16.2 Features of a Java project ..................................................................................................... 133
16.2.1 Creating a Java project ................................................................................................................ 133
16.2.2 JAVA RAD.................................................................................................................................... 133
16.2.3 Test of a Java project in the editor ................................................................................................ 134
16.2.4 Compiling a Java project in WinDev.............................................................................................. 134
16.2.5 Creating a Java archive................................................................................................................ 134
16.2.6 Deploying a Java application ....................................................................................................... 134

17. PHP GENERATION 135


17.1 Overview ................................................................................................................................. 135
17.1.1 What is a PHP site? ..................................................................................................................... 135
17.1.2 Why develop a PHP site with WebDev? ........................................................................................ 135
17.2 Features of a PHP project ...................................................................................................... 135
Programming

17.2.1 Creating a PHP project................................................................................................................. 135


17.2.2 PHP RAD..................................................................................................................................... 135
17.2.3 Testing a PHP site in the editor..................................................................................................... 135
17.2.4 Compiling a PHP site in WebDev .................................................................................................. 135
17.2.5 Deploying a PHP site ................................................................................................................... 135

18. DEPLOYING AN APPLICATION


WINDEV 136
18.1 Setup: Summary table ........................................................................................................... 136
18.1.1 Setup media............................................................................................................................... 136
18.1.2 Tools for creating the setup program ............................................................................................ 137
18.1.3 The different types of setup.......................................................................................................... 137
18.2 Creating the setup program .................................................................................................. 137
18.2.1 Creating a setup program ............................................................................................................ 138
Tome1_2.book Page 12 Vendredi, 28. mai 2010 5:50 17

12

18.2.2 Installing a WinDev application ................................................................................................... 138

19. DEPLOYING A WINDEV MOBILE APPLICATION 139


19.1 Creating the setup program ...................................................................................................139
19.2 Installing a WinDev Mobile application .................................................................................139

20. DEPLOYING A DYNAMIC SITE 140


20.1 Implementing a library ...........................................................................................................140
20.2 Remote deployment (via FTP) ................................................................................................140
20.2.1 The steps.................................................................................................................................... 140
20.2.2 Creating the setup ...................................................................................................................... 140
20.3 Deployment by deployment package ...................................................................................142
20.3.1 The steps.................................................................................................................................... 142
20.3.2 Creating the setup ...................................................................................................................... 142
20.3.3 Installing a dynamic site.............................................................................................................. 142
20.4 Deployment by physical media .............................................................................................142
20.4.1 Creating the setup ...................................................................................................................... 142
20.4.2 Installing the dynamic site on a Web server (physical media) ....................................................... 143
20.5 Taking the dynamic site live ..................................................................................................145

21. DEPLOYING A STATIC, SEMI-DYNAMIC OR PHP SITE 146


21.1 Overview .................................................................................................................................146
21.2 Creating the setup ..................................................................................................................146

22. THE WEBDEV ADMINISTRATOR 147


22.1 Overview .................................................................................................................................147
22.2 Interface of the WebDev administrator .................................................................................147
22.2.1 Characteristics of the current connections ................................................................................... 147
22.2.2 Sites installed............................................................................................................................. 148
22.2.3 General configuration ................................................................................................................. 148
Programming

22.2.4 Management .............................................................................................................................. 149


22.2.5 Advanced options....................................................................................................................... 149

23. SHARING A PROJECT 151


23.1 Overview ................................................................................................................................. 151
23.2 THE SOURCE CODE MANAGER .............................................................................................. 151
23.2.1 Overview .................................................................................................................................... 151
23.2.2 Principle..................................................................................................................................... 151
23.3 Creating a SCM database .....................................................................................................152
23.3.1 Overview .................................................................................................................................... 152
23.3.2 When should a source database be created? .............................................................................. 152
23.3.3 Converting an existing SCM database from HyperFileSQL Classic to HyperFileSQL Client/Server.... 152
23.3.4 Backups..................................................................................................................................... 153
23.4 Configuring the project to work with SCM ............................................................................153
23.4.1 Adding a project to SCM.............................................................................................................. 153
Tome1_2.book Page 13 Vendredi, 28. mai 2010 5:50 17

13

23.4.2 Sharing resources ....................................................................................................................... 154


23.5 Working with SCM ................................................................................................................ 154
23.5.1 Opening the project from SCM (1st project opening only) ............................................................. 154
23.5.2 Options of a project affecting SCM............................................................................................... 154
23.5.3 Checking out an element............................................................................................................. 155
23.5.4 Checking in an element ............................................................................................................... 155
23.5.5 Project management modes........................................................................................................ 155
23.5.6 Special case ............................................................................................................................... 156
23.6 Working in offline mode with the SCM ................................................................................. 156
23.6.1 Overview..................................................................................................................................... 156
23.6.2 Disconnecting from SCM ............................................................................................................. 156
23.6.3 Reconnecting to SCM.................................................................................................................. 157
23.7 SCM administrator ................................................................................................................ 157
23.7.1 Overview..................................................................................................................................... 157
23.7.2 Managing the SCM database ...................................................................................................... 157
23.7.3 Managing the files and the directories.......................................................................................... 157
23.7.4 Managing the files of the SCM database ...................................................................................... 158

PART 3 - BASIC SYNTAX OF WLANGUAGE

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

2.1.4 The different integer types.............................................................................................................. 167


2.1.5 The currency type .......................................................................................................................... 167
2.1.6 The numeric type........................................................................................................................... 167
2.1.7 The real type ................................................................................................................................. 167
2.1.8 The String type .............................................................................................................................. 168
2.1.9 The Buffer type .............................................................................................................................. 168
2.1.10 The date type .............................................................................................................................. 169
2.1.11 The time type .............................................................................................................................. 169
2.1.12 The DateTime type....................................................................................................................... 169
2.1.13 The Duration type........................................................................................................................ 170
2.1.14 The Variant type .......................................................................................................................... 170
2.2 Operations available for the dates, times and durations, … ................................................. 170
2.3 Managing the NULL value ....................................................................................................... 171
2.3.1 Null and the queries ...................................................................................................................... 171
2.3.2 Null and the variants ..................................................................................................................... 172
2.3.3 Null and the numeric values .......................................................................................................... 172
Tome1_2.book Page 14 Vendredi, 28. mai 2010 5:50 17

14

2.3.4 Null and the WLanguage functions ................................................................................................ 172


2.3.5 Null and the dynamic objects ........................................................................................................ 172
2.4 Constants .................................................................................................................................172
2.5 The advanced types ................................................................................................................173
2.5.1 Simple array ................................................................................................................................. 173
2.5.2 Dynamic array .............................................................................................................................. 174
2.5.3 Fixed array .................................................................................................................................... 175
2.5.4 Associative array........................................................................................................................... 176
2.5.5 Composite variable ....................................................................................................................... 177
2.5.6 Structure ...................................................................................................................................... 178
2.5.7 Dynamic structure......................................................................................................................... 179
2.5.8 Automation object ........................................................................................................................ 180
2.5.9 Dynamic Automation object .......................................................................................................... 180
2.5.10 Data source................................................................................................................................ 181
2.5.11 File description ........................................................................................................................... 182
2.5.12 Link description .......................................................................................................................... 183
2.5.13 Item description ......................................................................................................................... 184
2.5.14 Font ........................................................................................................................................... 185
2.5.15 Connection................................................................................................................................. 185
2.5.16 Queue ........................................................................................................................................ 186
2.5.17 List............................................................................................................................................. 187
2.5.18 Stack ......................................................................................................................................... 188
2.6 Local variables/global variables ..............................................................................................189
2.6.1 Global variable ............................................................................................................................. 189
2.6.2 Local variable ............................................................................................................................... 190
2.7 Rule for variable scope ............................................................................................................190

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

3.3 Arithmetic operators ................................................................................................................192


3.3.1 Overview....................................................................................................................................... 192
3.3.2 Calculation rules........................................................................................................................... 192
3.3.3 Notes ........................................................................................................................................... 192
3.4 Binary operators ......................................................................................................................192
3.4.1 Binary operators ........................................................................................................................... 192
3.4.2 Shift operators.............................................................................................................................. 192
3.4.3 Direct access operator .................................................................................................................. 193
3.5 Comparison operators .............................................................................................................194
3.5.1 Overview....................................................................................................................................... 194
3.5.2 Detail ........................................................................................................................................... 194
3.6 Operators on character strings ................................................................................................195
3.6.1 Flexible equality and very flexible equality ...................................................................................... 195
3.6.2 The [[ and ]] operator.................................................................................................................... 195
3.6.3 Operators on character strings and UNICODE................................................................................. 196
Tome1_2.book Page 15 Vendredi, 28. mai 2010 5:50 17

15

3.6.4 Position in a character string.......................................................................................................... 196


3.6.5 WLanguage functions.................................................................................................................... 196
3.7 Operator on address ............................................................................................................... 196
3.8 Indirection operators ............................................................................................................... 197
3.9 Miscellaneous operators ......................................................................................................... 198
3.9.1 The brackets ................................................................................................................................. 198
3.9.2 The square brackets ...................................................................................................................... 198
3.9.3 The comma................................................................................................................................... 198
3.9.4 The semicolon............................................................................................................................... 198
3.9.5 Colon............................................................................................................................................ 198
3.9.6 The dot ......................................................................................................................................... 199
3.9.7 The double dot .............................................................................................................................. 199
3.9.8 Triple dot ...................................................................................................................................... 199
3.9.9 The double slash........................................................................................................................... 199

4. WLANGUAGE STATEMENTS 200


4.1 Composite statements .............................................................................................................200
4.1.1 LOOP statement............................................................................................................................ 200
4.1.2 GOTO statement............................................................................................................................ 200
4.1.3 FOR statement .............................................................................................................................. 201
4.1.4 FOR EACH/FOR ALL statement, file browsing.................................................................................. 201
4.1.5 FOR EACH /FOR ALL statement, parsing strings.............................................................................. 204
4.1.6 FOR EACH/FOR ALL statement, parsing controls............................................................................. 205
4.1.7 FOR EACH/FOR ALL statement, array browsing............................................................................... 206
4.1.8 FOR EACH/FOR ALL statement, browsing associative arrays ........................................................... 207
4.1.9 SWITCH statement ........................................................................................................................ 208
4.1.10 IF statement ............................................................................................................................... 208
4.1.11 WHILE statement ........................................................................................................................ 209
4.2 Simple statements .................................................................................................................. 210
4.2.1 CONTINUE statement .................................................................................................................... 210
4.2.2 RETURN statement........................................................................................................................ 211
4.2.3 RESULT statement......................................................................................................................... 211
4.2.4 BREAK statement.......................................................................................................................... 212
Programming

5. RESERVED WORDS 213


5.1 External .................................................................................................................................... 213
5.2 MyWindow .............................................................................................................................. 214
5.3 MyPage ................................................................................................................................... 214
5.4 MySource ................................................................................................................................ 215
5.5 Modulo .................................................................................................................................... 215
5.6 MySelf ..................................................................................................................................... 215
5.7 MyPopupControl ..................................................................................................................... 216
5.8 MyReport ................................................................................................................................. 217
5.9 MyFile ...................................................................................................................................... 217
5.10 MyParent ............................................................................................................................... 217
5.11 STOP (calling the debugger) ................................................................................................... 218
Tome1_2.book Page 16 Vendredi, 28. mai 2010 5:50 17

16

6. PROCEDURE AND FUNCTION 219


6.1 Overview ...................................................................................................................................219
6.2 Global and local procedure/function ......................................................................................219
6.2.1 Definition...................................................................................................................................... 219
6.2.2 Global procedure .......................................................................................................................... 219
6.2.3 Local procedure............................................................................................................................ 220
6.3 Set of procedures ...................................................................................................................220
6.3.1 Definition...................................................................................................................................... 220
6.3.2 Creating a set of procedures.......................................................................................................... 221
6.3.3 Importing a set of procedures ........................................................................................................ 221
6.4 Declaring a procedure/function ..............................................................................................221
6.4.1 Syntax .......................................................................................................................................... 221
6.4.2 Exiting from a procedure................................................................................................................ 221
6.4.3 Returning a result.......................................................................................................................... 221
6.5 Calling a procedure/function ...................................................................................................221
6.6 Parameter of a procedure/function .......................................................................................222
6.6.1 Type of the parameters.................................................................................................................. 222
6.6.2 Passing parameters ...................................................................................................................... 222
6.6.3 Optional parameter....................................................................................................................... 223
6.6.4 Procedure with a variable number of parameters............................................................................ 223
6.7 Overloading a WLanguage function ......................................................................................224
6.7.1 Definition...................................................................................................................................... 224
6.7.2 How do I proceed?........................................................................................................................ 224
6.7.3 Differentiating between the WLanguage function and the custom function ...................................... 224

7. EXCEPTION MANAGEMENT 225


7.1 Overview ..................................................................................................................................225
7.1.1 Displaying a custom message ....................................................................................................... 225
7.1.2 Exception mechanism................................................................................................................... 225
7.2 General exception mechanism ...............................................................................................225
7.2.1 Overview....................................................................................................................................... 225
7.2.2 Declaration syntax ........................................................................................................................ 225
Programming

7.2.3 Declaring several general exception processes .............................................................................. 226


7.2.4 General notes ............................................................................................................................... 226
7.2.5 Special case................................................................................................................................. 227
7.3 Specific exception mechanism ...............................................................................................227
7.3.1 Overview....................................................................................................................................... 227
7.3.2 Declaration syntaxes..................................................................................................................... 227
7.4 Automated exception mechanism ......................................................................................... 227
7.4.1 Implementation ............................................................................................................................ 228
7.4.2 Running the error process ("CASE EXCEPTION:" in the code) ......................................................... 228
7.4.3 Running an exception process procedure....................................................................................... 228
7.5 Functions for managing the exceptions .................................................................................228
Tome1_2.book Page 17 Vendredi, 28. mai 2010 5:50 17

17

8. OBJECT-ORIENTED PROGRAMMING (OOP) 229


8.1 Overview of OOP (Object Oriented Programming) ..................................................................229
8.2 OOP concepts .........................................................................................................................229
8.2.1 Class ............................................................................................................................................ 229
8.2.2 Object........................................................................................................................................... 229
8.2.3 Constructor and destructor ............................................................................................................ 230
8.2.4 Inheritance ................................................................................................................................... 230
8.2.5 Data encapsulation....................................................................................................................... 230
8.3 Class, members and methods ................................................................................................230
8.3.1 Declaration of the class................................................................................................................. 230
8.3.2 Declaration of members ................................................................................................................ 231
8.3.3 Declaration of constants................................................................................................................ 231
8.3.4 Declaration of methods ................................................................................................................. 231
8.4 Constructor and destructor .....................................................................................................232
8.4.1 Constructor method ...................................................................................................................... 232
8.4.2 Destructor method ........................................................................................................................ 233
8.5 Object ......................................................................................................................................233
8.5.1 Declaring an object ....................................................................................................................... 233
8.5.2 The members of an object ............................................................................................................. 233
8.5.3 The methods of an object .............................................................................................................. 233
8.5.4 Lifespan of an object ..................................................................................................................... 234
8.6 Dynamic instantiation of an object .........................................................................................234
8.6.1 Declaring a dynamic object ........................................................................................................... 234
8.6.2 Instantiating a dynamic object....................................................................................................... 234
8.6.3 Freeing a dynamic object............................................................................................................... 234
8.7 Class inheritance .....................................................................................................................234
8.7.1 Syntax .......................................................................................................................................... 235
8.7.2 Redefining the methods ................................................................................................................ 235

PART 4 - MANAGING CONTROLS, WINDOWS AND PAGES


Programming

1. THE CONTROLS 239


1.1 The different types of controls of a window, page ..................................................................239
1.1.1 Types of controls available in WinDev............................................................................................. 239
1.1.2 Types of controls available in WebDev............................................................................................ 239
1.1.3 Types of controls available in WinDev Mobile.................................................................................. 239
1.2 Creating a control ....................................................................................................................240
1.2.1 Creating a new control................................................................................................................... 240
1.2.2 Creating a control associated with an item ..................................................................................... 240
1.2.3 Copy a control............................................................................................................................... 240
1.2.4 Deleting one or more controls ........................................................................................................ 241
1.3 Modifying a control’s settings .................................................................................................. 241
1.3.1 Displaying the characteristics ........................................................................................................ 241
1.3.2 Characteristics by tab.................................................................................................................... 241
Tome1_2.book Page 18 Vendredi, 28. mai 2010 5:50 17

18

1.3.3 Dynamic control, static control ...................................................................................................... 242


1.4 Handling the controls in the editor ..........................................................................................242
1.4.1 Controls’ handles.......................................................................................................................... 242
1.4.2 Selecting one or more controls ...................................................................................................... 242
1.4.3 Grouping selected controls............................................................................................................ 243
1.4.4 Moving a control ........................................................................................................................... 243
1.4.5 Using an off-window control .......................................................................................................... 243
1.4.6 Modifying the caption of a control.................................................................................................. 244
1.4.7 Tooltip of a control ........................................................................................................................ 244
1.5 Control alignment ....................................................................................................................244
1.5.1 The rulers...................................................................................................................................... 244
1.5.2 Snap-on grid................................................................................................................................. 245
1.5.3 Real-time interface checker........................................................................................................... 246
1.5.4 Advanced interface checker .......................................................................................................... 246
1.5.5 Alignment options......................................................................................................................... 246
1.5.6 The configurable zoom .................................................................................................................. 246
1.5.7 Positioning table (WebDev only).................................................................................................... 247
1.6 Control editing options in a window or a page ......................................................................247
1.6.1 Making a control visible/invisible .................................................................................................. 247
1.6.2 Locking/unlocking a control .......................................................................................................... 247
1.6.3 Framing or not a control ................................................................................................................ 247
1.7 Anchoring controls ................................................................................................................... 247
1.7.1 Anchoring a control in the editor .................................................................................................... 247
1.7.2 Anchoring a control in a tab........................................................................................................... 249
1.7.3 Anchoring a control in an area marked by a separator .................................................................... 249
1.7.4 Anchoring a selection of controls ................................................................................................... 249
1.7.5 Example for configuring the control anchors ................................................................................... 249
1.7.6 Anchoring a control by programming ............................................................................................. 249
1.8 General functions for handling the controls ............................................................................250

2. THE WINDOWS 252


2.1 Overview ..................................................................................................................................252
2.2 Main characteristics of a window ..........................................................................................252
Programming

2.3 Window and image ................................................................................................................253


2.3.1 Overview....................................................................................................................................... 253
2.3.2 Background colors ........................................................................................................................ 253
2.3.3 Background image........................................................................................................................ 253
2.3.4 Configuring the background image ................................................................................................ 253
2.3.5 Clipped window ............................................................................................................................ 255
2.4 Use the Windows XP look and theme ....................................................................................255
2.4.1 Using the theme of Windows XP..................................................................................................... 255
2.4.2 Using the XP style.......................................................................................................................... 255
2.5 The different types of windows ..............................................................................................256
2.5.1 Overview...................................................................................................................................... 256
2.5.2 MDI window.................................................................................................................................. 256
2.5.3 Non-MDI window (or free window) ................................................................................................. 257
Tome1_2.book Page 19 Vendredi, 28. mai 2010 5:50 17

19

2.6 Modal management of a window ..........................................................................................257


2.6.1 Overview....................................................................................................................................... 257
2.6.2 Opening a window......................................................................................................................... 257
2.6.3 Minimizing a window ..................................................................................................................... 257
2.6.4 Current window ............................................................................................................................. 257
2.6.5 Closing a window .......................................................................................................................... 257
2.7 Non-modal management of a window ..................................................................................257
2.7.1 Overview....................................................................................................................................... 257
2.7.2 Opening a window......................................................................................................................... 258
2.7.3 Overlaying windows....................................................................................................................... 259
2.7.4 Minimizing a window ..................................................................................................................... 259
2.7.5 Current window ............................................................................................................................. 259
2.7.6 Closing a child window or a sibling window..................................................................................... 259
2.8 Maximized and non-maximized window .............................................................................260
2.8.1 Maximized window ........................................................................................................................ 260
2.8.2 Non-maximized window................................................................................................................. 261
2.9 Automatic execution of a button ............................................................................................262
2.9.1 Implementation ............................................................................................................................ 262
2.9.2 Programming ................................................................................................................................ 262
2.9.3 AAF: Automatic Application Feature ............................................................................................... 262
2.10 Opening a "popup" window .................................................................................................262
2.10.1 Overview..................................................................................................................................... 262
2.10.2 Programming a popup window .................................................................................................... 263
2.10.3 Functions associated with the popup windows ............................................................................. 263
2.11 Dim the disabled windows .....................................................................................................263
2.11.1 Overview..................................................................................................................................... 263
2.11.2 DDW for all the application windows ............................................................................................ 263
2.11.3 DDW on a specific window........................................................................................................... 264
2.11.4 Configuration of the end-user computers ..................................................................................... 264
2.12 Internal window .....................................................................................................................264
2.12.1 Overview..................................................................................................................................... 264
2.12.2 Characteristics of an internal window........................................................................................... 264
2.12.3 Creating an internal window ........................................................................................................ 264
2.13 Window templates ................................................................................................................265
Programming

2.13.1 Overview..................................................................................................................................... 265


2.13.2 Creating a window template ........................................................................................................ 265
2.13.3 Applying a window template........................................................................................................ 265
2.14 User Macro-Code: UMC ........................................................................................................265
2.14.1 What is UMC? ............................................................................................................................. 265
2.14.2 How to enable/disable UMC? ..................................................................................................... 266
2.15 Managing the HyperFileSQL contexts in windows ................................................................266
2.15.1 What is a HyperFileSQL context? ................................................................................................. 266
2.15.2 Independent HyperFileSQL context .............................................................................................. 266
2.15.3 HyperFileSQL contexts and windows ............................................................................................ 267
2.16 Processes associated with the windows ...............................................................................268
2.16.1 Processes managed by default .................................................................................................... 268
2.16.2 Optional processes ..................................................................................................................... 269
2.17 Properties associated with windows .....................................................................................269
Tome1_2.book Page 20 Vendredi, 28. mai 2010 5:50 17

20

2.18 Functions for managing the windows ....................................................................................271


2.19 MDI functions ........................................................................................................................ 272

3. THE PAGES 273


3.1 Overview ..................................................................................................................................273
3.2 Main characteristics of a page ...............................................................................................273
3.3 The different types of pages ................................................................................................... 273
3.3.1 Static pages ................................................................................................................................. 273
3.3.2 Semi-dynamic pages .................................................................................................................... 274
3.3.3 Dynamic pages............................................................................................................................. 274
3.3.4 PHP pages.................................................................................................................................... 274
3.4 The page templates ................................................................................................................274
3.4.1 Overview....................................................................................................................................... 274
3.4.2 Creating a page template .............................................................................................................. 274
3.4.3 Applying a page template.............................................................................................................. 275
3.4.4 Opening the template associated with a page ................................................................................ 275
3.4.5 Applying the modifications performed on a template...................................................................... 275
3.5 Page with parameters ............................................................................................................275
3.5.1 Passing parameters to a page when it is opened ............................................................................ 275
3.5.2 Parameters passed by value.......................................................................................................... 275
3.5.3 Running the test of a page with parameters.................................................................................... 276
3.5.4 Scope of the parameters ............................................................................................................... 276
3.6 Refreshing a dynamic page ................................................................................................... 276
3.6.1 Overview....................................................................................................................................... 276
3.6.2 Implementation ............................................................................................................................ 276
3.7 The contexts of pages .............................................................................................................276
3.7.1 Overview....................................................................................................................................... 276
3.7.2 Operating mode............................................................................................................................ 276
3.8 Open a page in a WebDev site .............................................................................................. 277
3.8.1 Overview....................................................................................................................................... 277
3.8.2 Opening a page from a control description..................................................................................... 277
3.8.3 Opening a page by programming ................................................................................................... 277
3.8.4 Case of the dynamic pages ........................................................................................................... 277
Programming

3.9 Validate a page from a control with no action ...................................................................... 277


3.9.1 Overview....................................................................................................................................... 277
3.9.2 Principle ....................................................................................................................................... 277
3.9.3 Implementation ............................................................................................................................ 278
3.9.4 Example ....................................................................................................................................... 278
3.10 Processes associated with the pages ...................................................................................278
3.10.1 Processes managed by default.................................................................................................... 278
3.10.2 Optional processes ..................................................................................................................... 278
3.11 Properties associated with pages .......................................................................................... 279
3.12 Functions for managing the pages ....................................................................................... 279
Tome1_2.book Page 21 Vendredi, 28. mai 2010 5:50 17

21

4. MANAGING THE "BACK" BUTTON 281


4.1 Overview .................................................................................................................................. 281
4.1.1 There are two ways you can manage the browser "Back" button..................................................... 281
4.1.2 Example of desynchronization ....................................................................................................... 281
4.2 Disabling the "Back" button ...................................................................................................282
4.2.1 Operating mode ............................................................................................................................ 282
4.2.2 Implementation ............................................................................................................................ 282
4.3 Managing the synchronization ...............................................................................................282
4.3.1 Overview....................................................................................................................................... 282
4.3.2 Default synchronization................................................................................................................. 282
4.4 Synchronization by programming ..........................................................................................283

5. COMMUNICATING WITH THE USER 284


5.1 Overview ..................................................................................................................................284
5.2 The standard dialog boxes .....................................................................................................284
5.3 The advanced dialog boxes ...................................................................................................285
5.3.1 Overview....................................................................................................................................... 285
5.3.2 Directive questioning..................................................................................................................... 285
5.3.3 Immediate input ........................................................................................................................... 285
5.3.4 Message database........................................................................................................................ 285
5.4 Customizing the dialog boxes ................................................................................................285
5.4.1 Customizing the system information windows................................................................................. 286
5.4.2 Stop customizing the system information window........................................................................... 286
5.4.3 Multilingual dialog boxes............................................................................................................... 286
5.5 Automatically close the dialog boxes .....................................................................................286
5.6 Advanced communication with the user ................................................................................286
5.6.1 Overview....................................................................................................................................... 286
5.6.2 The available WLanguage functions ............................................................................................... 287
5.6.3 Managing a dialog with cells.......................................................................................................... 287
5.6.4 Managing a dialog with pages........................................................................................................ 287
5.6.5 Managing a dialog with YesNo and OKCancel ................................................................................. 288
5.7 Functions for managing the dialog boxes ..............................................................................288
Programming

6. THE POPUP MENUS 289


6.1 Window for editing the popup menus ....................................................................................289
6.2 Handling a custom popup menu ............................................................................................289
6.2.1 Creating a custom popup menu..................................................................................................... 289
6.2.2 Associating a custom popup menu with one or more elements (window or controls)........................ 290
6.2.3 Editing a custom popup menu ....................................................................................................... 290
6.2.4 Displaying the description window of a custom popup menu .......................................................... 291
6.2.5 Deleting a custom popup menu ..................................................................................................... 291
6.3 Handling a custom popup menu by programming ............................................................... 291
6.4 Default system popup menu ..................................................................................................292
6.4.1 Popup menu of the "Currency + Euro" controls.............................................................................. 293
Tome1_2.book Page 22 Vendredi, 28. mai 2010 5:50 17

22

7. THE MAIN MENUS 294


7.1 Overview ..................................................................................................................................294
7.1.1 Main menu in WinDev and WinDev Mobile ..................................................................................... 294
7.1.2 Main menus in WebDev................................................................................................................. 294
7.2 Vocabulary associated with the main menus ........................................................................294
7.3 Handling a window’s main menu ..........................................................................................294
7.3.1 Creating a main menu ................................................................................................................... 294
7.3.2 Editing a main menu ..................................................................................................................... 294
7.3.3 Deleting a main menu ................................................................................................................... 294
7.3.4 About menu.................................................................................................................................. 295
7.4 Handling a page’s main menu ...............................................................................................295
7.4.1 Creating a main menu ................................................................................................................... 295
7.4.2 Editing a main menu ..................................................................................................................... 295
7.4.3 Deleting a main menu ................................................................................................................... 295
7.5 Handling a main menu by programming ..............................................................................295

8. THE MENU OPTIONS 296


8.1 Characteristics of the menu options ........................................................................................296
8.1.1 Caption of a menu option.............................................................................................................. 296
8.1.2 Translating the menu options ........................................................................................................ 296
8.1.3 Marking/Unmarking a menu option ............................................................................................... 296
8.1.4 Image associated with a menu option............................................................................................ 297
8.1.5 Keyboard shortcut associated with a menu option ......................................................................... 297
8.1.6 Code of a menu option.................................................................................................................. 297
8.2 Handling the menu options in the editor ...............................................................................298
8.2.1 Adding a menu option................................................................................................................... 298
8.2.2 Add a separator ............................................................................................................................ 298
8.2.3 Add a sub-menu ........................................................................................................................... 298
8.2.4 Deleting a menu option ................................................................................................................. 298
8.3 Handling the menu options by programming .......................................................................298
8.3.1 WLanguage functions.................................................................................................................... 299
8.3.2 WLanguage properties .................................................................................................................. 300
Programming

9. THE STATUS BAR 301


9.1 Overview ...................................................................................................................................301
9.2 Description window of a status bar .........................................................................................301
9.2.1 Type of cell in the status bar .......................................................................................................... 301
9.2.2 Characteristics of a status bar cell ................................................................................................. 301
9.3 Programming a status bar .....................................................................................................302
9.3.1 Adding a cell to the status bar ....................................................................................................... 302
9.4 Properties associated with the cells of the status bars ..........................................................302
9.5 Functions associated with status bars ....................................................................................304

10. TODAY SCREEN 305


10.1 Overview ................................................................................................................................305
10.2 Create a today screen ...........................................................................................................305
Tome1_2.book Page 23 Vendredi, 28. mai 2010 5:50 17

23

10.3 Installing a today screen .......................................................................................................305


10.4 Activating a Today Screen .....................................................................................................306
10.5 Tips .........................................................................................................................................306

11. DRAG AND DROP MANAGEMENT 307


11.1 What is "Drag and Drop"? ......................................................................................................307
11.2 Automatic drag and drop ......................................................................................................307
11.2.1 Configuring the default drag and drop.......................................................................................... 307
11.2.2 Default behavior of Drag and Drop............................................................................................... 308
11.3 Programmed "Drag and Drop" ..............................................................................................308
11.3.1 Principle ..................................................................................................................................... 308
11.3.2 Programming .............................................................................................................................. 308
11.4 "Drag and Drop" from the explorer .......................................................................................309
11.4.1 Principle ..................................................................................................................................... 309
11.4.2 Functions specific to "Drag and Drop" from the explorer .............................................................. 309
11.4.3 Programming .............................................................................................................................. 309
11.5 Functions for managing Drag and Drop ................................................................................ 310

12. MULTILINGUAL APPLICATIONS AND SITES 311


12.1 Overview .................................................................................................................................. 311
12.2 Choosing the languages supported by the project and the analysis .................................... 311
12.2.1 Languages supported by the project ............................................................................................ 311
12.2.2 Languages supported by the analysis .......................................................................................... 312
12.2.3 Languages supported by the different project elements ................................................................ 312
12.3 Translating the interface into several languages .................................................................. 312
12.3.1 Selected translation mode .......................................................................................................... 312
12.3.2 Languages that use a specific character set ................................................................................. 313
12.3.3 Translating specific windows and pages....................................................................................... 313
12.3.4 Translating the messages found in the WLanguage code .............................................................. 314
12.4 Choosing the language by programming ............................................................................. 314
12.4.1 Defining the application language by programming ...................................................................... 314
12.5 Managing some specific character sets in the HyperFileSQL data files ............................... 315
Programming

12.5.1 Defining the character set of a data file ........................................................................................ 315


12.5.2 Changing the character set of a data file ...................................................................................... 316
12.5.3 Finding out the character set of a data file.................................................................................... 316
12.6 Functions for managing the multilingual feature .................................................................. 316

13. WINDOW, PAGE AND CONTROL PROPERTIES 317


Tome1_2.book Page 24 Vendredi, 28. mai 2010 5:50 17

24

PART 5 - STANDARD FUNCTIONS 323

1. HANDLING NUMERIC VALUES 325


1.1 Overview ..................................................................................................................................325
1.2 Matrices ...................................................................................................................................325
1.2.1 Definition...................................................................................................................................... 325
1.2.2 Handling matrices......................................................................................................................... 325
1.3 The statistics ............................................................................................................................325
1.4 Financial calculations ..............................................................................................................326
1.5 Functions for managing numeric values .................................................................................326
1.5.1 Miscellaneous functions ............................................................................................................... 326
1.5.2 Binary functions............................................................................................................................ 327
1.5.3 Matrix functions ............................................................................................................................ 327
1.5.4 Financial functions........................................................................................................................ 328
1.5.5 Statistical functions ...................................................................................................................... 328

2. HANDLING THE CHARACTER STRINGS 329


2.1 Handling the content of a string .............................................................................................329
2.2 WinDev and the Unicode format ............................................................................................329
2.2.1 What is the UNICODE format ......................................................................................................... 329
2.2.2 WinDev and Unicode..................................................................................................................... 329
2.3 Handling character strings in Pocket PC ................................................................................330
2.4 Functions for managing the character strings ........................................................................330

3. HANDLING THE DATES AND TIMES 332


3.1 Overview ..................................................................................................................................332
3.2 Different methods for handling the dates and times .............................................................332
3.3 Handling the dates and times found in the edit controls .......................................................332
3.4 Functions for managing the dates and times ........................................................................332
Programming

4. HANDLING THE CHARTS 334


4.1 Overview ..................................................................................................................................334
4.2 The different types of charts ...................................................................................................334
4.2.1 The "Pie" charts ........................................................................................................................... 334
4.2.2 The "Bar" charts .......................................................................................................................... 334
4.2.3 The "Line" charts ......................................................................................................................... 335
4.2.4 The "Scatter" charts..................................................................................................................... 335
4.2.5 The "Stock" charts ....................................................................................................................... 335
4.2.6 3D charts ..................................................................................................................................... 335
4.3 How do I create charts? .........................................................................................................336
4.3.1 Creating charts in the editors......................................................................................................... 336
4.3.2 Creating charts by programming .................................................................................................... 336
4.3.3 Charts and threads ....................................................................................................................... 336
4.3.4 Default values of a chart................................................................................................................ 336
Tome1_2.book Page 25 Vendredi, 28. mai 2010 5:50 17

25

4.4 Examples supplied with WinDev .............................................................................................336


4.5 Functions for managing charts ...............................................................................................337

5. MANAGEMENT OF THE EURO 339


5.1 Managing the Euro in an application or a site ........................................................................339
5.1.1 The tools available to the user........................................................................................................ 339
5.1.2 The solutions for the developer ...................................................................................................... 339
5.2 Currency + Euro type ..............................................................................................................339
5.2.1 Stored currency............................................................................................................................. 339
5.2.2 Input currency and display currency............................................................................................... 340
5.2.3 WinDev tooltip .............................................................................................................................. 340
5.2.4 WinDev dual display...................................................................................................................... 340
5.3 Creating an application or a site that manages the Euro ......................................................342
5.3.1 The different steps......................................................................................................................... 342
5.3.2 The Euro in your data files.............................................................................................................. 342
5.4 Properties linked to the Euro management ............................................................................342
5.5 Functions for Euro management ............................................................................................342

6. HANDLING THE MEMORY ZONES 343

7. HANDLING EXTERNAL FILES 344


7.1 Overview ..................................................................................................................................344
7.2 Handling the content of external files ....................................................................................344
7.3 Handling files ..........................................................................................................................344
7.4 Handling disks and their directories .......................................................................................344
7.5 Functions for managing external files ....................................................................................345

8. PRINTING IN WLANGUAGE 347


8.1 Overview ..................................................................................................................................347
8.2 Principle for printing in WLanguage .......................................................................................347
Programming

8.2.1 Step 1: Configuring the print parameters........................................................................................ 347


8.2.2 Step 2: Creating print fonts............................................................................................................ 348
8.2.3 Step 3: Printing ............................................................................................................................. 348
8.3 Printout functions ....................................................................................................................349

9. MANAGING MS WINDOWS 352


9.1 Overview ..................................................................................................................................352
9.2 Functions for managing the registry .......................................................................................352
9.3 Functions for managing the clipboard ...................................................................................352
9.4 Functions for managing the recycle bin .........................................................................353
9.5 Functions for managing the mouse ........................................................................................353
9.6 Functions for managing the serial and parallel ports ............................................................353
9.7 Functions for managing the Twain devices ............................................................................354
9.8 USB functions ..........................................................................................................................355
Tome1_2.book Page 26 Vendredi, 28. mai 2010 5:50 17

26

9.9 MCI functions ..........................................................................................................................355


9.10 Service functions ...................................................................................................................356
9.11 System functions ....................................................................................................................356
9.12 Miscellaneous Windows functions ........................................................................................ 357
9.13 Windows event ......................................................................................................................358
9.14 Java functions .......................................................................................................................358
9.15 Miscellaneous WinDev/WebDev functions ...........................................................................359
9.16 Functions for managing the executables ...............................................................................361
9.17 Functions for DDE management ...........................................................................................362
9.18 Functions for managing the agents ......................................................................................362
9.19 Functions for managing the networks ..................................................................................363
9.20 Functions for managing the SNMP protocol ........................................................................363
9.21 Functions for managing the projects ....................................................................................364
9.22 Functions for managing the scheduler .................................................................................364

10. HANDLING YOUR XLS FILES 365


10.1 Overview ................................................................................................................................365
10.2 XLS functions .........................................................................................................................366

11. THE ARCHIVES 367


11.1 Overview .................................................................................................................................367
11.2 Handling the archives ............................................................................................................367
11.3 The single-part and multi-part archives ................................................................................368
11.3.1 Overview .................................................................................................................................... 368
11.3.2 Principle .................................................................................................................................... 368
11.3.3 Examples ................................................................................................................................... 368
11.4 Archiving functions .................................................................................................................368

12. BURNING A CD OR A DVD 370


12.1 Overview ................................................................................................................................ 370
Programming

12.2 Burning a CD/DVD ................................................................................................................370


12.3 Burner functions .....................................................................................................................371

13. FUNCTIONS FOR ACCESSING A POCKET PC 372

14. FUNCTIONS SPECIFIC TO WINDEV MOBILE 374


14.1 WinDev Mobile and SIM cards .............................................................................................. 374
14.1.1 Overview .................................................................................................................................... 374
14.1.2 Required configuration................................................................................................................ 374
14.1.3 Operating mode in GO mode and at run time ............................................................................... 374
14.1.4 WLanguage functions ................................................................................................................. 374
14.2 Pocket keyboard ................................................................................................................... 374
14.2.1 Overview .................................................................................................................................... 374
14.2.2 WLanguage functions ................................................................................................................. 374
Tome1_2.book Page 27 Vendredi, 28. mai 2010 5:50 17

27

PART 6 - FEATURES SPECIFIC TO THE WEB

1. FILE UPLOAD 377


1.1 Overview ...................................................................................................................................377
1.2 Implementing the upload in a WebDev site ............................................................................377
1.2.1 Available elements........................................................................................................................ 377
1.2.2 Uploading a file into a page ........................................................................................................... 377
1.2.3 Displaying the image to upload...................................................................................................... 377

2. FILE DOWNLOAD 378


2.1 Overview ..................................................................................................................................378
2.2 Implementing file download in a WebDev site ......................................................................378
2.2.1 Using the description window of controls (button, link,…) ............................................................... 378
2.2.2 Programming ................................................................................................................................ 378
2.2.3 forcing the file download ............................................................................................................... 378

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. VALIDITY OF A SITE’S PAGES 381


4.1 Overview .................................................................................................................................. 381
4.2 How do I proceed? ................................................................................................................. 381
4.2.1 Defining the validity period of pages .............................................................................................. 381
4.2.2 Deleting the validity period ............................................................................................................ 381
4.2.3 Configuring the Windows application server to manage the validity period....................................... 381
Programming

4.2.4 Configuring the Linux application server to manage the validity period............................................. 381

5. INCLUDING JAVASCRIPT FILES OR A WEB RESOURCE 382


5.1 Overview ..................................................................................................................................382
5.2 How do I proceed? .................................................................................................................382
5.2.1 Including Javascript files (.js)......................................................................................................... 382
5.2.2 To include a Javascript file in a page: ............................................................................................. 382
5.2.3 To include a Javascript file in the project:........................................................................................ 382
5.2.4 Including resources external to the site .......................................................................................... 382
5.2.5 To include an external resource in a page: ...................................................................................... 382
5.2.6 To include an external resource in the project: ................................................................................ 382
5.2.7 Automatic detection of the encoding.............................................................................................. 382
5.3 Handling external Javascript objects from the WLanguage ..................................................383
Tome1_2.book Page 28 Vendredi, 28. mai 2010 5:50 17

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

7. VISTA GADGETS 389


7.1 Overview ..................................................................................................................................389
7.2 Creating the gadget ...............................................................................................................389
7.2.1 The steps...................................................................................................................................... 389
7.2.2 Generating the gadget................................................................................................................... 389
7.3 Programming the Vista gadgets .............................................................................................390
7.3.1 Overview....................................................................................................................................... 390
7.3.2 The different types of pages........................................................................................................... 390
7.3.3 The WLanguage functions.............................................................................................................. 391

8. SSL: SECURE TRANSATIONS 392


8.1 Overview ..................................................................................................................................392
8.2 Implementing secure transactions with the SSL protocol ......................................................392
8.3 Creating and installing an SSL certificate for IIS2 (2.0 or later) ..............................................392
8.3.1 Step 1: Creating a certificate ......................................................................................................... 392
8.3.2 Step 2: Requesting a certificate..................................................................................................... 392
8.3.3 Step 3: Certification of the certificate on the server......................................................................... 393
8.4 Inserting secure transactions (SSL) into a WebDev site ..........................................................393
Programming

8.4.1 Principle ....................................................................................................................................... 393


8.4.2 Implementation ............................................................................................................................ 393
8.4.3 Going back to normal mode (non-secure transaction) in the current browser................................... 394

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

2. COMMUNICATING BY EMAILS 401


2.1 Overview .................................................................................................................................. 401
2.1.1 Email management....................................................................................................................... 401
2.1.2 Synchronous/Asynchronous mode (WebDev only)......................................................................... 401
2.2 Managing emails via the POP3/SMTP protocols .................................................................... 401
2.2.1 Principle ....................................................................................................................................... 401
2.2.2 Step 1 (WinDev Mobile only): connecting the Pocket PC to a PC...................................................... 403
2.2.3 Step 2: Connect to the access provider (WinDev and WinDev Mobile only) ...................................... 403
2.2.4 Step 3: Starting an email session................................................................................................... 403
2.2.5 Step 4: Reading emails ................................................................................................................. 403
2.2.6 Step 5: Sending emails ................................................................................................................. 403
2.2.7 Step 6: Closing the message session ............................................................................................. 403
2.2.8 Step 5: Closing the connection ...................................................................................................... 404
2.3 Managing emails with "Simple MAPI" (WinDev and WebDev) ..............................................404
2.3.1 Principle ....................................................................................................................................... 404
2.3.2 Step 1: Creating a user profile........................................................................................................ 404
2.3.3 Step 2: Starting an email session................................................................................................... 405
2.3.4 Step 3: Sending emails ................................................................................................................. 405
2.3.5 Step 4: Reading emails ................................................................................................................. 406
2.3.6 Step 5: Ending the session ............................................................................................................ 406
2.4 Manage the emails via CEMAPI (WinDev Mobile only) ..........................................................407
2.5 Writing an email .....................................................................................................................407
2.5.1 The different steps......................................................................................................................... 407
2.5.2 Example ....................................................................................................................................... 407
2.5.3 Using the EML format to customize the emails................................................................................ 407
Programming

2.6 Reading an email ....................................................................................................................408


2.6.1 The different steps......................................................................................................................... 408
2.6.2 Example ....................................................................................................................................... 408
2.7 The email structure .................................................................................................................408
2.7.1 The different variables of the email structure .................................................................................. 408
2.7.2 Which functions use the email structure?....................................................................................... 410
2.7.3 The Email.Error variable................................................................................................................. 410
2.8 Email management functions ................................................................................................. 410

3. ACCESSING LOTUS NOTES AND OUTLOOK 412


3.1 Accessing Lotus Notes ............................................................................................................. 412
3.1.1 Overview....................................................................................................................................... 412
3.1.2 Method for accessing Lotus Notes ................................................................................................. 412
3.1.3 Quick method if you do not want to access the documents ............................................................. 412
Tome1_2.book Page 30 Vendredi, 28. mai 2010 5:50 17

30

3.1.4 Handling the data ......................................................................................................................... 412


3.2 Accessing Outlook ..................................................................................................................412
3.2.1 Overview....................................................................................................................................... 412
3.2.2 Method for accessing Outlook ....................................................................................................... 412
3.2.3 Sending and receiving emails........................................................................................................ 412
3.2.4 Version of Outlook......................................................................................................................... 413
3.2.5 Handling the data ......................................................................................................................... 413
3.3 Lotus Notes and Outlook functions ..........................................................................................413
3.3.1 Email functions for Lotus Notes ..................................................................................................... 413
3.3.2 Email functions for Outlook ........................................................................................................... 414
3.3.3 Task functions............................................................................................................................... 415
3.3.4 Appointment functions.................................................................................................................. 415
3.3.5 Contact functions.......................................................................................................................... 416
3.3.6 Group functions ............................................................................................................................ 416
3.3.7 Notes functions ............................................................................................................................ 417

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

4.4 Managing the Google documents .........................................................................................423


4.4.1 Overview....................................................................................................................................... 423
4.4.2 How do I manage the Google documents? ..................................................................................... 424
4.5 Using the Google Maps service ..............................................................................................424
4.5.1 Overview....................................................................................................................................... 424
4.5.2 How do I proceed?........................................................................................................................ 424
4.5.3 Other services............................................................................................................................... 425
4.5.4 Functions for managing the Google maps ...................................................................................... 425

5. GOOGLE ADWORDS 426


5.1 Management of accounts .......................................................................................................426
5.1.1 Overview....................................................................................................................................... 426
5.1.2 How do I manage a Google AdWords account? .............................................................................. 426
5.2 .Ad group management .........................................................................................................426
Tome1_2.book Page 31 Vendredi, 28. mai 2010 5:50 17

31

5.2.1 Overview....................................................................................................................................... 426


5.2.2 How do I proceed? ........................................................................................................................ 427
5.3 Ad management .....................................................................................................................427
5.3.1 Overview....................................................................................................................................... 427
5.3.2 How do I proceed? ........................................................................................................................ 428
5.4 Management of campaigns ...................................................................................................429
5.4.1 Overview....................................................................................................................................... 429
5.4.2 How do I proceed? ........................................................................................................................ 429
5.5 Management of criteria ..........................................................................................................429
5.5.1 Overview....................................................................................................................................... 429
5.5.2 How do I proceed? ........................................................................................................................ 429
5.6 Managing the function cost ....................................................................................................430
5.6.1 Overview....................................................................................................................................... 430
5.6.2 WLanguage functions.................................................................................................................... 430
5.7 Management of keyword suggestions ...................................................................................430
5.7.1 Overview....................................................................................................................................... 430
5.7.2 How do I proceed? ........................................................................................................................ 430
5.8 Report management ............................................................................................................... 431
5.8.1 Overview....................................................................................................................................... 431
5.8.2 How do I proceed? ........................................................................................................................ 431
5.9 Management of site suggestions ........................................................................................... 431
5.9.1 Overview....................................................................................................................................... 431
5.9.2 How do I proceed? ........................................................................................................................ 431
5.10 Management of traffic estimates ..........................................................................................432
5.10.1 Overview..................................................................................................................................... 432
5.10.2 How do I proceed? ...................................................................................................................... 432
5.11 Google AdWords functions ....................................................................................................433

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

7. RSS STREAM 437


7.1 Overview ..................................................................................................................................437
7.2 How do I procee? ....................................................................................................................437
7.3 Functions for managing the RSS streams ...............................................................................437

8. LDAP SERVER 438


8.1 Overview ..................................................................................................................................438

9. WINDEV AND TELEPHONY 439


9.1 Overview .................................................................................................................................439
9.2 Managing the incoming calls .................................................................................................439
Tome1_2.book Page 32 Vendredi, 28. mai 2010 5:50 17

32

9.2.1 The different steps ........................................................................................................................ 439


9.2.2 Example ....................................................................................................................................... 440
9.3 Managing the outgoing calls ..................................................................................................441
9.3.1 The different steps ........................................................................................................................ 441
9.3.2 Handling an outgoing call.............................................................................................................. 442
9.4 Telephony functions ................................................................................................................442

10. MANAGING SMSS 444


10.1 Overview ................................................................................................................................444
10.2 The SMS structure .................................................................................................................444
10.2.1 Overview .................................................................................................................................... 444
10.2.2 The variables of the SMS structure............................................................................................... 444
10.2.3 Reading and deleting SMSs on Smartphone ................................................................................ 444
10.2.4 Managing the different types of numbers ..................................................................................... 445
10.2.5 Operating mode in GO mode and at run time ............................................................................... 445
10.3 WLanguage functions ...........................................................................................................445

11. SENDING FAXES 446


11.1 Overview .................................................................................................................................446
11.2 Configuring the "fax server" ..................................................................................................446
11.2.1 Configuring the current computer ................................................................................................ 446
11.2.2 Configuring the fax server in Windows 2000................................................................................. 446
11.2.3 Configuring the fax server in Windows XP ..................................................................................... 446
11.3 Fax sending application or site ..............................................................................................447
11.3.1 Sending a fax from an application or a site................................................................................... 447
11.3.2 Sending a fax created with the report editor ................................................................................. 447
11.4 Configuring the fax server by programming ......................................................................... 447
11.4.1 Options of the fax server.............................................................................................................. 447
11.4.2 Tips ............................................................................................................................................ 448
11.5 Functions for managing the faxes .........................................................................................448

12. WORKING WITH A PALM PILOT 449


Programming

12.1 Overview ................................................................................................................................449


12.1.1 PC and Palm Pilot ....................................................................................................................... 449
12.1.2 WinDev and Palm Pilot................................................................................................................ 449
12.2 Modifying the data of a Palm Pilot .......................................................................................449
12.2.1 First possibility: Adding, modifying and deleting data ................................................................... 449
12.2.2 Second Possibility: Inserting data directly from a HyperFileSQL database ..................................... 451
12.3 The Palm structure ................................................................................................................452
12.3.1 Palm structure used by the Notepad............................................................................................ 452
12.3.2 Palm structure used for the task list ............................................................................................. 452
12.3.3 Palm structure used for the address book .................................................................................... 453
12.3.4 Palm structure used for the calendar ........................................................................................... 455
12.4 Read the data of a Palm Pilot ...............................................................................................457
12.4.1 Principle..................................................................................................................................... 457
12.4.2 The different steps ...................................................................................................................... 458
Tome1_2.book Page 33 Vendredi, 28. mai 2010 5:50 17

33

12.5 PALM functions ......................................................................................................................459

13. RETRIEVING HTML PAGES 460


13.1 Overview .................................................................................................................................460
13.2 HTTP functions .......................................................................................................................460

14. MANAGING FILES ON THE INTERNET 461


14.1 Overview ................................................................................................................................. 461
14.1.1 Uploading and downloading files via WinDev FTP or RPC: rules to follow........................................ 461
14.1.2 Other features............................................................................................................................. 461
14.2 Detailed use of WinDev FTP/RPC ........................................................................................... 461
14.2.1 Step 1: establishing a connection with a WinDev RPC/FTP server.................................................. 461
14.2.2 Step 2: uploading a file onto a WinDev FTP server......................................................................... 461
14.2.3 Step 3: downloading a file from a WinDev FTP server .................................................................... 462
14.2.4 Step 4: Closing a connection with a WinDev RPC/FTP server......................................................... 462
14.3 Net functions ..........................................................................................................................463

15. COMMUNICATING WITH AN FTP SERVER 464


15.1 Handling files on a RPC server ...............................................................................................464
15.1.1 Overview..................................................................................................................................... 464
15.1.2 FTP ............................................................................................................................................. 464
15.1.3 Principle ..................................................................................................................................... 464
15.1.4 Relative path/absolute path........................................................................................................ 464
15.1.5 Example ..................................................................................................................................... 465
15.2 FTP functions ..........................................................................................................................465

16. SOCKET MANAGEMENT 466


16.1 Overview .................................................................................................................................466
16.1.1 Different possibilities .................................................................................................................. 466
16.1.2 Example ..................................................................................................................................... 466
16.2 Client WinDev application/Client WebDev site .....................................................................466
Programming

16.2.1 Principle of a client application or a client site.............................................................................. 466


16.2.2 Transmission mode of information............................................................................................... 467
16.3 "Simplified Server" WinDev application ................................................................................467
16.3.1 Simplified server ......................................................................................................................... 467
16.3.2 Transmission mode of information............................................................................................... 468
16.4 Standard socket server ..........................................................................................................468
16.4.1 The standard socket server .......................................................................................................... 468
16.4.2 Transmission mode of information............................................................................................... 469
16.5 Socket functions ....................................................................................................................470

17. MANAGING THE BLUETOOTH KEYS 471


17.1 Overview ................................................................................................................................. 471
17.2 How do I proceed? ................................................................................................................ 471
17.3 Which keys should be used? ................................................................................................. 471
Tome1_2.book Page 34 Vendredi, 28. mai 2010 5:50 17

34

17.4 The Bluetooth and OBEX functions ........................................................................................ 472


17.4.1 Bluetooth functions .................................................................................................................... 472
17.4.2 OBEX functions ........................................................................................................................... 472

18. THREAD MANAGEMENT 473


18.1 Overview ................................................................................................................................ 473
18.1.1 From simple thread management to complex thread management............................................... 473
18.1.2 Example ..................................................................................................................................... 473
18.2 Thread use principle ..............................................................................................................473
18.2.1 Simple management of threads .................................................................................................. 473
18.2.2 Characteristics of the threads...................................................................................................... 473
18.2.3 Access to existing elements and HyperFileSQL context ................................................................. 474
18.2.4 Limits of the processes performed by the thread .......................................................................... 474
18.3 Managing the semaphores in the threads ........................................................................... 474
18.3.1 Principle..................................................................................................................................... 474
18.3.2 Implementing a semaphore ........................................................................................................ 475
18.3.3 Limited Semaphore: Critical Section............................................................................................ 475
18.4 Using signals to synchronize the threads ............................................................................. 476
18.4.1 Simple management of signals ................................................................................................... 476
18.4.2 Advanced management of signals............................................................................................... 476
18.5 Managing the opening of a WinDev window in a secondary thread .................................. 477
18.5.1 Opening a window from a secondary thread................................................................................. 477
18.5.2 Example ..................................................................................................................................... 477
18.6 Functions for managing the threads .....................................................................................478

19. SOAP 479


19.1 Overview ................................................................................................................................ 479
19.1.1 WinDev/WebDev and the SOAP protocol ..................................................................................... 479
19.1.2 Example ..................................................................................................................................... 479
19.2 Running procedures on a SOAP server .................................................................................479
19.2.1 Principle..................................................................................................................................... 479
19.2.2 The SOAP structure ..................................................................................................................... 480
Programming

19.3 Creating and installing a WinDev SOAP server application .................................................480


19.3.1 Principle..................................................................................................................................... 480
19.3.2 How do I create a SOAP server application?................................................................................. 481
19.3.3 Installing a SOAP server with Apache ........................................................................................... 481
19.3.4 Installing a SOAP server with IIS .................................................................................................. 481
19.3.5 Installing a SOAP server with Netscape iPlanet 4.1....................................................................... 482
19.3.6 Configuring the SOAP administrator............................................................................................. 482
19.4 SOAP functions ......................................................................................................................483
Tome1_2.book Page 35 Vendredi, 28. mai 2010 5:50 17

35

20. .NET XML WEB SERVICES SERVER 484


20.1 Running procedures on a server of .Net services ..................................................................484
20.1.1 Overview..................................................................................................................................... 484
20.1.2 Principle ..................................................................................................................................... 484
20.2 .Net structure ........................................................................................................................484
20.3 .Net functions ........................................................................................................................485

21. J2EE XML WEB SERVICES SERVER 486


21.1 Running procedures on a server of J2EE services ..................................................................486
21.1.1 Overview..................................................................................................................................... 486
21.1.2 Principle ..................................................................................................................................... 486
21.2 J2EE structure .........................................................................................................................486
21.3 J2EE functions ........................................................................................................................487

22. XML WEB SERVICES 488


22.1 Importing XML Web services .................................................................................................488
22.1.1 Importing an XML Web service into a WinDev/WebDev project...................................................... 488
22.1.2 Using the set of procedures of the XML Web service...................................................................... 488
22.1.3 Distributing a WinDev application or a WebDev site that uses an XML Web service ........................ 488
22.2 Generating an XML Web service ..........................................................................................489
22.2.1 How do I implement an XML Web service? ................................................................................... 489
22.2.2 Installing a SOAP server with Apache ........................................................................................... 490
22.2.3 Installing a SOAP server with IIS................................................................................................... 490
22.2.4 Installing a SOAP server with Netscape iPlanet 4.1....................................................................... 491
22.2.5 Configuring the SOAP administrator ............................................................................................. 491

23. XML 492


23.1 Managing XML documents ...................................................................................................492
23.1.1 Overview..................................................................................................................................... 492
23.1.2 Definition.................................................................................................................................... 492
23.1.3 Principle ..................................................................................................................................... 492
Programming

23.2 Functions for managing the XML documents .......................................................................492

24. .NET ASSEMBLIES 494


24.1 Overview ................................................................................................................................494
24.1.1 Definition.................................................................................................................................... 494
24.1.2 WinDev and .NET......................................................................................................................... 494
24.2 Conditions for using a .NET assembly ..................................................................................494
24.2.1 Install the .NET framework ........................................................................................................... 494
24.2.2 Define the .NET security level....................................................................................................... 494
24.2.3 Making the DLLs required to run the .NET assembly accessible ..................................................... 494
24.3 Creating a .NET assembly from WinDev ...............................................................................495
24.4 Creating a .NET assembly accessible by COM .....................................................................496
24.4.1 Overview..................................................................................................................................... 496
24.4.2 Creating a .NET assembly accessible by COM from a WinDev project............................................. 496
Tome1_2.book Page 36 Vendredi, 28. mai 2010 5:50 17

36

24.5 Creating the setup program of a .NET assembly .................................................................496


24.6 Using .NET assemblies in a WinDev application ..................................................................496

PART 8 - MANAGING DATA FILES

1. FILE MANAGEMENT 499


1.1 HyperFileSQL file management ...............................................................................................499
1.1.1 Create a file .................................................................................................................................. 499
1.1.2 Opening and closing files .............................................................................................................. 499
1.1.3 Management of the HyperFileSQL data files over 2 GB ................................................................... 500
1.1.4 Key management.......................................................................................................................... 500
1.1.5 Composite key management......................................................................................................... 502
1.1.6 Accessing file records ................................................................................................................... 503
1.1.7 Schemas: the form mode and the table mode................................................................................ 508
1.1.8 Moving and positioning inside a file ............................................................................................... 508
1.2 FoxPro xBase format files ........................................................................................................508
1.2.1 Overview....................................................................................................................................... 508
1.2.2 Using the native xBase/FoxPro access........................................................................................... 508
1.2.3 Importing the structure of the files ................................................................................................. 508
1.2.4 Important programming points ...................................................................................................... 509
1.3 Data files found on a Pocket PC ...............................................................................................510
1.3.1 Handling a HyperFileSQL Mobile database .................................................................................... 510
1.3.2 Handling a CEDB database ........................................................................................................... 510
1.3.3 Functions for handling a CEDB database ....................................................................................... 511

2. ADVANCED FEATURES 513


2.1 Alias management ...................................................................................................................513
2.1.1 Several physical files with identical logical description ................................................................... 513
2.1.2 Several logical files linked to a single physical file .......................................................................... 514
Programming

2.1.3 Functions for managing aliases ..................................................................................................... 514


2.1.4 Create an alias on what?............................................................................................................... 514
2.1.5 Characteristics of an alias ............................................................................................................. 514
2.1.6 Handling the alias file and its items ............................................................................................... 514
2.2 Managing the NULL value in HyperFileSQL .............................................................................514
2.2.1 How to manage the Null value in your items? ................................................................................. 514
2.2.2 How can I use the NULL value in my applications? ......................................................................... 515
2.3 File protection and encryption .................................................................................................516
2.3.1 The protection possibilities............................................................................................................ 516
2.3.2 Managing encrypted files .............................................................................................................. 516
2.4 Managing an identifier ............................................................................................................516
2.4.1 Automatic management................................................................................................................ 516
2.4.2 Manual management.................................................................................................................... 516
2.4.3 Testing a key uniqueness .............................................................................................................. 517
2.5 Automatic control of the referential integrity ..........................................................................517
Tome1_2.book Page 37 Vendredi, 28. mai 2010 5:50 17

37

2.5.1 Benefit of the referential integrity check ......................................................................................... 517


2.5.2 Definitions .................................................................................................................................... 517
2.5.3 The different types of links ............................................................................................................. 517
2.5.4 Programming the referential integrity automatic check.................................................................... 517
2.6 Managing "memo" files ......................................................................................................... 519
2.6.1 Text memo and binary memo......................................................................................................... 519
2.6.2 Image, sound, OLE and other binary memos .................................................................................. 520
2.7 Reassigning files ......................................................................................................................520
2.7.1 Benefit.......................................................................................................................................... 520
2.7.2 Modifying the storage directory...................................................................................................... 520
2.7.3 Modifying the name of a file........................................................................................................... 521
2.7.4 Keeping trace of reassignments..................................................................................................... 521
2.8 Full-text search and index ......................................................................................................523
2.8.1 Overview....................................................................................................................................... 523
2.8.2 How do I perform a "full-text" search?........................................................................................... 523
2.8.3 How do I create a full-text index? ................................................................................................... 523
2.8.4 How do I perform a full-text search?............................................................................................... 523
2.8.5 Analyzing the result of a "full-text" query ....................................................................................... 525
2.8.6 Managing the full-text indexes by programming.............................................................................. 525
2.9 The transactions ......................................................................................................................526
2.9.1 What is a transaction?................................................................................................................... 526
2.9.2 Knowing how to use transactions according to your needs .............................................................. 526
2.9.3 Principles...................................................................................................................................... 526
2.9.4 Handling the transactions by programming .................................................................................... 527
2.9.5 Managing the special cases........................................................................................................... 527
2.9.6 Advanced management ................................................................................................................ 528
2.10 Logs .......................................................................................................................................529
2.10.1 General points ............................................................................................................................ 529
2.10.2 Implement the log process .......................................................................................................... 530
2.10.3 Files created when setting up the log process............................................................................... 530
2.10.4 WDLog:Log management tool...................................................................................................... 530
2.10.5 Handling the logs by programming............................................................................................... 531
2.11 Automatic modification of the data files ................................................................................ 531
2.11.1 Principle ..................................................................................................................................... 531
Programming

2.11.2 When is the automatic data modification required? ..................................................................... 532


2.11.3 Perform automatic data modification........................................................................................... 532
2.11.4 Notes ......................................................................................................................................... 533
2.12 Creating dynamic (or temporary) files ...................................................................................533
2.13 Retrieving the structure of the HyperFileSQL files from an analysis ......................................534
2.14 Speeding up processes and optimizing an application/site .................................................534
2.14.1 Management of transactions ....................................................................................................... 534
2.14.2 Managing the log ........................................................................................................................ 534
2.14.3 Memo Management.................................................................................................................... 534
2.14.4 Managing the ".REP" ................................................................................................................. 534
2.14.5 Management of replication.......................................................................................................... 535
2.14.6 Trigger management ................................................................................................................... 535
2.14.7 RPC management ....................................................................................................................... 535
Tome1_2.book Page 38 Vendredi, 28. mai 2010 5:50 17

38

2.15 ODBC driver for HyperFileSQL ...............................................................................................535


2.15.1 Overview .................................................................................................................................... 535
2.15.2 Configuration.............................................................................................................................. 535
2.16 ODBC on HyperFileSQL via J++ and JDBC ............................................................................535
2.16.1 Overview .................................................................................................................................... 535
2.16.2 Setup ......................................................................................................................................... 536
2.16.3 Configuration.............................................................................................................................. 536
2.16.4 Use ............................................................................................................................................ 536

3. SQL LANGUAGE 537


3.1 Overview ..................................................................................................................................537
3.2 SQL Language and HyperFileSQL ........................................................................................... 537
3.2.1 Overview....................................................................................................................................... 537
3.2.2 SQL commands that can be used with HyperFileSQL ...................................................................... 537
3.2.3 Functions for running queries ........................................................................................................ 538
3.3 SQL language and other databases ......................................................................................539
3.3.1 Overview....................................................................................................................................... 539
3.3.2 Query created in the query editor ................................................................................................... 539
3.3.3 Query created by programming...................................................................................................... 539

4. MANAGING FILE LOCKS 541


4.1 Lock overview ...........................................................................................................................541
4.1.1 File locking ................................................................................................................................... 541
4.1.2 What is a lock? ............................................................................................................................. 541
4.1.3 When should you lock and what should you lock? .......................................................................... 541
4.1.4 WLanguage and locks ................................................................................................................... 542
4.2 Lock management ..................................................................................................................542
4.2.1 Example demonstrating the need for locks..................................................................................... 542
4.2.2 Lock structure ............................................................................................................................... 542
4.2.3 Dead lock (inter locking) ............................................................................................................... 542
4.3 The available lock modes .......................................................................................................543
4.3.1 Single-user Mode.......................................................................................................................... 543
Programming

4.3.2 Multiuser mode............................................................................................................................. 544


4.3.3 The possible locks in multiuser mode............................................................................................. 545
4.4 Assisted management of HyperFileSQL errors .......................................................................546
4.4.1 Principle ....................................................................................................................................... 546
4.4.2 Standard operating mode ............................................................................................................. 546
4.4.3 Customization............................................................................................................................... 548
4.4.4 Disabling the assisted management (WinDev and WebDev)........................................................... 549

5. THE HYPERFILESQL VIEWS 550


5.1 Overview of HyperFileSQL views .............................................................................................550
5.2 Benefits of views .....................................................................................................................550
5.3 Handling views .......................................................................................................................550
5.4 Creating HyperFileSQL views ...................................................................................................551
5.4.1 Choosing a view’s items ................................................................................................................ 551
Tome1_2.book Page 39 Vendredi, 28. mai 2010 5:50 17

39

5.4.2 Choosing the initial sort item of the view......................................................................................... 551


5.4.3 Selecting records from the view ..................................................................................................... 552
5.4.4 Union operations between several views ........................................................................................ 552

6. HYPERFILESQL TRIGGERS 553


6.1 Overview ..................................................................................................................................553
6.1.1 Definition...................................................................................................................................... 553
6.1.2 Benefits of using triggers ............................................................................................................... 553
6.2 How to create and handle triggers? .......................................................................................553
6.2.1 Functions for handling the triggers ................................................................................................. 553
6.2.2 Handling triggers........................................................................................................................... 554

7. THE DATA REPLICATION 555


7.1 Overview of the replication ......................................................................................................555
7.1.1 Overview....................................................................................................................................... 555
7.1.2 Vocabulary specific to the replication............................................................................................. 555
7.1.3 Note ............................................................................................................................................. 555
7.2 Implementing the universal replication ..................................................................................556
7.2.1 Activation ..................................................................................................................................... 556
7.2.2 Declaring the master database...................................................................................................... 556
7.2.3 Declaring the subscriber databases ............................................................................................... 556
7.3 Replication between heterogeneous databases ....................................................................556
7.4 Limitations ...............................................................................................................................557

8. MANAGING "BACK OFFICE" FILES 558


8.1 Overview ..................................................................................................................................558
8.2 Update by email .....................................................................................................................558
8.3 Remote access to Hyper File ...................................................................................................558
8.3.1 Definition...................................................................................................................................... 558
8.3.2 Details of the three use modes....................................................................................................... 558
8.4 The data replication ................................................................................................................559
Programming

8.4.1 Overview....................................................................................................................................... 559


8.4.2 Implementing the replication ......................................................................................................... 559

9. ACCESSING THIRD-PARTY DATABASES 560


9.1 Overview ..................................................................................................................................560
9.2 Specific features ......................................................................................................................560
9.3 Functions for managing the external databases ...................................................................560

10. HYPERFILESQL FUNCTIONS 561

11. HYPERFILESQL PROPERTIES 567


Tome1_2.book Page 40 Vendredi, 28. mai 2010 5:50 17

40

12. SQL FUNCTIONS 571


12.1 Function details ...................................................................................................................... 572
12.1.1 LEFT ........................................................................................................................................... 572
12.1.2 RIGHT ........................................................................................................................................ 572
12.1.3 MID, SUBSTR and SUBSTRING .................................................................................................... 572
12.1.4 LTRIM ......................................................................................................................................... 572
12.1.5 RTRIM ........................................................................................................................................ 573
12.1.6 TRIM........................................................................................................................................... 573
12.1.7 REPLACE .................................................................................................................................... 574
12.1.8 TRANSLATE................................................................................................................................. 574
12.1.9 CONCAT ..................................................................................................................................... 574
12.1.10 LPAD........................................................................................................................................ 574
12.1.11 RPAD ....................................................................................................................................... 574
12.1.12 LOLOWER................................................................................................................................. 575
12.1.13 UPUPPER ................................................................................................................................. 575
12.1.14 LEN and LENGTH ...................................................................................................................... 575
12.1.15 INSTR....................................................................................................................................... 575
12.1.16 PATINDEX................................................................................................................................. 575
12.1.17 POSITION ................................................................................................................................. 576
12.1.18 COUNT ..................................................................................................................................... 576
12.1.19 AVG.......................................................................................................................................... 576
12.1.20 MAX ......................................................................................................................................... 576
12.1.21 MIN.......................................................................................................................................... 576
12.1.22 SUM......................................................................................................................................... 576
12.1.23 BOTTOM ................................................................................................................................... 577
12.1.24 TOP .......................................................................................................................................... 577
12.1.25 ASCII........................................................................................................................................ 577
12.1.26 SOUNDEX, SOUNDEX LIKE ........................................................................................................ 577
12.1.27 SOUNDEX2, SOUNDEX2 LIKE .................................................................................................... 577
12.1.28 ADD_MONTHS ......................................................................................................................... 578
12.1.29 LAST_DAY ................................................................................................................................ 578
12.1.30 MONTHS_BETWEEN ................................................................................................................. 578
12.1.31 NEW_TIME ............................................................................................................................... 578
12.1.32 NEXT_DAY ................................................................................................................................ 578
Programming

12.1.33 ROUND .................................................................................................................................... 578


12.1.34 SYSDATE .................................................................................................................................. 578
12.1.35 TRUNC ..................................................................................................................................... 578
12.1.36 COALESCE ............................................................................................................................... 578
12.1.37 NVL, IF_NULL, IS_NULL............................................................................................................. 578
12.1.38 DECODE................................................................................................................................... 578

13. HYPERFILESQL CLIENT/SERVER 579


13.1 Overview ................................................................................................................................ 579
13.2 Implementing a Client/Server application ............................................................................ 579

14. HYPERFILESQL CLIENT/SERVER FUNCTIONS 580


Tome1_2.book Page 41 Vendredi, 28. mai 2010 5:50 17

41

PART 9 - APPENDICES

1. TOOLS PROVIDED WITH WINDEV, WEBDEV AND WINDEV MOBILE 585


1.1 Tools for managing HyperFileSQL data files ............................................................................585
1.1.1 WDMAP ........................................................................................................................................ 585
1.1.2 WDTool: HyperFileSQL tools.......................................................................................................... 585
1.1.3 WDOptimizer................................................................................................................................. 585
1.1.4 WDConver..................................................................................................................................... 586
1.1.5 WDLog.......................................................................................................................................... 586
1.1.6 WDTrans ....................................................................................................................................... 586
1.1.7 WDSQL ......................................................................................................................................... 586
1.1.8 WDReplic...................................................................................................................................... 587
1.2 Other tools ...............................................................................................................................587
1.2.1 WDZIP, archive manager................................................................................................................ 587
1.2.2 WDInst - Setup editor ................................................................................................................... 587
1.2.3 WDXView ...................................................................................................................................... 587
1.2.4 WDTest ......................................................................................................................................... 587
1.2.5 WDTestSite ................................................................................................................................... 588
1.2.6 WDClip ......................................................................................................................................... 588
1.2.7 WDAPI .......................................................................................................................................... 588
1.2.8 WDStatistics ................................................................................................................................. 588
1.2.9 Control Centers ............................................................................................................................ 589
1.3 Tools specific to WinDev Mobile ..............................................................................................589
1.3.1 WDExplorer ................................................................................................................................... 589
1.3.2 WDCapture ................................................................................................................................... 589
1.3.3 WDCEDB ...................................................................................................................................... 589
1.3.4 WDRegistry ................................................................................................................................... 589
1.3.5 WDSynchro................................................................................................................................... 589

2. EXTENSIONS OF THE WINDEV FILES 590

3. EXTENSIONS OF THE WEBDEV FILES 594


Programming

4. EXTENSION OF THE WINDEV MOBILE FILES 598

5. LIMITS OF WINDEV AND WINDEV MOBILE 601


5.1 Limits regarding the project ..................................................................................................... 601
5.2 Limits regarding the windows ................................................................................................ 601
5.3 Limits regarding the different types of controls ......................................................................602
5.4 Limits for the menus ................................................................................................................602
5.5 Limits for processes .................................................................................................................603
5.6 Image formats supported by WinDev .....................................................................................603
5.7 Limits regarding the analyses, the file descriptions and the items ........................................604
5.8 Limits regarding the physical data files, the index files and the memo files in HyperFileSQL for-
Tome1_2.book Page 42 Vendredi, 28. mai 2010 5:50 17

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

6. WEBDEV LIMITS 607


6.1 Limits regarding the project .................................................................................................... 607
6.2 Limits for pages and framesets ..............................................................................................607
6.3 Limits regarding the different types of controls ......................................................................608
6.4 Limits for the menus ...............................................................................................................608
6.5 Limits for processes .................................................................................................................609
6.6 Image formats supported by WebDev ...................................................................................609
6.7 Limits regarding the analyses, the file descriptions and the items .........................................610
6.8 Limits regarding the physical data files, the index files and the memo files in HyperFileSQL for-
mat ................................................................................................................................................. 611
6.9 Limits for xBase files ................................................................................................................ 611
6.10 Limits regarding the libraries ..................................................................................................612
6.11 Limits regarding the setup program ......................................................................................612

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

Part 1: Overview of WinDev, WebDev and WinDev Mobile


We will distinguish between the configuration of the • Web server (see "Configuring the Web servers")
development computer (your computer) and the configu- You will notice that the WebDev source code is identical
ration required for the applications developed by WinDev regardless of the Windows version on which the pro-
to run (the end-user computers). grams will be run.
Development computer: Web user computer: standard Internet browser
• 512 MB of RAM (1 GB or more recommended)
• 1.5 GB of disk space (2.6 GB for a complete setup: 1.1.3 Configuration required to install WinDev
hundreds of examples are provided with the product) Mobile
• in Windows 2000 or later. We will distinguish between the configuration of the
development computer (your computer) and the configu-
User Computer: ration required for the applications developed by WinDev
• 256 MB of RAM Mobile to run (the end-user computers).
• in Windows 98 or later Development computer:
You will notice that the WinDev source code is identical • 512 MB of RAM (1 GB or more recommended).
regardless of the Windows version on which the pro-
grams will run. • 1.1 GB of disk space (1.2 GB for a complete setup:
hundreds of examples are provided with the product)
1.1.2 Configuration required to install WebDev • in Windows 2000 or later
We will distinguish between the configuration of the Mobile computer:
development computer (your computer), the configura- • equipped with ARM and ARM-compatible processors
tion required to host your sites (the computer of your (StrongARM, XScale, Samsung, and so on), ARM v4T
host) and the configuration required for using the sites
and ARM v4T-compatible processors (XScale, and so
developed in WebDev (the computers of the Web users).
on), X86 and X86-compatible processors (AMD
Development computer: Geode, Transmeta Crusoe, and so on) with 64 MB of
• 512 MB of RAM (1 GB or more recommended). RAM
• 1.4 GB of disk space (2 GB for a complete setup: hun- • in Windows CE 3.0, or later
dreds of examples are provided with the product) You will notice that the WinDev Mobile source code is
• Windows 2000 or later identical regardless of the Windows version on which the
programs will run.
Host computer:
• 1 GB of RAM (capacity to adapt based on the hosted

1.2 Installing WinDev, WebDev or WinDev Mobile


The setup is straightforward, simply follow the instruction creates the "WinDev", "WebDev" or "WinDev Mobile"
provided on the product’s DVD or CD. program group in "Start .. Programs" and installs the
To make things easier, the setup procedure automatically necessary files.
Tome1_2.book Page 46 Vendredi, 28. mai 2010 5:50 17

46

1.3 Configuring the Web servers WB

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

For Windows 95 and 98 only.


Recommended for running tests during PWS Personal Web Server Version 1.0
the development. Supplied with Windows 98.
Not recommended for deployment. For Windows 95 and 98 only
IIS 3 Microsoft Internet Information Server ver- Note: If your Web server is not listed, you need to
IIS 4 sion 3, 4, 5, 6 or 7 manually configure it. See the online help for more
IIS 5 Microsoft server supplied with the Front-
Page software and with Windows NT, details.
IIS 6
IIS 7 2000 and Vista.

Netscape Netscape Server version 4.


Entreprise For Windows NT Server only

1.4 Register yourself


IMPORTANT: Fill out and return your registration card PC Soft offers to its customers: Free Technical Support
today. (for a set number of inquiries), information about new
The registration card supplied with your product is very features, ability to update your product, …
important. It will make you eligible for the free services

1.5 Electronic key


The dongle supplied with your product is specific to the To make sure that the parallel key works properly, you
development environment. must:
This dongle is not required for the end users or for the 1. insert the key into the parallel port of your compu-
host. ter when it is switched off
The principle is simple, the dongle must be plugged in 2. connect your printer to the dongle
when the product is used. 3. switch the computer and the printer on
4. start a printout
There are two types of dongle:
• USB dongle If the document is printed, your dongle is properly con-
• dongle that connects to your computer’s parallel port nected.
The dongle is transparent when printing.
For the USB key, plug it into an available USB port and
start WinDev, WebDev or WinDev Mobile.

1.6 Compatibility with the earlier versions


As for all the PC SOFT products, we guarantee backward To migrate the projects created with an earlier version,
compatibility with the earlier version. see the online help.
Tome1_2.book Page 47 Vendredi, 28. mai 2010 5:50 17

47

2. THE PRODUCTS
2.1 Overview
2.1.1 WinDev applications.
The product addresses all the needs of a professional

Part 1: Overview of WinDev, WebDev and WinDev Mobile


WINDEV is a development environment for the Windows
operating system. developer, from conception to maintenance, for new sites
It enables you to easily create powerful Windows applica- or to complement existing ones.
tions.
2.1.3 WinDev Mobile
The product addresses all the needs of a professional
developer, from conception to maintenance, for new WinDev Mobile is a development environment that works
applications or to complement existing ones. in the Windows environment.
It enables you to easily create powerful applications for
2.1.2 WebDev mobile devices (Pocket PC, Smartphone, etc.).
WebDev is a complete development environment for Win- The product addresses all the needs of a professional
dows. developer, from conception to maintenance, for new
It enables you to easily create powerful Intranet/Internet applications or to complement existing ones.

2.2 User friendly editors


WinDev, WebDev and WinDev Mobile are built around •source code editor, debugger and compiler.
editors that are adapted to a developer’s needs and inte- •help editor.
grated in a single environment: •modeling editor.
•project editor. •document editor.
•data model editor. •version manager.
•ML model editor.
•query editor. These various editors enable you to create the elements
(windows, pages, reports, databases, programs, and so
•window or page editor. on) used by your application or your site.
•report editor.

2.3 The WLanguage


WLanguage is the programming language of WinDev, server.
WebDev and WinDev Mobile. • text files.
WLanguage is a 5GL (5th generation language), the func- • file locking (automatic or programmed).
tion names use explicit English terms close to everyday’s • the display and input into visualization tables.
language (WLanguage functions are also available in
French). • object oriented programming, …
Both "standard" programming and "object oriented" One WLanguage command replaces several lines of tra-
programming are available in WLanguage. ditional code! For instance:
ScreenToFile (or PageToFile)
WLanguage is used to manage:
HAdd(CUSTOMER)
• the operations on character strings.
• arithmetic operations. These two lines are enough to:
• the display of windows (or pages) and controls. •assign to the file variables the values entered into the
• a database in HyperFileSQL format, SQL Server format, controls linked to the file items,
Oracle format, AS/400 format, Pal format, … •add the record to CUSTOMER file,
• the communications with an FTP server or with a SOAP •update the index file.
Tome1_2.book Page 48 Vendredi, 28. mai 2010 5:50 17

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

2.4 Choosing a programming language WD WDMobile

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.

2.5 The database


If the developed application (or site) must manage data, sites.
you will have the choice between using the WinDev data- The HyperFileSQL engine is available in the following
base - HyperFileSQL - or an external database. modes:
Unless you have existing constraints we recommend that • Network
you use HyperFileSQL. • Client/Server
This powerful engine is perfectly suited for managing • Mobile (for Pocket PC applications)
databases of any size (up to 25 billions of millions of
records), it is secured, supports transactions, log files, You can access a third-party database by using OLE DB
encryption and it can be distributed freely with WinDev or ODBC access, or a PC SOFT Native Access.
and WinDev Mobile applications as well as with WebDev

2.6 Developing multi-user or single-user applications WD WDMobile

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

2.7 Team application development


WinDev, WebDev and WinDev Mobile let you develop a The source manager lets several developers work at the
project as a team through its source code manager. same time on the same project and share elements
between projects.

2.8 Distributing applications and sites

Part 1: Overview of WinDev, WebDev and WinDev Mobile


2.8.1 Distributing WinDev applications the server.
WinDev simplifies the deployment of applications. The host must provide you with a login and password
for these accounts.
WinDev offers to create setup programs automatically.
These programs contain all the necessary modules for • deploy via a deployment package: recommended
installing the project and then executing it. when the server is not accessible.
The wizard enables you to create a setup program for
The setup media can be USB key, CD, hard drive, network your site. This setup program must be supplied to your
drive, Internet, … host and will allow your WebDev site to be installed
You can prepare: through FTP on the Web Server.
•a standard setup (or single-computer): the applica- • deployment by physical medium: CD, ... : recommen-
tion will be installed directly on the client computer. ded when the server is directly accessible.
•a setup with automatic update: the application will The wizard lets you create a "client version" of the pro-
be installed on the client computer through a server ject. This version will then be provided to the host, and
that will manage the application’s updates. will allow your WebDev project to be installed on the
Web server. To install your WebDev site, the host must:
When creating the setup program, you can start an 1. Install the WebDev application server on the Web
"advanced" mode in the tool (named WDINST) to totally server (if not already done).
customize the technical part of the setup: files to install 2. Install your WebDev site by running the Install.exe
in the Windows directory, write to a .INI file, create executable provided with the setup program.
groups, …
To customize the part of the setup program seen by the 2.8.3 Distributing WinDev Mobile applications
end user (to translate the messages to Spanish for ins- WinDev Mobile simplifies the deployment of your appli-
tance), you need to use the WDSETUP project which is cations.
provided in the example directory. WinDev Mobile proposes to automatically create setup
programs. These programs contain all the necessary
2.8.2 Deploying WebDev sites modules for installing the project and then executing it.
WebDev simplifies the installation of a site at a host or on
an Intranet server. Several methods can be used to install a WinDev Mobile
application on a Pocket PC:
Two deployment methods are available:
•Setup in CAB format. This setup program is run on a
• remote deployment (through FTP): recommended Pocket PC.
when the server is not directly available.
In order to perform a remote installation, the host must •setup in MSI format. This setup program is run on a
have: PC under Windows connected to a Pocket PC.
1. Created and configured your FTP account on the •setup by direct copy of the executable from the PC to
server. the connected Pocket PC.
2. Created and configured your WebDev account on

2.9 Multilingual projects


A project can be developed in several languages. chosen languages: a WLanguage function enables you to
WinDev, WebDev and WinDev Mobile take care of every- switch between languages. A single executable will be
thing. Simply enter the captions and messages in the created.
Tome1_2.book Page 50 Vendredi, 28. mai 2010 5:50 17

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

1. CREATING AN APPLICATION OR A SITE


1.1 Creating a WinDev application
Here are the steps for creating a typical WinDev applica-
tion:
1. Creating the project.
2. Creating a UML model if needed
3. Describing the analysis (or associating the project
with an existing analysis).
4. Creating queries if needed.
5. Creating windows.
6. Creating reports.
7. Testing the project.
8. Creating the executable.
9. Installing the application.
10. Using the application.

Part 2: Creating an application, a site


Tome1_2.book Page 54 Vendredi, 28. mai 2010 5:50 17

54

1.2 Creating a WebDev site


Here are the steps for creating a typical WebDev site:
1. Creating the project.
2. Creating a UML model if needed
3. Describing the analysis (or associating the project
with an existing analysis).
4. Creating queries if needed.
5. Creating pages.
6. Creating reports.
7. Testing the project.
8. Installing the site at the host or on an Intranet ser-
ver (either through FTP, or through physical media).
9. Opening the site.
Part 2: Creating an application, a site
Tome1_2.book Page 55 Vendredi, 28. mai 2010 5:50 17

55

1.3 Creating a WinDev Mobile application


Here are the steps for creating a typical WinDev Mobile
application:
1. Creating the project.
2. Creating a UML model if needed
3. Describing the analysis (or associating the project
with an existing analysis).
4. Creating queries if needed.
5. Creating windows.
6. Creating reports.
7. Testing the project.
8. Creating the executable.
9. Installing the application.
10. Using the application.

Part 2: Creating an application, a site


Tome1_2.book Page 56 Vendredi, 28. mai 2010 5:50 17

56

1.4 What is an application or a site?


An application is a set of elements (windows, controls,
reports, and so on) organized for a specific purpose A project is a logical set of elements and processes
(monitor the sales of a company for instance). The user whose goal is to achieve a given objective. The project
uses an application by starting an "Executable" file manages:
("MonitorSales.exe" for instance). •the relationships between the elements.
A WebDev site is a set of elements (pages, controls, •the relationships between the elements and the data
reports, and so on) organized for a specific purpose files (described in the analysis linked to the project).
(monitor the sales of a company for instance). The user
starts a site by clicking a link or by entering an Internet A project can be linked to a single analysis.
address. The same analysis can be associated with several pro-
An application (as well as a site) can be created through jects.
a project (WinDev, WinDev Mobile or WebDev).

1.5 Starting WinDev, WebDev, WinDev Mobile


1.5.1 Running WinDev
Note: After the first time you run WebDev, the following
There are several ways of starting WinDev: line lets you start WebDev:
•1st method: In the task bar, select "Start .. Programs
Part 2: Creating an application, a site

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

1.5.4 Identification This identification is needed when developing in teams


Every time WinDev, WebDev or WinDev Mobile is run, an through the source code manager or the developer grou-
identification window requests the name and the pas- pware. This way the name of the person who performed
sword of the developer. the last project or code modification can be stored, ...
This identification is also used by the various Control
For example: Centers for project management.
Depending on the name used, the developer will be able
to open project elements according to the rights granted
by the person who created these elements.
Note: if you do not develop as part of a team (if you do
not use the developer groupware, or the source code
manager) and if you do not use the Control Centers, you
can cancel the display of this window. Check the "Do not
display again" option.
The identification window can be redisplayed at any time
by selecting the "Request the password at startup" box
in the options of the product used ("Tools .. Options ..
General options of WinDev, WebDev, WinDev Mobile",
"User" tab).

Part 2: Creating an application, a site


Tome1_2.book Page 58 Vendredi, 28. mai 2010 5:50 17

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-

2.2 Creating the project


Caution: the following paragraphs present the various guages will be offered by default as soon as an
pieces of information to specify when creating a project. option found in a control, a window, a report, ... can
This information may vary depending on the use mode of be translated. Also select the default runtime lan-
the product. The current mode is displayed in the toolbar, guage. This language will be used to view the project
under the product logo. To modify the use mode, simply at run time.
click the current mode ("Complete mode" for instance). 13. Specify whether the project will use a database
or not. If yes, it can be an existing database or a new
2.2.1 Creating a WinDev project
Part 2: Creating an application, a site

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.

Part 2: Creating an application, a site


a database or not. If yes, it can be an existing data- Remarque: if you choose a dynamic WebDev site,
base or a new one. you will be able to create your site from a preset pro-
13. Validate the wizard. The created project beco- ject. Your site will be ready automatically. This site
mes the current project. contains data files, a complete interface and the
Notes: required processes. Once the project is created,
• If you have requested the creation of a database, the additions, deletions and modifications can be perfor-
corresponding wizard automatically starts. med in the analysis, pages or processes.
6. To optimize the choices offered by the environ-
• If you have requested the use of the source code data- ment, specify:
base, the wizard for adding a project to the source - the number of planned computers,
database automatically starts. - the number of planned sites,
• The information provided can be modified in the pro- - the number of planned users,
ject description ("Project .. Project description"). - the requested level of speed/security.
7. Specify the dates of your project.
2.2.3 Creating a WebDev project 8. Specify whether the project will be used by seve-
To create a project: ral developers. You can use the developer groupware
1. Select "File .. New .. Project". The project crea- or the source code manager (SCM) to share the pro-
tion wizard starts. ject.
2. Specify the various options of the project: 9. Select the programming charter. This charter
- the name and location. These options cannot be allows you to automatically prefix variable names,
modified. The project corresponds to a ".WWP" control names, page names, …
file. This file can be opened by WinDev and Win- 10. Select the style book.
Dev Mobile. All the objects associated with the 11. Specify whether a home page must be included.
project will be created in the specified directory. 12. Specify the supported languages. These lan-
- the description by summarizing the project’s guages will be proposed by default as soon as an
goal. This description is used in the project docu- option found in a control, a page, a report, ... can be
mentation. translated. Also select the default runtime lan-
3. Specify the documents attached to the project. guage. This language will be used to view the project
4. Choose the type of generation for the project, at run time.
that is what type of application will be generated by 13. Specify whether the project is associated with
the project. a database or not. If yes, it can be an existing data-
5. If you have chosen an Internet site, specify the base or a new one.
type of site to create. 14. Validate the wizard. The created project beco-
mes the current project.
Tome1_2.book Page 60 Vendredi, 28. mai 2010 5:50 17

60

base, the wizard for adding a project to the source


Notes: database automatically starts.
• If you have requested the creation of an analysis, the • The information provided can be modified in the pro-
corresponding wizard automatically starts. ject description ("Project .. Project description").
• If you have requested the use of the source code data-

2.3 Project dashboard and diagram


2.3.1 Dashboard switch from green to red whenever part of the project
Any project manager would like to have a global and syn- requires special attention.
thetic vision of the status of his projects. To display the dashboard of your project, select "Project
Any quality manager would like to know the number of cri- .. Project Dashboard".
tical bugs and follow their status.
2.3.2 Project graph
The product manager would like to know what new featu-
res are requested by the users. The project editor enables you to graphically view the pro-
ject elements (window, pages, reports, queries, and so
The developer wants to quickly fire up the most often on) as well as their sequence.
used project elements and source code, …
To display the graph of the project, select "Project .. Pro-
The dashboard provides an answer to all these wishes. ject Graph".
The dashboard is made of several lights that give a global
vision of the different indicators. The different lights
Part 2: Creating an application, a site

2.4 Characteristics of the project


2.4.1 The project file ".NDX" files) used when running the test of a project
The project corresponds to a ".WDP" file in WinDev, a ("Project .. Test mode .. Debug the project").
".WWP" file in WebDev and a ".WPP" file in WinDev •the list of languages supported by the project and the
Mobile. main language of the project, that will be used to view
This file contains: the project at run time in the editor.
•the initialization code of the project, run when the 2.4.2 The project’s directory
project is started.
The project directory contains:
•the list of linked elements (windows, reports, etc.).
The sequence between these elements is viewed in •the project elements: the project, the windows/
the project editor. pages, the reports, the queries, …
•the name of the first window/page (if it exists) ope- •the SCM directory: <cache.source code manager>.
ned when running the project or when testing the pro- •the analysis directory: <Project Name>.ANA
ject. This directory only exists if the analysis associated
•the name of the analysis associated with the project with the project is created in the default directory.
(if it exists) and its password. The data files described It contains the description of the different backups of
in this analysis can be handled by the project’s ele- the analysis.
ments (windows, pages, reports, and so on). •the runtime directory of the project: EXE
•the name of the UML model associated with the pro- This directory contains the files needed to run the
ject (if there’s one). project (DLL, EXE, etc.).
•the style sheet associated with the project (if it •the data directory of the automated tests: Automa-
exists). This style sheet contains all the styles used by ted test data>.
the project elements. •a directory with the name of the internal component
•The name of the custom preview window if it exists for each internal component created. This directory
(WinDev only). contains all the elements of the internal component.
•the directory containing the list of tasks to perform •the Web directory (WebDev only): <Project
on the current project. name>_WEB. This directory contains the images, the
JavaScript and Java files of the site.
•The directory of the data files (".FIC", ".MMO" and
Tome1_2.book Page 61 Vendredi, 28. mai 2010 5:50 17

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,

Part 2: Creating an application, a site


the check-out operation. •an element (window/page, report, etc.) to modify or
•the directory of the help associated with the project create,
(WinDev only): <Project Name>.AID. This optional •…
directory contains all the files necessary to the help
system associated with the project. To view the task list, select the "Task list" pane.
•the print documentation directory: Documentation There are two solutions for adding a task:
This directory is only created when printing the pro-
ject’s documentation or a project’s element in RTF, •1st solution: Task specific to programming
PDF or HTML format ("File .. Print the documenta- In the code, enter the description of the task prece-
tion" or "Project .. Print the project documenta- ded by "//To do".
tion"). This directory contains all the files generated For example:
when printing the project’s documentation in RTF, // To do: bar code management
PDF, or HTML format.
Note: You will be able to point in the code directly to the
•the code history directory: History location of the task to perform by double-clicking the
This directory contains the code of the modified pro- task’s name in the "Task List" pane.
cesses. A subdirectory is created for each type of ele-
ment (WPW for windows, etc.). •2nd solution:
This directory is found only if the code history mana- Click the "Add task" button in the "Task list" pane.
gement is enabled ("Display .. Code edit options").
Each task can:
•the setup program directory: Install
This directory contains the files required to install the •be assigned to one of the project developers.
application on the end-user computers. •have a specific priority level (high, medium, low). The
•the application patch directory (WinDev and WinDev tasks can be sorted by priority level.
Mobile only): Patch To handle the tasks, use the popup menu of the "Task
This directory contains the various patches created List" pane.
from the project.
Tome1_2.book Page 62 Vendredi, 28. mai 2010 5:50 17

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

2.5 Project operations


Here are the main operations that can be performed on a 3. Choose the files to export. To duplicate the pro-
project. ject, select all the files. You cannot duplicate the
analysis files of the backup files.
2.5.1 Archiving a project 4. Specify the directory into which the files must be
To archive a project: exported.
1. Open the project to archive. 5. Validate the duplication of the project.
2. Select "Tools .. Save the project". The project Note: You can also save the project to duplicate to a
archiving wizard starts. directory.
3. Select the project’s directories to include in the
Part 2: Creating an application, a site

backup. 2.5.4 Copying or deleting a project


4. Specify whether you want to compress the backup
in a ZIP file. To copy a project:
5. Choose the backup directory or file of the project. 1. Open the Windows explorer.
6. Validate. The specified backup directory or file is 2. Copy the complete project directory.
created automatically. To delete a project:
1. Open the Windows explorer.
2.5.2 Restoring a project 2. Delete the project directory and its subdirecto-
You can restore a previously archived project or a pre- ries.
vious version of a project.
2.5.5 Renaming a project
To restore a project: To rename a project:
1. Activate "Tools .. Restore project". The wizard for 1. Open the project to rename.
restoring a project starts. 2. Display the project editor.
2. Select the project archive to restore. 3. Select "File .. Save as".
3. Specify the location for the restore operation. 4. Enter the new name for the project.
4. Validate the restore operation. 5. Validate the project’s saving.
A project file and a "Project New Name".CPL directory
2.5.3 Duplicating a project will be created in the project’s directory.
Duplicating a project enables you to have two identical This new project will work the same way as the original
projects with the same name but found in different direc- project.
tories.
If needed you can delete the ".WDP" file (".WWP" for
To duplicate a project: WebDev or ".WPP" for WinDev Mobile) and the CPL
1. Open the project to duplicate. directory of the original project in Windows explorer.
2. Select "File .. Export ... To a directory".
Tome1_2.book Page 63 Vendredi, 28. mai 2010 5:50 17

63

3. THE UML MODEL (OPTIONAL STEP)


3.1 Overview
The main objective of a development team is to create •Object diagram: presents a set of objects and their
optimized applications, capable of satisfying the cons- relationships at a given time.
tantly evolving needs of their users. •Component diagram: describes the physical and
The modeling of an application is used to specify the static architecture of a computer application.
structure and the expected behavior of a system. It helps •Activity diagram: presents the behavior of a method
understand its organization and detect simplification and or a use case flow.
re-use opportunities as well as manage potential risks. •Sequence diagram: presents the chronological order
A model is a simplification of reality. It enables you to of the messages sent and received by a set of
better understand the system to develop. objects.
A diagram is the graphical representation of a set of ele- •Collaboration diagram: presents the structural orga-
ments that constitute the system. To view the system nization of the objects that send and receive messa-
under different perspectives, the UML language (Unified ges.
Modeling Language) proposes nine diagrams, each one •State-transition diagram: presents a sequence of
representing a system state. states that an object goes through.

Part 2: Creating an application, a site


WinDev allows you to create these nine types of UML •Deployment diagram: presents the distribution of
model: the hardware (the nodes) used in a system and the
association between executable program and this
•Class diagram: describes the overall structure of a hardware.
system.
•Use case diagram: presents the system’s features This chapter only provides an overview of UML. See a
from the user’s standpoint. specific documentation about the UML language for
more details.

3.2 The various UML diagrams


3.2.1 Class diagram •Public: the element is visible by all the other classes.
A class diagram is used to model the structure of a sys- •Protected: the element is visible to the class itself
tem via classes and via relationships between these clas- and to its subclasses.
ses. •Private: the element is only visible to the class.
The class diagrams are the most common diagrams in •Relationship: describes the behavior of the classes
the modeling of object-oriented systems. among themselves. Three types of relationships are
A class diagram contains the following elements: available:
•Class: presents the structures of the application. - Association: structural relationship among clas-
Each class is divided into three compartments: ses. For example, the Orders class is linked to the
- the class name indicates what the class is and not Product and Customer classes. A Customer can
what it does. place several Orders. An order contains several
products. An order must necessarily contain at
- the class attributes provide the characteristics of least one product.
the class. - Dependence: Use relation establishing that a
- the class operations indicates the possible actions class’s instances are linked to the instances of
on a class. another element. For example, the Orders class
uses the Stocks class: before adding a product to
For example, the Stock class contains the Product- an order, one needs to verify that the product is in
List attribute. This class also groups the AddProduct stock.
and RemoveProduct operations. These operations - Generalization: Relationship between a general
can be applied to the instances of the class. class (parent) and a specific class (child) that deri-
•Note: The UML language defines three levels of visibi- ves from it.
lity for attributes and operations:
Tome1_2.book Page 64 Vendredi, 28. mai 2010 5:50 17

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

A use case describes the actions performed by an 3.2.4 Component diagram


application but it does not specify how the applica- A component diagram describes the physical and static
tion performs these actions. architecture of a computer application. For example:
•Relationship: describes the behavior of the actors in source files, libraries, executables, …
relation to the use cases. Three types of relationships A component diagram contains the following elements:
are available: •module: represents the various physical elements
- Association: structural relationship between two that make up a computer application. For instance:
linked elements. a file, a library, …
- Dependency: Relationship establishing that an A module can be represented:
element uses another one. For example, a bank •either by a specification showing the module inter-
Customer may get cash from an ATM. In this case, face. This specification may be generic in the case
the Get Cash action depends on the Customer. of classes with parameters.
In order to get cash, customers must enter their
PIN number. In this case, the Get Cash action •or by its body, which presents the module’s imple-
depends on the Password Input. mentation.
- Generalization: Relationship used to organize the •task: represents a component that has its own con-
elements according to a hierarchy. trol flow (thread).
For example: •main programs of the computer application.
- two types of Customer actor are available: Indivi- •subprograms: groups the procedures and functions
dual Customer or Business Customer. that don’t belong to classes.
- the checking of a user identity can be performed in
two ways: password input or fingerprint check.
Tome1_2.book Page 65 Vendredi, 28. mai 2010 5:50 17

65

3.2.5 Activity diagram cal axis.


An activity diagram presents the behavior of a method or For instance: "Pick up", "Ring", …
the flow of a use case.
3.2.7 Collaboration diagram
An activity diagram is made of the following elements:
A collaboration diagram presents the structural organiza-
•activity: presents a specific step in a workflow. For tion of the objects that send and receive messages.
example: "Create an estimate", "Open a window",
"Check knowledge", … A collaboration diagram contains the following elements:
•synchronization bar: used to synchronize the diffe- •object: represents the different objects used.
rent activities: •actor: represents the role of an external element. A
•by indicating the activities to perform before a person for example.
given activity. For example: "Press clutch" and •message: represents the messages exchanged
"Change gear" before "Release clutch". between the different objects.
•by indicating the activities to perform concurrently.
3.2.8 State-transition diagram
•object: attaches activities to the object that performs
them. For example, the "Order" and "Pay" activities A state-transition diagram presents a sequence of states
are attached to the "Customer" object; the "Teach" that an object goes through during its lifecycle. It is used
and "Check knowledge" activities are attached to to describe the state changes for an object or for a com-
the "Teacher" object. ponent.
•send signal: shows the sending of a signal to an A state is defined by its duration and by its stability.
object. A transition represents the instantaneous change from
•wait for signal: shows the wait for a signal coming one state to another one.

Part 2: Creating an application, a site


from an object. A transition is triggered:
•transition: shows the passage from a completed •by an event.
activity to another activity. For example: "Too much •automatically when no triggering event is specified.
water", "Not enough money", …
A state-transition diagram contains the following ele-
3.2.6 Sequence diagram ments:
A sequence diagram presents the chronological order of •state: represents the value of the object attributes at
the messages sent and received by a set of objects. a given time.
FA sequence diagram contains the following elements: •initial state: represents the state when the system
starts.
•object: represents the different objects used. Each
object is represented by a square at the top of a dot- •final state: represents the state in which the system
ted line. This line represents the lifespan of the is at the end of the operation.
object. For instance: "Caller, "Called, … •super-state: useful for structuring the diagram by
•object activation period: On the life line of an object specifying several levels between states.
you can insert activation period for the object. These •history: represents the last active state of a super-
periods represent the times when the object is active. state.
•message: shows, using horizontal arrows, the messa- •stump: used to symbolized the states found in a
ges exchanged between the various objects . These super-state. This enables you to link these states to
arrows are oriented from the issuer of the message to other states that do not belong to the super-state.
the recipient. The order in which the messages are •transition: represents the passage from one state to
sent is given by the position of the arrows on the verti- another.
Tome1_2.book Page 66 Vendredi, 28. mai 2010 5:50 17

66

3.2.9 Deployment diagram example: server number 3, printer number 7, …


A deployment diagram presents the physical layout of the •connection: describes the communication support
hardware devices used in a system as well as the asso- between two nodes. For example: TCP/IP.
ciation between the executable programs and these devi-
ces.
A deployment diagram contains the following elements:
•node class: represents a class of hardware resource.
For example: a server, a PC, a printer, …
•node instance: represents a hardware resource. For
Part 2: Creating an application, a site
Tome1_2.book Page 67 Vendredi, 28. mai 2010 5:50 17

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.

4.2 Creating a LDM (Logical Data Model)


In a WinDev application/WebDev site, the terms "LDM"
and "Analysis" are interchangeably used to define the The following paragraphs detail how to create a file.

Part 2: Creating an application, a site


structure of the database associated with a project. To create a new file:
1. Select "Insert .. File". The wizard for file creation
4.2.1 Creating an analysis (or LDM) starts.
To create a LDM: 2. Check "Create a new file description".
1. Select "File .. New .. Analysis". The wizard for 3. Specify:
creating analysis starts. - the logical name of the file. This name will be used
2. Specify: to handle the file.
- the name and the directory of the analysis. The - the caption of the file which briefly described the
analysis corresponds to a ".WDA" file. By default, file’s purpose.
this file will be created in the directory of the pro- - the representation of a record in the file. This
ject analysis (<Project Name>.ANA directory). This representation improves the meaning of the ques-
directory must be accessible in read/write. tions asked when describing the links. This option
- the caption of the analysis, which briefly described must be preceded by an indefinite article (A or AN).
the analysis purpose. - whether the file contains an "automatic identi-
- whether the analysis must be associated with the fier" item. The value of this item is unique for each
current project. record and it is automatically calculated by Win-
- whether the analysis should be protected by a Dev/WebDev.
password. This password will be requested when - the type of the database for which the file will be
opening the analysis (using WinDev/WebDev tools created. Depending on the selected type, this data
or by programming). file will be handled by the HyperFileSQL engine, by
- the types of databases handled by the project. an OLE DB driver or by one of the WinDev/WebDev
3. The creation of the first file is automatically pro- native accesses (SQL Server, Oracle, …).
posed. - whether the size of the file can exceed 2 GB. This
4. Create all the elements (files, items and links) of option can only be used if both the file system of
your analysis. the current computer and the file system of the
computers where the application will be deployed
4.2.2 Adding a file to an analysis (the server computers and the computers where
The analysis files are used to describe the structure of the the data files are installed by WebDev) support the
data files used by the project. A file found in the analysis NTSF format (Windows 2000, NT or XP).
can be:
•A new file. Caution: if this option is selected, the file cannot be
opened in Windows 95, 98 or me.
•A preset file, supplied with WinDev/WebDev. - whether the file should support replication. This
•A file imported from an existing database (using a option is used to manage the automatic updates of
specific file format for instance).
Tome1_2.book Page 68 Vendredi, 28. mai 2010 5:50 17

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

4.2.4 Creating a link


There are two solutions for importing an existing file des- You can create different types of link between files. See
cription: ’Characteristics of the links defined in an analysis’, page
Solution 1: from the data model editor 73, for more details about links.
1. Select "Insert .. File".
2. Select "Use files from an existing database", To create a link:
then select the database type. 1. Select "Insert .. Link". The mouse cursor turns
3. Specify the data format used by your project. You into a pen.
can keep the current format or migrate the files to 2. Select the two files to link. The description window
HyperFileSQL format. of the link is automatically opened.
4. If required, specify the WinDev/WebDev analysis 3. To define the cardinalities between two links:
where the description must be imported (existing or - select the cardinalities among the proposed ones
new analysis). (0,1 ; 1,1 ; 0,N ; 1,N).
5. Specify the source database containing the des- - answer the questions asked. The cardinalities will
criptions to import and the type of this source data- be automatically updated.
base. Depending on the chosen type, enter the 4. To define advanced cardinalities, check "Display
requested information. the advanced cardinalities" and answer the ques-
6. Select the tables or files whose description must tions asked.
be imported and validate. 5. Enter the caption of the link by briefly describing
7. The imported file is automatically inserted into the the subject of the link.
current analysis. 6. Specify the keys to link.
7. Specify the integrity rules. These rules are used to
ensure the integrity of data when one of the relation
keys is modified or deleted.
8. Validate. The link is automatically created.
Tome1_2.book Page 69 Vendredi, 28. mai 2010 5:50 17

69

4.3 Characteristics of the links defined in an analysis


4.3.1 Owner file and member file file?
In the case of a link between 2 files, there is an owner file This answer provides the second part of the cardina-
and a member file: lity (maximum cardinality):
- if the answer is "only one", the cardinality is X,1.
•the owner file is the owner of the key. - if the answer is "several", the cardinality is X,N.
•the member file is a member of the analysis files con- The answer to these two questions defines the cardinality
taining a copy of the key. that can be: 0,1; 0,N; 1,1; 1,N
To manage the link between two files, the key of the The description of cardinalities is fundamental: it provi-
owner file is copied into the member file. des the basis for referential integrity of the database.
For example, the key of the Supplier file is copied into To be clearer, these two questions can be broken down
each record of the Product file. Several records of the into four questions. For example, to describe a link
Product file can have the same key in the Supplier file: between the Supplier file and the Product file:
- the owner file is the Supplier file,
- the member file is the Product file.
This type of link is represented as follows:

Part 2: Creating an application, a site


4.3.2 Cardinalities
The cardinalities are used to count the links between the
files.
The cardinality is defined according to the answers to the
two following questions:
1. For each file record, what is the minimum number
of records to which this record is linked in the other - each "supplier" has at least one "product": Yes/
file ? No?
The answer provides the first part of the cardinality - each "supplier" can have several "products": Yes/
(minimum cardinality): No?
- if the answer is "none", the cardinality is 0,X. - each "product" belongs to at least one "supplier":
- if the answer is "only one", the cardinality is 1,X. Yes/No?
- each "product" can belong to several "suppliers":
2. For each file record, what is the maximum number Yes/No?
of records to which this record is linked in the other
Tome1_2.book Page 70 Vendredi, 28. mai 2010 5:50 17

70

Example of cardinalities: 4.3.5 The different types of links


This example presents two different cardinalities: Several types of links can be found between the files:
- parallel
- optional
- complement
- shared
- complex
- Cardinality 0,1: A person can only be a member of Parallel link
one sport club. This person does not have to belong
For a parallel link, each record of a file (Product) is lin-
to a sport club.
ked to a record in another file (Information), and con-
- Cardinality 0,N: A club can have nobody or several
versely.
people as members.

4.3.3 The advanced cardinalities


The cardinalities can be defined more precisely. We talk
about advanced cardinalities.
These cardinalities are used to exactly specify the mini- To manage a parallel link, the identifier of the Product file
mum cardinality and the maximum cardinality. is copied into the Information file. This identifier is also a
To define the advanced cardinalities, check "Display the unique key in the Information file.
advanced cardinalities" in the description of the link The owner file is Product, the member file is Information.
("Insert .. Link"). Note: This type of link is rare because the two files can
be combined into a single file.
Part 2: Creating an application, a site

Example of advanced cardinalities:


The parallelism of the records in the file is respected if the
This example presents two different cardinalities: following operations are run simultaneously on the two
files:
- creating a record
- deleting a record
- reindexing with compression
- Cardinality 0,1: A person can only be a member of Optional link
one sport club. This person does not have to belong For an optional link, each record of a file (Category) is
to a sport club. associated with no record or with a single record in ano-
- Cardinality 0,10: A club can have up to 10 members. ther file (Group). Each record in the other file (Group)
has no or only one record associated with the first file
4.3.4 Referential integrity (Category).
The referential integrity of a database corresponds to the
respect of the constraints implied by the links between
the files.
The referential integrity consists in checking that:
•if a record is deleted from the owner file, the corres- An optional link is performed by copying the identifier of
ponding records are also deleted from the member each file into the other file.
files,
Complement link
•if a record is added to a member file, a correspon-
ding record exists in the owner file, For a complement link, each record of a file (Product) is
associated with no record or with a single record in ano-
•if a record is modified in the owner file, the unique ther file (Details). Each record of the other file (Details)
key is not modified, … has at least one record associated with the first file
The check of the referential integrity depends on the (Product).
nature of the link between the files.
See the ’Automatic referential integrity control’ chapter,
page 539, for more details about controlling referential
integrity
The complement links are quite common. They are used
when a record can have additional optional information.
Tome1_2.book Page 71 Vendredi, 28. mai 2010 5:50 17

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

Part 2: Creating an application, a site


Complex link
In the case of a "complex" link, you need to manage a
link file, called relationship file.
With this type of link: The relationship file will be automatically created. It will
- an owner may have no member (a supplier does not contain a unique key made of the two keys of the linked
necessarily have a product). files.
- a member may have no owner (a product does not The relationship file may also contain information speci-
necessarily have a supplier). fic to the link.
Shared link with a 0,N - 1,1 cardinality A complex link is then made of two shared links.
Example of complex link
An order (Orders file) may contain one or more products.
A product (Product file) can be used in several orders.
With this type of link: In this case, a link file is required (OrderLine file).
•an owner may have no member (a supplier may have The OrderLine file contains:
no product). - a unique key made of the keys of Product and Orders.
•each member has a single owner (each product has - the number of products ordered.
a single supplier). The links between the files are as follows:
Note: This type of link is common. WinDev enables you to
automatically create the windows used to manage files
linked by a 0,N - 1,1 type link.

4.4 Operations available on an analysis


4.4.1 Duplicating/Copying a LDM is displayed.
Duplicating a LDM enables you to have two identical 3. Modify the name and directory of the analysis.
LDMs with different names. 4. Validate the modifications.
5. All the files used to describe the duplicated analy-
To duplicate/copy a LDM: sis are automatically created in the specified direc-
1. Open the analysis to duplicate in the data model tory.
editor ("File .. Open").
2. Select "File .. Save As". The analysis description
Tome1_2.book Page 72 Vendredi, 28. mai 2010 5:50 17

72

6. The duplicated analysis is automatically associa- 1. Open the project to associate.


ted with the current project. 2. Select "Project .. Project Description". The pro-
Note: the subdirectories of the original analysis are not ject description is displayed.
copied. The new analysis contains no backup. 3. In the "Analysis" tab, specify the LDM to asso-
ciate.
4.4.2 Deleting a LDM Note: If data from the original analysis was used in the
To delete a LDM: project, associating a new analysis may trigger errors
1. Open the Windows explorer. (duplicate errors, display errors, etc.)
2. Delete the entire analysis directory.
Note: if a project used this analysis, you will need to
4.4.5 Enlarging or reducing the display of a
associate the project to another analysis when opening LDM
this project. A zoom factor can be specified in the data model editor
to reduce or enlarge the display of the current LDM.
4.4.3 Renaming a LDM
To specify a zoom factor:
To rename a LDM: - 1st method:
1. Open the LDM to rename in the data model editor - Select "Display .. Zoom .." and select the zoom
("File .. Open"). coefficient to use.
2. Select "File .. Save As". The analysis description - Enter the zoom factor in the status bar of the editor
is displayed. (bottom right).
3. Enter the new name for the LDM. - 2nd method:
4. Validate the modification. - Press the [Ctrl] key.
5. All the files used to describe the duplicated analy- - Modify the zoom factor with the mouse wheel while
Part 2: Creating an application, a site

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:

4.5 Handling a file in the data model editor


4.5.1 Duplicate/copy a file from the LDM. If links were pointing to this file, these
To duplicate/copy a file: links are also deleted.
1. Select the file to duplicate. Note: When creating a file whose name is identical to the
2. Select "Edit .. Duplicate". name of a previously deleted file, the restoration of the
3. Specify the requested information and validate. deleted file’s description is offered.
The duplicated file is automatically created in the
current LDM. 4.5.3 Renaming a file
To rename a file:
4.5.2 Deleting a file 1. Select the file to rename.
To delete a file: 2. Select "Structure of files .. Description of files".
1. Select the file to delete. The description of the files is displayed.
2. Open the popup menu of the selected file (right 3. Modify the name of the file and validate the file
mouse click). description. The file is automatically renamed.
3. Select "Delete". The file is automatically deleted

4.6 Handling an item


4.6.1 Duplicating/copying an item name of an existing item, WinDev/WebDev automatically
When creating an item whose name is identical to the offers to use the description of the original item.
Tome1_2.book Page 73 Vendredi, 28. mai 2010 5:50 17

73

4.6.2 Deleting an item cription.


To delete an item:
1. Select the item to delete from the description of 4.6.3 Renaming an item
file items. To rename an item:
2. Click the "Delete selected item" icon. The item 1. Select the item to rename in the description of file
will be automatically deleted from the file. items.
2. Enter the new name of the item.
Note: When creating an item whose name is identical to 3. Validate the modification. The item is automati-
the name of a previously deleted item, WinDev/WebDev cally renamed.
automatically offers to restore the deleted item’s des-

4.7 Creating a CDM (Conceptual Data Model)


In the MERISE methodology, the conceptual data model - notes detailing the entity’s operating mode ("Mis-
defines the objects and the actions that must be taken cellaneous" tab).
into account in the database. This model only represents 3. The entity becomes the current entity. WinDev/
the structure of information and the exchanges of infor- WebDev automatically offers to describe the proper-
mation for the system used, independently of the physi- ties of this entity.
cal constraints linked to the nature of the database used.
4.7.3 Creating an association
4.7.1 Creating a CDM To create an association:
To create a CDM: 1. Select "Association .. New Association". The des-

Part 2: Creating an application, a site


1. Select "File .. New .. DATA CDM". The wizard for cription of the association comes up.
creating a CDM starts. 2. Specify:
2. Specify: - the association’s name. When generating the LDM
- the name and directory of the CDM. The CDM cor- from the CDM, this name will be the logical name of
responds to a ".MCD" file. By default, this file will the created file if this association contains at least
be created in the directory of the project analysis one property or if it belongs to a complex link.
(<Project Name>.ANA directory). This directory - the association’s caption which briefly described
must be accessible in read/write. the association’s purpose.
- the caption of the CDM that briefly described the - notes detailing the association’s operating mode.
subject of the CDM. 3. The association becomes the current association.
- whether the CDM should be associated directly WinDev/WebDev automatically offers to describe
with the current analysis. This analysis can be an the properties of this association.
existing analysis or a new analysis that will be crea-
ted. 4.7.4 Creating a property
3. The created CDM becomes the current CDM. Win- To describe a property:
Dev/WebDev automatically offers to create the first 1. Double-click the entity or the association where
entity. the property must be created. The property descrip-
4. Create all the elements (entities, associations, tion window comes up.
properties and relationships) of you CDM. 2. Click the first empty row in the property table or
click the "+" icon.
4.7.2 Creating an entity 3. Specify the name, the caption, the type, the size
To create an entity: and the notes of the property.
1. Select "Entity .. New entity". The description of 4. For an entity property, check "Identifier" if the
the entity is displayed. property is the identifier of the entity.
2. Specify: 5. Validate the description of the property.
- the entity’s name. This name will be the logical
name of the created file when generating the LDM 4.7.5 Creating a relationship
from the CDM. To create a relationship:
- the entity’s caption which briefly described the 1. Select "Entity .. Draw a relationship". The mouse
entity’s purpose. cursor turns into a pen.
- whether an "Automatic identifier" type property 2. Select the two entities to link, or the entity and the
should be defined in the entity. The value of this association to link.
property is unique for each record and it is automa- 3. Define the cardinalities of the relationship.
tically calculated by WinDev/WebDev.
Tome1_2.book Page 74 Vendredi, 28. mai 2010 5:50 17

74

4.7.6 Defining cardinalities tionship".


To define the cardinalities: 3. Choose the cardinality among the proposed ones.
1. Select the relationship whose cardinalities must 4. Validate the description of cardinalities.
be defined. See ’Cardinalities", page 73, for more details.
2. Select "Entity .. Information about the rela-

4.8 Main operations that can be performed on a CDM


4.8.1 Deleting a CDM To specify a zoom factor:
To delete a CDM: - 1st method:
1. Open the Windows explorer. - Select "Display .. Zoom .." and select the zoom
2. Delete the entire CDM directory (<CDM coefficient to use.
Name>.ANA directory). - Enter the requested zoom coefficient in the status
bar of the editor (bottom right).
4.8.2 Renaming a CDM - 2nd method:
- Press the [Ctrl] key.
To rename a CDM: - Modify the zoom factor with the mouse wheel while
1. Open the CDM that must be renamed in the data keeping the [Ctrl] key down.
model editor.
2. Select "File .. Save As". 4.8.4 Moving the display of the CDM
3. Enter the new name of the CDM and validate the
modification. The renamed CDM becomes the cur- To move the display of a CDM:
Part 2: Creating an application, a site

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.

4.9 Handling an entity


4.9.1 Duplicating/copying an entity 3. Select "Delete". The entity is automatically dele-
To duplicate/copy an entity: ted from the CDM. If relationships were pointing to
1. Select the entity to duplicate. this entity, these relationships are also deleted.
2. Enable "Entity .. Duplicate an entity".
3. Specify the requested information and validate. 4.9.3 Renaming an entity
The duplicated entity is automatically created in the To rename an entity:
current CDM. 1. Select the entity to rename.
2. Select "Entity .. General Information". The des-
4.9.2 Deleting an entity cription of the entity comes up.
To delete an entity: 3. Modify the name of the entity.
1. Select the entity to delete. 4. Validate the description of the entity. The entity is
2. Open the popup menu of the selected entity (right automatically renamed.
mouse click).

4.10 Handling an association


4.10.1 Duplicating/copying an association 4.10.2 Deleting an association
To duplicate/copy an association: To delete an association:
1. Select the association to duplicate. 1. Select the association to delete.
2. Select "Association .. Duplicate an association". 2. Open the popup menu of the selected association
3. Specify the requested information. (right mouse click).
4. The duplicated association is automatically crea- 3. Select "Delete".
ted in the current CDM.
Tome1_2.book Page 75 Vendredi, 28. mai 2010 5:50 17

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.

4.11 Handling a property


4.11.1 Deleting a property 4.11.2 Renaming a property
To delete a property: To rename a property:
1. Select the property to delete in the description of 1. Select the property to rename in the description
entity properties or association properties. of entity properties or association properties.
2. Click the "-" icon. The property is automatically 2. Directly enter the property’s new name.
deleted from the entity or from the association. 3. Validate the modification. The property is auto-
matically renamed.

4.12 Generating the LDM from the CDM


To associate a CDM to a project, you must generate the LDM will be updated with the new description of the

Part 2: Creating an application, a site


associated LDM. CDM.
Reminder: It is the LDM that is associated with the pro- When updating an existing LDM, the generation checks:
ject not the CDM. 1. The existence of the entity in the LMD:
The generation of the CDM is used to automatically - if the entity is new, the corresponding file is created.
create the corresponding LDM once the validity of the - if the entity already exists, its properties are upda-
CDM has been checked. ted.
2. The existence of the properties in the LDM:
To generate the LDM from the CDM: - if the property is new, the corresponding item is
1. Select "Analysis .. Generate the logical model" created.
option. - if the property already exists, with the same des-
2. Define the parameters for generating the LDM cription, no action is performed.
from the CDM: - if the property already exists, with a different des-
- the name and path of the generated LDM. The LDM cription, a conflict occurs. The data model editor
corresponds to a ".WDA" file. By default, this file will offers:
be created in the directory of the project analysis - to ignore the new description of the property and to
(<Project Name>.ANA directory). This directory must perform no modification.
be accessible in read/write. - to update the existing item with the new descrip-
- whether the captions of the associations without tion of the property.
properties (of the CDM) are kept to identify the links - to create a new description synonym with the new
(of the LDM). description of the property.
- the type of access to the data file. Depending on the 3. The existence of relationships and associations.
selected type, the data files will be handled by the When the association requires one or several files to
WinDev engine, by an OLEDB driver or by one of the be created, the files and the items of the LDM are
WinDev native accesses (SQL Server, Oracle, …). updated as described above. When a relationship
- the type of the database used. has been modified, the link with the LDM is recrea-
- the format of the characters used in the analysis. ted or updated:
3. Validate the generation. The LDM corresponding - if the identifying properties of one of the entities
to the CDM is automatically created. have been modified, the cardinality of the existing
Special Case: Updating an existing LDM links are updated and new links are created.
- if no identifying properties of the entities has been
If the name and path of the LDM specified when genera- modified, the cardinalities are updated.
ting the CDM correspond to an existing LDM, the existing
Tome1_2.book Page 76 Vendredi, 28. mai 2010 5:50 17

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-

4.13 Generating the analysis (LDM)


The generation of the analysis is performed before the As long as the analysis (the LDM) has not been genera-
programming phase and after the description of the files. ted, the description of the analysis (the files) cannot be
This generation is used to: used in the project.
- validate the modifications performed in the analysis The generation ("Analysis .. Generation") contains three
(LDM). steps:
- create the modules required for programming. - checking the modifications made and generating the
- update the data files automatically if necessary. files of the analysis description.
- automatic modification of the accessible data files
(files found in the "EXE" directory of the project).
- Synchronizing the project.

4.14 Managing the analysis versions


Part 2: Creating an application, a site

WinDev/WebDev enables you to manage the different 4.14.1 Restoring an analysis


versions of the analysis ("Analysis .. Version manage- To restore an analysis from the version manager:
ment"). 1. Select the version to restore.
You can then work with the current analysis or with a spe- 2. You can:
cific analysis. - restore the version into the specified directory. An
Note: when an analysis is damaged, you can directly independent analysis corresponding to the selec-
select the damaged analysis to restore one of the pre- ted version is created. This option is selected by
vious versions for instance. default.
All the versions of the analysis are shown in a diagram. - overwrite the current analysis.
The yellow rectangle indicates the generation number of 3. Validate. The restore operation is performed.
the analysis; the label on the right the generation date.
Caution: the data files corresponding to an analysis
There are some "small rectangles" displayed between whose version number is greater than the restored ver-
two versions that indicate: sion cannot be opened anymore. In this case, you need
• one rectangle: there are only a few modifications to also restore the files corresponding to the version of
between the two versions. the restored analysis or delete the existing files so they
• several rectangles: there are several modifications per- can be recreated.
formed between the two versions.
4.14.2 Canceling the last generation
To see the details of the modifications performed
between the two versions: Double-click the line contai- Canceling the last generation of the analysis is used to
ning the "small rectangles" or click the [Modifications] restore the analysis to its status before the last genera-
button. tion. The modifications performed since are not applied.

4.14.3 Resetting the version number to 1


The options available in the version manager are: You can reset the generation number of the analysis to
• Restoring an analysis "1" ("Analysis.. Reset the analysis version to 1"). In this
• Canceling the last generation case, the version number of the analysis is reset to one.
• Resetting the version number to 1 No specific action is performed on the data files.
Tome1_2.book Page 77 Vendredi, 28. mai 2010 5:50 17

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, …

Part 2: Creating an application, a site


Tome1_2.book Page 78 Vendredi, 28. mai 2010 5:50 17

78

6. THE WINDOWS WD WDMobile

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.

6.2 Creating a window


WinDev enables you to create several types of windows: 4. Validate the creation of the window. A blank win-
• Blank windows, without control. dow is created.
• Windows created by RAD. 5. Save the window ("File .. Save").
6. Specify the name of the window. The window cor-
• Windows created by RID. responds to a ".WDW" file (WinDev) or ".WPW"
• Internal windows. These windows can be used in (WinDev Mobile). By default, this file is created in the
"Internal Window" type controls (WinDev only) main directory of the project. This name will be used
• Windows based on a window template. to handle the window.
• Windows imported from a non-WinDev application 7. Create the window controls.
(WinDev only). The different types of controls are presented in the ’Con-
Note: the main characteristics of the windows are trols’ chapter, page 251.
detailed in the ’Windows’ chapter, page 264.
6.2.2 Creating the project windows by RAD
6.2.1 Creating blank windows The project windows and menu can be created directly in
To create a blank window: one operation, from the analysis description, by automa-
1. Select "File .. New .. Window". tic application development (RAD).
2. Select the "Blank" type. See the online help for more details about the windows
3. Specify the window’s skin template. created by RAD.
Tome1_2.book Page 79 Vendredi, 28. mai 2010 5:50 17

79

To import a window into a WinDev project9:


To create the application by using the RAD tool: 1. Open the WinDev project into which the window
1. Select "Workshop .. Full application RAD". must be imported.
Caution: To use this option, the project must be lin- 2. Select "File .. New .. Window".
ked to an analysis that has been generated at least 3. Display the "Import" tab. The windows currently
once. displayed on the current computer are automatically
2. Select the RAD pattern to use. listed. These windows are identified by their title (dis-
3. Select the files used for the generation. played in the title bar).
4. Select the main files that will be the entry points If the window to import is not listed, you can select it
into the application (mainly, these files will be used
with .
to set up the menu options).
Note: "Generate images for the unrecognized con-
5. If needed, associate an image with each file. This
trols" is used to make the final interface closer to the
image will be used to represent the files (if the appli-
interface of the window to import.
cation uses a menu in carousel format for instance).
4. Validate. The preview of the window to import is
6. Specify whether your application will use the user
displayed.
groupware.
5. Modify (if necessary) the type of control created
7. Specify whether an automatic menu must be
when importing the window ("Details" button).
included in the application. The automatic menu lets
6. Validate. The window is automatically included in
you include features such as saving the application,
the current WinDev project.
using an "About" window, …
8. Validate the creation of the application by RAD. Limits: The following elements are not imported:
•the code of the elements.
6.2.3 Creation of standard RAD, RID windows
•the controls other than the following controls:

Part 2: Creating an application, a site


To create a window:
•Delphi controls.
1. Select "File .. New .. Window".
2. Choose the type of window to create. This window •Visual Basic controls.
can be: •standard control of Windows.
- R.A.D.: This window will allow records from one or •the images and the background images (except if
more files to be viewed and/or modified. "Generate images for the unrecognized controls" is
- R.I.D.: This window will allow records from on or checked).
more files to be viewed and/or modified. Only the •the color of the elements.
interface of the window is created. The code
needs to be written by the developer. 6.2.5 Internal window
- standard: This window will not necessarily be lin-
ked with the analysis. An internal window is a window with no title bar, no status
3. Specify the window’s skin template. bar, ... that will be included directly into other windows of
4. Depending on the type of window chosen, enter your application through the "Internal window" control.
the requested information in the various screens of This way you can include a window (and its code) into
the wizard (these screens vary depending on the another window.
selected window). To create an internal window:
5. Validate the creation of the window. 1. Select "File .. New .. Window".
2. Select the "Internal window" tab.
6.2.4 Importing a window from a non-WinDev 3. Select the type of window you want and the asso-
application (WinDev only) ciated skin template.
You are interested by a window found in a non-WinDev 4. Validate.
application? You want to retrieve its interface? Nothing’s Notes: Two specific additional pieces of code are asso-
easier, WinDev lets you import windows from non-WinDev ciated with internal windows:
applications. The window is imported into the current
WinDev project. Each window element is automatically • Assigning the ..Value property
changed into a WinDev element (static control, edit con- • Retrieving the ..Value property
trol, button, and so on). These pieces of code are used to communicate between
Note: All the elements found in the window are imported the main window and the window found in the Internal
but you may have to modify the window in order to get the Window control.
requested interface. For more details about internal windows, see the online
help (keyword: "Internal Window").
Tome1_2.book Page 80 Vendredi, 28. mai 2010 5:50 17

80

6.2.6 Window based on a template skin template.


WinDev also lets you create a window based on a window 4. Validate.
template. In this case, simply select the window template The modifications performed in a window template are
you want. automatically applied to all the windows that use this
Window templates contain all the graphic elements and template.
code common to all the windows in your application. A window template enables you to comply with the style
book defined for an application.
To create a window based on a template: See the online help for more details about window tem-
1. Select "File .. New .. Window". plates.
2. Select the "Based on a template" tab.
3. Select the template you want and the associated

6.3 Simple window operations


6.3.1 Opening a window 6.3.4 Importing and exporting a window
To open a window: Importing a window allows you to copy an existing win-
1. Select: dow and to associate the copy with the current project.
- "File .. Open" (Ctrl + O). Exporting a window allows you to copy a window and to
- "Window" in the pull-down list on the right of the associate the copy with an existing project.
icon .
To import a window:
2. Select the window to open.
Part 2: Creating an application, a site

1. In the window editor, select "File .. Import .. Win-


Other operations: Dev elements and their dependencies".
- Double-click the name of the window displayed in the 2. Choose the window to import (".WDW" type file
"Project" tab. or ".WPW" type file).
- Double click the representation of the window in the 3. Validate the file’s import. The window file and all
project diagram, in the project editor. the objects linked to the window (image file, OLE file,
etc.) will be automatically copied into the directory of
6.3.2 Modifying the size of a window the current project.
To modify the size of a window: To export the current window:
1. Click one of the window’s borders and keep the 1. Select "File .. Export .. To a directory". The file
mouse button down: the cursor turns into a double corresponding to the current window (".WDW" or
arrow. ".WPW" extension) is automatically selected from
2. Move the mouse until you get the size you want. the files to export.
3. Release the mouse button. 2. Specify the project directory where the window
The same operation can be performed in order to modify must be exported.
the work window (where your WinDev window is dis- 3. Validate the window’s export. The window’s file
played). and all the objects linked to the window (image file,
OLE file, etc.) will be copied automatically in the
6.3.3 Save and copy a window directory of the specified project.
To save a window: 6.3.5 Modifying the tab order
1. Select "File .. Save" (save icon ). The tab order of window controls is the order in which the
2. Specify the name if needed. The window corres- controls take focus when the user presses the [Tab] key.
ponds to a ".WDW" file for WinDev or ".WPW" file By default, the tab order corresponds to the order in
for WinDev Mobile. which the controls have been created.
By default, this file is created in the main directory of
the project. This name will be used to handle the win- The tab order only applies to controls managed by the
dow. [Tab] key. You can define whether a control is managed
by the [Tab] key in the "Details" tab of the description
To copy a window: window of each control.
1. Select "File .. Save as".
2. Enter a new name. This name must be different The [F5] key (or "Windows .. Tab order .. Edit") lets you
from the name of the original window. see the tab order of all the controls found in a window.
Tome1_2.book Page 81 Vendredi, 28. mai 2010 5:50 17

81

remains selected when the mode changes back to two


dimensions.
You have the ability to choose the best view angle via the
mouse and via the keyboard keys.
To display your windows in 3 dimensions:
1. Display the window in the editor.
2. Select "Display .. Show the window in 3D".
3. The window is displayed in 3D. The mouse or the
keyboard can be used to optimize the view of the
window.
Possible actions when displaying a window in 3D
In 3-dimensional mode, only some actions are available
To modify the tab order, select "Windows .. Tab order .. for the window controls. You can for example:
Edit" and use the arrows on the right.
•select a control.
6.3.6 Viewing a window in the 3 dimension •display the description of the control.
mode •display the source code of the control.
Your window displays controls that overlap? Conditions required for using the 3D view of a window
You want to find out the z-order position of your controls: To display your windows in 3 dimensions, the current
which controls are displayed in the foreground? computer must be equipped with:
The two-dimensional display soon becomes inadequate

Part 2: Creating an application, a site


•DirectX version 8.0.A (or later).
for this type of operation.
•A 3D accelerator card with up-to-date drivers.
WinDev lets you view your window in three dimensions.
•a display mode in 16 bits or 32 bits.
The z-order position of the window controls is immedia-
tely visible. A control selected in this display mode

6.4 Managing a window’s versions


The window editor allows you to manage the different ver- 6.4.1 Saving a version
sions of each window. Saving a version allows you to keep a backup of the win-
Managing a window’s versions allows you, for instance, dow at a given time.
to keep the history of the main modifications performed
on a window. No need to save the same window under To save a version of the current window:
different names for each new version: the different ver- 1. Select "File .. Versions". The window displaying
sions are automatically managed by the window editor the current window’s versions comes up.
and included in the window’s file. 2. Click the "New" button. A window allows you to
A window corresponds to a ".WDW" file (for WinDev) or enter your own comments about the version to
".WPW" file (for WinDev Mobile). This file contains the create.
description of the window as well as all the versions 3. Validate. The new version is saved and the current
saved for this window. The size of the ".WDW" or window is saved automatically.
".WPW" files are proportional to the number of versions Note: the different versions of a window are listed in
saved. decreasing order (from the most recent to the oldest)
The window editor enables you to: according to the date when they were saved.
•save a new version of the current window. 6.4.2 Opening a version
•open a version of the current window. Opening a version allows you to create a new window cor-
•delete a version of the current window. responding to the selected version.
These operations are described in the following paragra-
phs. To open one of the versions of the current window:
1. Select "File .. Versions". The screen displaying
Note: This feature is also available for reports and que- the window’s versions comes up.
ries. See the "Report editor and query editor" guide for 2. Select the version to open.
more details. 3. Click the "Open" button. A new window is created
Tome1_2.book Page 82 Vendredi, 28. mai 2010 5:50 17

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

7. PAGES AND FRAMESETS WB

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

Part 2: Creating an application, a site


• Static pages green background.
• Semi-dynamic pages Dynamic page
• Dynamic pages A dynamic page contains data from a database. It also
• PHP pages lets you enter data in forms.
The type of the page can be modified in the description This page is created only once. The data displayed in this
window of the page. See ’Pages’, page 286, for more page varies based on the user or the query performed by
details about page characteristics. the user.
For instance: A page describing a product selected by the
Static page user.
A static page contains stable data (not coming from a In the project editor, dynamic pages are displayed on a
database). white background.
For instance: a company overview page. Note: By default, WebDev dynamic pages manage a con-
In the project editor, static pages are displayed with a text. This context enables you to store all the global varia-
light green background. bles of the page. You can also manage WebDev dynamic
Semi-dynamic page pages without context (dynamic page in AWP mode).
A semi-dynamic page is a static page template. This page PHP page
template is used to display data coming from a data- A PHP page is a dynamic page displaying data through a
base. PHP engine.
This template enables you to generate a static page for In the project editor, PHP pages are displayed on a black
each record found in the database. background.
For instance: A description page from a book. If the data- Note: by default, dynamic PHP pages do not manage the
base contains 10 books, 10 static pages will be created context; the information global to the page are not kept
when generating the project. and cannot be used by the various controls. You can
This type of page is useful for sites stored on CDs. This is manage PHP pages with context.
because the database is not required in order to display
Tome1_2.book Page 84 Vendredi, 28. mai 2010 5:50 17

84

7.1.2 Site types Examples of sites


Two types of sites can be built: The table below presents some examples of static sites
• static sites. and dynamic sites:
• dynamic sites.
Static site Dynamic site
The following table presents the main differences • site presenting a com- • catalog of products with
between a static site and a dynamic site: pany, a region, … real-time management
Static site Dynamic site • site of an association of orders
• personal site • site for travel bookings
The content of the pages is The data displayed in the
fixed, it is defined once pages changes. • site of a daily newspaper • site for stock manage-
and for all. In most cases, the pages •… ment (Intranet)
A static site cannot inte- are used to: •…
ract with data. • perform processes and/ Note: A dynamic site can contain a static section (des-
or calculations by pro- cription of the company, and so on).
gramming.
• display the data stored 7.1.3 Languages supported in a page
in a database. A page can support up to 20 languages. The languages
• display images and inte- supported in the page are the ones selected in the page
ractive text. description ("Language" tab).
The captions, notes, messages, ... can be entered in the
Part 2: Creating an application, a site

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.

7.2 Creating a page


WebDev offers several ways of creating a page: created.
•Creating blank pages, without any controls. 5. Save the page ("File .. Save").
•Creating preset pages (Dynamic RAD type, semi- 6. Specify the page’s name. The page corresponds
dynamic RAD type, PHP or standard RAD type). to a ".WWH" file. By default, this file is created in the
main directory of the project. This name will be used
•Creating pages via the project RAD. to handle the page.
Note: the main characteristics of the pages are detailed 7. Create the page controls.
in the ’Pages’ chapter, page 286. By default the created page is a dynamic page. The type
of the page can be modified in the description window of
7.2.1 Creating blank pages the page. See ’Pages’, page 286, for more details about
To create a blank page: page characteristics.
1. Select "File .. New .. Page". The different types of controls are presented in the ’Con-
2. Select the "Blank" type. trols’ chapter, page 251.
3. Specify the page template.
4. Validate the creation of the page. A blank page is
Tome1_2.book Page 85 Vendredi, 28. mai 2010 5:50 17

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).

Part 2: Creating an application, a site


pages of your project in the editor. 5. If needed, associate an image with each file. This
3. Depending on the selected type of page, enter the

7.3 Simple operations on a page


7.3.1 Opening a page to associate the copy with the current project.
To open a page: Exporting a page allows you to copy a page and to asso-
1. Select: ciate the copy with an existing project.
- "File .. Open" (Ctrl + O).
To import a page:
- "Page" in the drop-down list to the right of . 1. In the page editor, select "File .. Import .. WebDev
2. Select the page to open. elements and their dependencies".
Other operations: 2. Select the directory where the import must be
- Double-click the name of the page displayed in the performed.
"Project" pane. 3. Choose the page to import (".WWH" type file).
- Double click the representation of the page in the pro-
ject diagram, in the project editor.
4. Validate the file’s import. The page’s file and all
7.3.2 Saving and copying a page the objects linked to the page (image file, etc.) will
be copied automatically in the directory of the cur-
To save a page: rent project.
1. Select "File .. Save" (save icon ).
2. Specify the name if needed. The page corres- To export the current page:
ponds to a ".WWH" file. By default, this file is crea- 1. Select "File .. Export .. To a directory". The file
ted in the main directory of the project. This name corresponding to the current page (".WWH" exten-
will be used to handle the page in your code. sion) is automatically selected from the files to
export.
To copy a page: 2. Specify the project directory where the page
1. Select "File .. Save as". should be exported.
2. Enter a new name. This name must be different 3. Validate the page’s export. The page’s file and all
from the name of the original page. the objects linked to the page (image file, etc.) will
be copied automatically in the directory of the speci-
7.3.3 Importing and exporting a page fied project.
Importing a page allows you to copy an existing page and
Tome1_2.book Page 86 Vendredi, 28. mai 2010 5:50 17

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.

7.4 Managing a page’s versions


The page editor enables you to manage the different ver- responding to the selected version.
sions of each page.
To open one of the versions of the current page:
Managing the versions of a page allows you to keep the 1. Select "File .. Versions". The window for the
history of the main modifications performed on a page. page’s versions is displayed.
No need to save the same page under different names for 2. Select the version to open.
each new version: the different versions are automati- 3. Click the "Open" button. A new page is created in
cally managed by the page editor and included in the the page editor. This page corresponds to the selec-
page’s file. ted version. The name of this new page has the fol-
A page corresponds to a ".WWH" file. This file contains lowing format: <Page Name><Date and Time of
the description of the page and all the saved versions for Version Backup>.
Part 2: Creating an application, a site

this page. The size of the ".WWH" file is proportional to


the number of versions saved. Tip: This new page can replace the original window. To do
so, close the original page and save the new page under
The page editor enables you to do the following at any the same name as the original page. Caution: All the ver-
time: sions of the source query will be lost.
•save a new version of the current page.
•open a version of the current page. 7.4.3 Deleting a version
•delete a version of the current page. Deleting a useless version reduces the size of the
"WWH" file corresponding to the page.
These operations are described in the following paragra-
phs. To delete a version of the current page:
Note: This feature is also available for reports and que- 1. Select "File .. Versions". The window for the
ries. See the "Report editor and query editor" guide for page’s versions is displayed.
more details. 2. Select the version to delete.
3. Click the "Delete" button. The selected version is
7.4.1 Saving a version automatically deleted from the window for version
management. This deletion will be effective the next
Saving a version allows you to keep a backup of the page time the page is saved.
at a given time.
To save a version of the current page: 7.4.4 Opening files after a system lockup
1. Select "File .. Versions". A window with the cur- To avoid problems when a system lock occurs (power
rent page’s versions is displayed. outage for instance), WebDev can automatically restore
2. Click the "New" button. A window allows you to the open pages in the page editor ("Tools .. WebDev
enter your own comments about the version to options .. Backup .. Backup for automatic restore").
create. When this system is enabled:
3. Validate. The new version is saved and the current •an automatic backup of the open pages is regularly
page is saved automatically. performed at specific time intervals (every 10 minu-
Note: the different versions of a page are listed in tes by default).
decreasing order (from the most recent one to the oldest •when re-opening a page after a system lockup, a res-
one) according to the date and time when they were tore window is displayed. This window offers to
saved. retrieve:
- the page as it at was during the last backup per-
7.4.2 Opening a version formed by the developer.
Opening a version allows you to create a new page cor- - the page automatically saved by WebDev.
Tome1_2.book Page 87 Vendredi, 28. mai 2010 5:50 17

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.

7.5 Creating a frameset


Several methods can be used to create a frameset: The different types of controls and their operations are
1. Creating a blank frameset. presented in the ’Controls’ chapter, page 251.
2. Using a preset frameset.
7.5.2 Creating a preset frameset
7.5.1 Creating a blank frameset To create a preset frameset:
To create a blank frameset: 1. Select "File .. New .. Page".
1. Create a blank page. 2. Display the "Frameset" tab.
2. Select "Frame .. New blank frameset". 3. Choose the type of frameset.
3. Add frames to the frameset if needed ("Frame .. 4. Validate the creation of the frameset. A frameset
Vertical split" or "Frame .. Horizontal split"). is created.
4. Save the frameset ("File .. Save") and specify the 5. Save the frameset ("File .. Save") and specify the
name of each page found in the frameset as well as name of each page found in the frameset as well as
the frameset’s name. The pages and the frameset the frameset’s name. The pages and the frameset
correspond to ".WWH" files. By default, these files correspond to ".WWH" files. By default, these files
will be created in the main directory of the project. will be created in the main directory of the project.
5. Create the frame controls. 6. Create the frame controls.

Part 2: Creating an application, a site


The different types of controls and their operations are
presented in the ’Controls’ chapter, page 251.

7.6 Simple operations on a frameset or on a frame


7.6.1 Associating a frame with a page files. By default, these files will be created in the
To associate a frame with a page: main directory of the project.
1. Click inside a frame. To copy a frameset:
2. Open the page associated with the current frame 1. Select "File .. Save as".
("File .. Open"). 2. Enter a new name. This name must be different
The opened page appears in the current frame. from the name of the original frameset.
3. Confirm the addition of the frameset to the cur-
7.6.2 Opening a frameset rent project.
To open a frameset:
1. Select: 7.6.4 Importing and exporting a frameset
- "File .. Open" (Ctrl + O). Importing a frameset allows you to copy an existing fra-
- "Frameset" in the drop-down list to the right of meset and to associate the copy with the current project.
. Exporting a frameset allows you to copy a frameset and
2. Select the frameset to open. to associate the copy with an existing project.
Other operations:
- Double-click the name of the frameset displayed in To import a frameset:
the "Project" pane, "Pages" option. 1. In the page editor, select "File .. Import .. WebDev
- Double-click the representation of the frameset in the elements and their dependencies".
project graph, in the project editor. 2. Select the directory containing the frameset to
import. The list of WebDev elements is automatically
7.6.3 Saving and copying a frameset displayed. This list is made of:
To save a frameset: •the name of the file.
1. Select "File .. Save" (save icon ). •the description of the file (if it exists).
3. Select the frameset to import. A checkmark is dis-
2. Specify the name of the pages associated with
played in front of the selected file.
each frame as well as the frameset name if needed.
The pages and the frameset correspond to ".WWH"
Tome1_2.book Page 88 Vendredi, 28. mai 2010 5:50 17

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, …

8.1 Report types


The report creation wizard offers a large number of report - Custom mailing: print a preset letter for each record
types: read in the data source.
- Free report (blank): report to customize. - Report on scanned background: print the records of
- Table report: print one row for each record read in the the data source in a preset form.
data source. - Crosstab report: print a double-entry summary table.
- Form report: print one form for each record read in Enables you to view product sales per month for ins-
the data source. tance.
- Label: print one or more labels per record read in the
data source.

Part 2: Creating an application, a site


8.2 Creating a report
To create a report: •the format to apply to the report.
1. Select "File .. New .. Report". The wizard for crea- • the skin template of the report. This skin template
ting reports starts. enables you to customize the report’s look.
2. Select the type of report to create. • the name of the report. This name will be used to
3. Specify: handle the report.
• the data source of the report: query, file, table, ... 4. Validate the creation of the report.
To print, the report reads the specified data source. 5. The created report becomes the current report.
• the items to print in the report and specify their 6. Create additional controls in the report if needed.
caption and location in the report.
Tome1_2.book Page 90 Vendredi, 28. mai 2010 5:50 17

90

9. REFERENCE A SITE WB

9.1 Referencing principles


In order to visit your site, Web users must be able to find This solution allows you to reference dynamic pages for
it. To do so, your site must be proposed when the instance, by associating keywords with the home page.
keywords corresponding to your site are typed by the Web This home page contains all the keywords that will
user in a search engine. allow the Web users to find your site.
To help you, WebDev proposes: Note: to optimize the referencing of your pages in search
• A reference for each static and AWP page: a descrip- engines, we recommend you use AWP pages. To refe-
tion and a set of keywords can be defined for each rence a dynamic site, use:
page. These keywords will allow the Web users to • a home page.
access the page directly. You can also choose not to • a section of the site in static mode. The static site will
reference a page. be used to perform the referencing and to start the
• A referencing wizard, specifying for each page the dynamic site.
improvements that can be performed to optimize the • a section of the site in AWP mode. The AWP site will be
referencing. used to perform the referencing and to start the dyna-
• To include or to use a specific page as home page. mic site.
Part 2: Creating an application, a site

9.2 Referencing or not a static or AWP page of a site


To reference a static or AWP page of your site: You can:
1. Display the description window of the page. •Avoid referencing the current page.
2. In the "Details" tab, a specific area is used to •Reference the current page by associating it with
manage the referencing of the page. expressions and keywords ("Edit the expressions
and keywords").

9.3 Referencing a page and entering its keywords


To reference a static or AWP page of your site: enter the keywords associated with the page. These
1. Display the description window of the page. keywords (or expressions) will be the keywords used
2. In the "Details" tab, a specific area is used to to reference the page: if the user enters one of these
manage the referencing of the page. In this area, keywords, the search engine will offer the correspon-
click the "Edit the expressions and keywords" but- ding page. The keywords are entered as follows:
ton. enter the first keyword then press [ENTER] to enter
3.In the "Description" tab of the referencing win- the next one.
dow , enter the page’s description. In most cases, Some tips:
this description appears when displaying the result •The first three keywords are the most important
of a search performed by a search engine. Some ones. Use usual keywords and distinguishing
tips: keywords.
•Use short sentences, limit the number of words (up •The keywords must not be repeated.
to 200 characters) •Use variations (singular/plural, noun/verb, …).
•This description must entice the Web users to dis- Note: these keywords can be modified dynamically
play the page. with the ..Keywords property.
Note: this description can be modified dynamically 5. Validate the referencing window, then the page
with ..Description. description window.
4.In the "Keyword" tab of the referencing window,
Tome1_2.book Page 91 Vendredi, 28. mai 2010 5:50 17

91

9.4 Using the referencing wizard


To help you optimize the referencing of your sites and To start the referencing wizard for a page:
pages, WebDev proposes a referencing wizard. This 1. Display the requested page in the editor.
wizard can be used for a specific page or for all the pages 2. Select "Page .. Optimize the referencing of the
of your project. This wizard analyzes the composition of page".
the site pages and indicates the possible improvements 3. The referencing wizard starts. Double-click a sug-
for maximizing the positioning of the pages in the search gestion to perform the corresponding optimization.
engines. The "Refresh" button is used to update the list of
Some examples of optimizations detected by the wizard: suggestions.
• The title of the page must be specified. To start the referencing wizard for all the pages of a site:
• At least three keywords must be specified for the page. 1. Select "Project .. Performance and improvements
• The description of the page must be specified. .. Optimize the referencing".
• The alternative text must be entered for all the controls 2. The referencing wizard starts. Double-click a sug-
that offer it (by using the keywords defined for the page gestion to perform the corresponding optimization.
if possible), … The "Refresh" button is used to update the list of
suggestions. The results can be sorted by page or by
type of advice.

9.5 Including a home page in your site

Part 2: Creating an application, a site


A home page can be included in your site: If no home page is associated with your project, you can:
• during the project creation. You have the ability to • choose a home page among the static pages of your
choose a preset home page. site
• during the creation of a new page ("File .. New .. • choose a preset home page.
Page", "Blank/Templates" tab, "Home" option).

9.6 Listing your site in the search engines


The referencing of your site is performed on the search These search engines reference sites that have been
engine directly. previously checked by human beings.
Note: the referencing of a site may sometime carry a fee.
How can I be referenced?
Two types of search engines are available: A "Reference your site" link is often available for this
• the "Automatic" search engines: type of search engine.
These search engines are based on automatic pro- In most cases, the procedure for referencing your site is
grams for analyzing the content. as follows :
1. Choosing a category for the site (leisure, culture,
How can I be referenced ? and so on).
A "Reference your site" link is often available for this 2. Fill out a questionnaire about the site to reference:
type of search engine. Then, all you have to do is spe- Internet address of the site, Webmaster email, descrip-
cify the address of the site and the email of the Web- tion of the site, …
master. The site will be automatically analyzed 3. Once your questionnaire has been sent, your site will
(according to the keywords and to the content of your be evaluated by a person from the company that
site) and referenced. manages the directory. This person will list your site if
• the "Directory" search engines : its content appears to be worthwhile.
Tome1_2.book Page 92 Vendredi, 28. mai 2010 5:50 17

92

10. TESTING AN APPLICATION, A SITE


10.1 Overview
WinDev, WebDev and WinDev Mobile offer several be started as soon as a problem occurs.
methods to test your applications and your sites: Testing a query only lets you run only the current query.
- test of the entire project, This enables you to check the operating mode of a query
- test of a single window or page, as soon it is developed.
- test of a single query (see the "Reports and Queries" Testing a report only lets you run only the current report.
book for more details), This enables you to check the operating mode of a report
- test of a single report (see the "Reports and Queries" as soon as it is developed. Like for the test of the project,
book for more details), the debugger can be started as soon as a problem
- running the project step by step, occurs.
- testing your application’s performance.
- regression and automated tests Executing the project step by step enables you to start
- stress test (WebDev only), the debugger when starting the application or the site.
This solution enables you to closely monitor the progress
Testing the entire project allows you to simulate the run- of the application or the site.
ning of the application by the executable or the running of The performance test of your application or site lets you
the site. You can test your entire application/site, even if check and optimize the execution time of your application
Part 2: Creating an application, a site

its development is not finished. As soon as a problem or site.


occurs, you can run the debugger to find out and fix the The regression test (or automated test) is based on run-
problem. ning scripts. It lets you check during your site or your
Testing a window or a page only lets you run only the cur- application’s execution, ... the existing features are
rent window/page. This enables you to run the test of always supported.
your project from a given window or page or to check the The stress test lets you starts several simultaneous con-
operating mode of a window or page as soon as it is deve- nections to the same dynamic site.
loped. Like for the test of the project, the debugger can

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.

Part 2: Creating an application, a site


computer). Therefore, the code of the current project and This method can also be used to start the debugger
the code of the executable can become out-of-sync: the when a long process (containing Multitask statements)
out-of-sync code is underlined in pink when debugging. seems to loop endlessly.
• Starting the debugger from the editor. In this case,
To start and debug the executable: perform the following operations:
1. Open the project associated with the executable - Click the WinDev icon in the taskbar.
in the editor. - Answer "No" to the question "Do you want to stop
2. Select "Project .. Test mode .. Start and debug the test?".
the executable". - In the "Code" pane, "Debugger" option, click the
3. Specify the options that must be taken into icon shaped as a hand.
account during the test:
To stop the test, several methods are available:
•the executable to run. This executable must corres- -1st method:
pond to the project opened in the editor. Close the application whose test is currently running.
•the command line to run (if necessary). WinDev displays the editor that was used when the
•the Windows account that must be used to start test was started.
the executable. If this account differs from the cur- -2nd method:
rent user, the user must have been defined on the - Use the task bar or use [Alt] + [Tab] to return to the
current computer. His login, his password and his editor.
domain must be specified. - Confirm the stopping of the test. WinDev displays
4. Validate. The test is run. the editor that was used when the test was started.
Note: In project test mode, non-fatal errors are ignored.
10.2.4 Debugging an executable that is
already running on the development computer 10.2.6 Configuring the test mode
Some problems can only be reproduced when running Command line
the test of the executable in real-use conditions. To run the test of a project by using a command line, this
This test mode enables you to find a problem that only command line must be specified via "Project .. Test
occurs at run time (and not in test mode). Mode .. Configure the test mode".
In this case, the code run comes from the libraries (and The different elements of the command line will be
not from the code found in the elements found on the passed in parameter to the current program.
computer). Therefore, the code of the current project and Reminder: these parameters can be known by program-
the code of the executable can become out-of-sync: the ming through the CommandLine function.
out-of-sync code is underlined in pink when debugging.
Tome1_2.book Page 94 Vendredi, 28. mai 2010 5:50 17

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

Runtime directory a manifest. This manifest can be included in the executa-


WinDev enables you to run the test of the project in a ble of your project when creating the executable.
directory other than the "EXE" directory of the project. Using a manifest enables you to specify the level of rights
Therefore, the test is run in conditions close to the ones required to run the application.
found on the end-user computers. The available manifests are as follows:
To modify the runtime directory of the application: •No manifest
1. Select "Project .. Test Mode .. Configure the test •No privilege
mode". Expand the option about the "Advanced •Maximum privileges of the user
modes (Windows Vista, UAC, etc.).
2. In the "Execution directory" tab, select the "Run •Administrator privileges
test mode in the real execution directory:". Other user account
3. Select the requested runtime directory.
WinDev enables you to run the test of the project in a
4. The data files taken into account are the files
directory by using a user account different from the cur-
found in the specified directories:
rent one. This enables you to run the test of the project by
•in the project description using rights other than the rights granted to the user cur-
•in the description of the user groupware if the user rently connected.
groupware is used by the application. Indeed, in most cases, you are the administrator of your
5. Click the "Copy the files" button. For each data computer when developing an application. On the con-
file, you can choose the directory into which this file trary, the users of your applications are simple users in
must be copied: most cases. This operating mode is even truer in Win-
•a directory offered by default: dows Vista.
- <RuntimeDir>: Standard runtime directory of WinDev allows you to run the test of your applications as
the application. This directory is identical to a standard user: you can quickly identify all your applica-
the one chosen in the "Runtime directory" tions problems due to invalid rights, and therefore correct
tab. your applications if necessary.
- <DirUserData>: Standard data directory of Note: we recommend you combine this option with:
the application for a specific user. In Windows •the use of a runtime directory. For Windows Vista, the
XP/Vista, this directory uses the format: runtime directory and the data directory must corres-
"C:\Documents and Settings\<User>\Appli- pond to the Vista standards.
cation Data\<Company Name>\<Application
•the use of a manifest (if your development computer
Name> runs on XP).
- <DirCommonData>: standard data directory
Tome1_2.book Page 95 Vendredi, 28. mai 2010 5:50 17

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

Part 2: Creating an application, a site


computer application as well as its command line must be speci-
• Debugging an application currently running on a fied (if it exists).
remote computer. • "Allow the application to be restarted" allows you to
For these two features, a specific configuration of the transfer the information regarding an application cur-
remote computer is required. rently running into the parameters in order to allow the
application to be started. Indeed, the developer may
Note: to remotely debug a WinDev application, the Win- want to restart the application in order to reproduce
Dev application must include the WD150CPL.DLL library the bug.
in its framework.
10.3.2 Running and debugging the executable
10.3.1 Configuring the remote computer on a remote computer
To debug a WinDev application on a remote computer, To run and debug an executable on a remote computer:
you must: 1. Open the relevant project in WinDev.
• open ports 27270 and 27280 if a firewall is used. 2. Contact the user in order to configure his compu-
Indeed, the communication between the development ter.
computer and the end-user computer is done via soc- 3. Select "Project .. Test mode .. Start and debug
kets. These ports can be customized. See "Advanced the executable on a remote computer".
setting of debugging ports" for more details. 4. In the window that opens, enter the name or IP
• install and run the WDDebug application on the end- address of the remote computer and click the
user computer. WDDebug can be supplied with the "Refresh" button. The name of the application to
application (application available in the additional debug is displayed. This name corresponds to the
modules when creating the setup). application specified by the end user.
Note: WDDebug is an application that can be provided 5. Validate.
separately. A setup pack is available in the "Ins- 6. The application is started in debug mode on the
tall\WDDebug" subdirectory of the setup directory of user computer. The user can handle the application
WinDev (WX150PACKWDDEBUG.exe). while you can follow the code run via the debugger
(by including breakpoints in the sections of code
Note: on a TSE session, WDDebug does not list the exe- where the problems occur).
cutables of the other session available on the machine.
For instance, you cannot trace an executable started on Note: the code can be out-of-sync between the project
the console from a TSE session on the computer. code in the code editor and the executable’s code; the
out-of-sync code is underlined in pink when debugging.
Configuring WDDebug
Tome1_2.book Page 96 Vendredi, 28. mai 2010 5:50 17

96

10.3.3 Debugging an executable that is the executable on a remote computer".


already running on a remote computer 4. In the window that opens, enter the name or IP
To debug an executable that is already running on a address of the remote computer and click the
remote computer: "Refresh" button. The list of applications available
1. Open the relevant project in WinDev. on the remote computer is displayed.
2. Contact the user in order to configure his compu- 5. Select the requested application and validate.
ter. 6. The application is in debug mode.
3. Select "Project .. Test mode .. Start and debug

10.4 Run the test of a WebDev project WB

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

Part 2: Creating an application, a site


the editor that was currently used at the begin- •When the test is run from the test page of the admi-
ning of the test. nistrator, the programming errors are displayed in a
browser page. This error page contains the message:
Note: In project test mode, non-fatal errors are ignored. "The application generated the following error: …".
Important notes:
10.4.5 Testing the project from the WebDev • We advise you to run the test of the project with several
administrator browsers.
Running the test from the WebDev administrator • The use of the site test from the test page started by
(WD150Admin) is used to check: the WebDev administrator enables you to run the test
•the features of the site. of the WebDev site in real configuration.
•the specific Web features (use of cookies, …). • The operating mode of the test engine of WebDev (sup-
Note: The WebDev administrator only allows you to test plied with the WebDev application server) and the ope-
dynamic sites or the dynamic part of static + dynamic rating mode of the WebDev engine installed at the host
sites. (supplied with the WebDev application server) may sli-
ghtly differ. The possible differences in operating mode
Running the test from the WebDev administrator is equi- are minor, they are mainly caused by the debugging
valent to running the site from a remote computer. allowed by the test engine.
Before deploying a WebDev site, we recommend that you • We recommend that you run the test all of the site fea-
test this site at least once from the WebDev administra- tures as well as the use of the browser Back key. For
tor. more details about the management of the "Back"
To run the test from the WebDev administrator: browser key, see the ’Managing the "Back" key’ chap-
1. Start the WebDev administrator ("Tools .. ter, page 259.
WD150Admin - WebDev administrator").
2. Click the "Test Page" button ("Configuration" 10.4.7 Testing a project from a test server
tab). Before deploying your site, we recommend that you run
To stop the test, display the WebDev administrator (by the final tests from a test sever. In this case, you need to
install the following elements on the test server:
clicking found in the taskbar), and click the "Discon-
•Your WebDev site,
nect" button ("Connections" tab).
•An Internet browser,
Note: The WebDev administrator also allows you to per- •The "demonstration" engine of WebDev. This engine
form a test of the project that is equivalent to testing the is available from the WebDev "Deployment version"
project from the editor: installation CD),
1. Start the WebDev administrator ("Tools ..
•An Internet browser,
Tome1_2.book Page 98 Vendredi, 28. mai 2010 5:50 17

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.

10.5 Testing a remote WebDev site WB

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

10.6 Testing a WinDev Mobile project WDMobile

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-

Part 2: Creating an application, a site


ming through the CommandLine function.
To test a project in simulator mode, select "Project .. Test
mode .. Test Project (simulator)" ([Ctrl] + [F9]). The edi- 10.6.5 Using functions for handling CEDB data-
tor is automatically minimized and the project is run. bases
When running the test of the project, the following pro- Your application accesses a database of the Pocket PC
cesses are run before the first project window is opened: (cdbXXX functions). The test mode operates as follows:
•declaring the classes •If a Pocket PC is connected to the development com-
•initializing the project puter, the functions for handling a CEDB database
•declaring the global variables of the first window will handle the database of the connected Pocket PC.
•initializing the first window •A WLanguage error occurs if no Pocket PC is connec-
•initializing the controls found in the first window ted to the current computer during the simulation.
•taking focus (first window)
10.6.6 Directory of the files used for test
•entering the first control of the first window (if this
control has an entry process) To configure the data files used when running the test of
the application in the editor:
Note: To get test conditions that are the closest possible 1. Display the project description ("Project .. Project
to reality, the test is performed in an interface correspon- description").
ding to the development platform of your application 2. In the "File" tab, select the location of the test
(Pocket PC, Smartphone, etc.). See the online help for files:
more details about customizing this interface. •Current directory: the data files will be located in
the EXE subdirectory of the project.
10.6.2 Testing and debugging on the Pocket •Specified directory: the data files will be located in
PC connected to the development computer the specified directory on the development compu-
To run the test of the current application on the Pocket PC ter
while using the debugger of WinDev Mobile: Note: When running the test of the application, the data
1. Click the arrow located to the right of the "GO" files used are the ones on the development computer.
icon. The file system also corresponds to the Windows system
2. In the drop-down menu, click "Debug project". for PC. To avoid any problem when actually using the Poc-
ket application, use the OnTestMode function to differen-
tiate between data access during test run and live run.
Tome1_2.book Page 100 Vendredi, 28. mai 2010 5:50 17

100

10.6.7 Stopping the test of a project Pocket PC application is running.


In simulation mode, several methods can be used to • 3rd method: go back to the editor by using the task bar
stop the test: or [Alt] + [Tab] and confirm the stopping of the test.
• 1st method: Close the application whose test is cur- WinDev displays the editor that was used when the test
rently running (use an option that closes the applica- was started.
tion for instance). WinDev displays the editor that was When the test is directly run on the Pocket PC, all you
used when the test was started. have to do is stop the application on the Pocket PC.
• 2nd method: close the window where the test of the

10.7 Testing a window WD WDMobile

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 Testing a page WB

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

Part 2: Creating an application, a site


10.9 Tracing a project
10.9.1 Debugging principles variables).
Debugging an application consists in:
10.9.3 Starting the debugger
•checking the operating mode of a process,
Several methods can be used to start the debugger:
•understanding the operating mode of an existing pro- 1. As soon as the test of the project starts by ena-
gram, bling "Project .. Test mode .. Trace the project".
•checking the value of the variables, The debugger is started when the project is run.
•checking the behavior of exception cases in an appli- This method is recommended if you want to check
cation or a site. the project’s initialization processes and the first
window’s processes.
The debugger enables you to perform all these opera-
tions. 2.When interrupting the test by pressing the [Ctrl] +
[Pause] keys.
Note: WinDev and WebDev also provide various trace The action performed once the [Ctrl] + [Pause] key
tools (trace window, information box, etc.). See the have been pressed (click on a button, …) will start
’Debugging without the debugger’ paragraph, page 109, the debugger. This option is not available in WebDev.
for more details.
3.By programming by adding to the code the Stop
10.9.2 Overview of the debugger keyword at the point where the debugger needs to
start.
The debugger lets you trace your WLanguage programs in This method is recommended when the processes
order to help you fine tune them. from which the debugger must be started is identi-
The source code run is viewed on the screen. The diffe- fied.
rent processes run are classified in the "Code" pane Note: the Stop keyword is taken into account only
("Debugger" option). when testing the application in the WinDev/WebDev
The values of the variables can be viewed: editor. When using the executable or the site, the
•individually in the rollover tooltip of each variable. Stop keyword is ignored.
4.In the code editor by adding a breakpoint in the
•in the "Code" pane, "Debugger" option ( to code where you want to start the debugger. See the
view the local variables and to view the global online help for more details about break points.
Tome1_2.book Page 102 Vendredi, 28. mai 2010 5:50 17

102

5.From an expression specified in the debugger. 10.9.7 Expression to evaluate


See ’Expression to evaluate’, page 108, for more The debugger enables you to insert an expression to eva-
details about expressions. luate. This expression can have any type: variable, func-
tion, operation on variables, ... The result of the
10.9.4 Running code expression is calculated and displayed.
Once the debugger is enabled, each operation perfor- This expression is used to perform a custom debugging.
med in the application positions the cursor of the debug-
ger (represented by the arrow ) on the code currently For example, you have the ability to find out the content
running. You can then continue the execution of the code: of a variable as it is used in the application.
1. line by line. An expression can be self-stopping: for instance, the
To run the current code line, use: debugger can start as soon as a connection has been
•the [F7] key or to run the code of the line and the verified or when the value of a variable is modified.
code of the procedures called by this line. The execu- For example, in a mailing sent to 40,000 customers, a
tion of the line and the execution of the procedures problem occurs on number 12345. To start the debugger
called by the line will be viewed in the debugger. as soon as the customer number is equal to 12345, all
•the [F8] key or to run the code of the line and the you have to do is define the following expression as being
code of the procedures called by this line. Only the auto-stop:
execution of the line will be viewed in the debugger. Customer.CustNum = 12345
2. by block of lines. To insert an expression:
By default, the cursor of the debugger (arrow ) is
positioned on the current line. 1. Click or select "Add an expression" from the
The input cursor of the mouse (caret) can be positio- popup menu of the "Code" pane.
Part 2: Creating an application, a site

ned on any other code line. 2. Enter the new expression.


To run the code lines found between the cursor of the 3. Validate the creation of the expression by pressing
debugger (arrow ) and the caret , use the [F6] the [Enter] key.
key. 4. The value of the expression will be automatically
displayed in the "Result" column during the debug
3. and ignore the breakpoints. operation.
To run code while ignoring the breakpoints, click .
To modify an expression:
Note: to stop the code’s execution in the debugger, click 1. Select the expression to modify.
. The test of the project continues without the debug- 2. Click or select "Edit expression" from the
ger. popup menu of the "Code" pane.
10.9.5 Hierarchy of processes 3. Modify the expression.
4. Press the [Enter] key to validate the modification.
The processes currently run in the debugger are organi- 5. The value of the expression will be automatically
zed hierarchically. This hierarchy is listed in the call stack displayed in the "Result" column during the debug
in the "Code" pane. operation.
For example, the initialization process of the application
starts a window that uses a procedure. When the proce- To delete an expression:
dure is debugged, you will have the ability to go back to 1. Select the expression to modify.
the code editor: 2. Click or select "Delete expression" from the
-at the location where the procedure is called. popup menu of the "Code" pane.
-at the location where the window or page is open. 3. The expression is deleted.
Note: This feature does not stop the debugger. To make an expression self-stopping: select the "Stop"
column across from the expression you want.
10.9.6 Viewing the content of the variables
The debugger enables you to examine the value of the 10.9.8 Status Report
variables used in the current code. The values can be HyperFileSQL status report
viewed:
The HyperFileSQL status report is used to display the
•when a variable is hovered by the mouse cursor. result of the following HyperFileSQL functions (if they
•in the debugger: exist) in the "Code" pane ("Debugger" option) :
- the icon is used to view the local variables. •HOut,
•HFound,
- the icon is used to view the global variables.
Tome1_2.book Page 103 Vendredi, 28. mai 2010 5:50 17

103

•HError, To avoid any oversight, we advise you to manage the dis-


•HErrorInfo. play of the debug information via a global procedure. For
example:
Status report of WLanguage PROCEDURE MyTrace(StringToTrace)
The status report of WLanguage is used to display the fol- IF OnTestMode() THEN
lowing information in the "Code" pane ("Debugger" Trace(StringToTrace)
option): END
•the number of the timer (if it exists), In this code, depending on the result from the InTest-
•the number and the messages of non-fatal errors, Mode function, the trace window only appears when tes-
•the name of the current object (corresponds to the ting the application.
Myself keyword). Such a procedure enables you to leave the call to the
trace windows in the code of the application without any
10.9.9 Debugging without the debugger risk of displaying it on the end-user computers.
In some cases, running a program with or without the The call to the trace procedure is similar to the use of the
debugger can produce different results. Trace function:
Indeed, the debugger introduces pauses in the execution MyTrace("Customer: "+Customer.Custo-
of the program during which various tasks are performed merNum)
by WinDev.
Creating a trace file
This is why the debugger cannot be used in a procedure
called by a timer or in the code of a scrollbar. For routines that take a long time to run (batch proces-
ses, and so on), if you want to check how the program is
Note: to find out all the debugger’s limits, see the online running, you need to keep a physical trace of the execu-

Part 2: Creating an application, a site


help. ted processes (via a text file for instance).
To debug these applications, you may want to follow the The following procedure is used to manage the display of
value of a variable, how procedures are called, … the trace:
This information can be: • on the screen (/DEBUG parameter in command line).
•displayed on the screen • or in a text file (default mode).
•stored in a trace file. PROCEDURE MyTrace(StringToTrace)
File is int
Caution: if the information is displayed on the screen, it DebugMode is boolean = False
should only be displayed during the test of the applica- IF Position(CommandLine(),…
tion. "/DEBUG") > 0 THEN
DebugMode = True
Displaying some information END
Two tools enable you to display information: If DebugMode THEN
Trace(StringToTrace)
•the information boxes: Info function of WLanguage. ELSE
Caution: the display of an information box is a locking File = fOpen(…
operation. "C:\Trace.txt"+,…
•the trace window: Trace function of WLanguage. foCreateIfNotExist+…
The Trace window is displayed in the top left corner of foWrite+ foAdd)
the screen, without interrupting the execution of the IF File <> -1 THEN
program. fWriteLine(File,…
DateToString(DateSys())+…
"->"+TimeToString(TimeSys())
Managing the display of the debug fWriteLine(File,StringToTrace)
information fWriteLine(" ")
Displaying the debugging information on the screen is fClose(File)
useful in test mode only. END
Any unsuitable display must be deleted before distribu- END
ting an application.
Tome1_2.book Page 104 Vendredi, 28. mai 2010 5:50 17

104

Notes: problem during the process.


•The trace file: "C:\Trace.txt" is created by default. •Sample content of the trace file:
This file contains the information to trace during the 01/12/2001 - 10:53:25:20
execution of the program.
Customer name: Martin
The information is completed by the date and time of
each "Trace". This enables you to detect a potential

10.10 Performance test


10.10.1 Overview 10.10.4 Reading the result of the performance
The performance profiler enables you to check and opti- profiler
mize the execution time of your application or your site. The performance profiler presents the result of the analy-
Its principle is straightforward: sis in two tabs:
Test your application/site. During this test, the perfor- •the "Summary" tab presents the 20 longest proces-
mance profiler keeps track of all the actions performed ses.
and the corresponding processes run. •the "Details" tab presents all the processes started
At the end of the test, the performance profiler displays: while testing the application (from the slowest one to
•the 10 most time consuming operations the fastest one).
•all the actions performed in the application (or the The following information is displayed for each process:
site) whose test was run, sorted by duration (from the
Function Function, process or procedure run.
longest one to the shortest one).
Part 2: Creating an application, a site

Total Time Execution time of the function.


You can select a process then in order to analyze the
reasons for its processing time and to optimize it. Nb of calls Number of calls made to the function (proce-
dure or process).
10.10.2 Starting the performance profiler Time 1 call Execution time of a call to the function (proce-
dure or process).
To start the profiler, select "Project .. Performance and
improvements .. Analyze the performance". % code Percentage of code executed outside calls to a
WLanguage function or calls to a custom func-
The project is automatically executed in test mode then. tion or procedure.
The process to optimize can be run in your application or
your site. Parent Process that called the function.
To go back to the editor, all you have to do is close your Note:
application or your site. • The "Full execution" caption represents the total
The performance profiler displays the result of the analy- amount of time for running the test of the application
sis. with the performance profiler.
Note: we recommend you use the profiler to optimize • The "Total Window XXX" caption represents the total
your application or site (before deployment for instance). amount of time for running the XXX window (from its
opening to its closing).
10.10.3 Saving or opening a statistics file
10.10.5 Choosing a process to optimize
By default, the performance profiler saves the statistics
performed on the code of the application in a "<Project The process to optimize is chosen according to several
Name>".WPF file. criteria:
To open a specific statistics file (a file created by pro- • the execution time of the process. The longest proces-
gramming for instance): ses must be optimized.
1. Select "Project .. Performance and improvements • the percentage of time spent processing the function
.. Performance report .. Open a report of perfor- or procedure. The higher this percentage is, the greater
mance". the number of processes that can be optimized in the
2. Specify the path and the name of the statistics code.
file. Note: If the process corresponds to a WLanguage func-
The list of the last statistics files opened can be found in tion, it is fairly hard to optimize it.
"Project .. Performance and improvements .. Perfor-
mance report".
Tome1_2.book Page 105 Vendredi, 28. mai 2010 5:50 17

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.

10.11 Regression tests


10.11.1 Overview no incidence on the size of the application supplied to
Several test tools are available to ensure the quality of your customers.
your application: See the online help (keyword: "Automatic test") for more
• The test mode (Go from a project or from a window) is details.

Part 2: Creating an application, a site


used to immediately test a change in your application.
These tests can be saved as automated tests. 10.11.3 WDTest
• The WDTest tool, which allows you, for instance, to WDTest is a tool that allows you to record and automati-
create validation and regression test in WinDev and cally run application test scripts (for WinDev or not).
WinDev Mobile. A test script (also called "macro") contains mainly the
• The WDTestSite tool, which allows you to create various different operations performed on an application (mouse
tests for a WebDev site. movement, mouse click and keyboard entry).
To automate these tests and to increase the quality of Once recorded, the test script can be run as many times
your applications, you have the ability to run automated as necessary. When a script is executed, a result script is
unit tests. These tests allow you to check all the features automatically generated. The differences between the
offered by your application. two scripts (initial script and result script) are highlighted.
This feature enables you to check whether your WinDev
10.11.2 Automatic tests applications operate properly between two updates.
Each test contains a scenario that can be directly edited WDTest automates application test procedures.
in the product interface. This scenario is written in WLan- Important: to successfully perform a test, you need to
guage and it can be modified at any time. use the same exact configuration:
These tests can be run, for instance, before creating the • on the computer where the test is created
executable in order to check the operating mode of an • on the computer where the test is run
application.
See the online help for more details (keyword:
The following elements can be tested: "WDTest")
• the WinDev and WinDev Mobile windows
• the sets of procedures 10.11.4 WDTestSite
• the classes WDTestSite is used to run different tests on a WebDev
• the WinDev executables. site.
Each test is associated with a WLanguage code: the test Here are the tests that can be performed with WDTest-
scenario. This scenario can be viewed in the code editor. Site:
The code of the tests can be modified. • Stress test:
The tests and the associated code are not included in the The stress test consists in simulating the connection of
executable and they are not distributed along with your several Web users to a WebDev site. Each Web user
application. The number of tests for an application has runs a set of operations (scenario) simultaneously.
Tome1_2.book Page 106 Vendredi, 28. mai 2010 5:50 17

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.

10.12 Debugging functions


Here are the debugging functions:
dbgEnableAssert Enables or disables the assertive programming. Assertive programming was imple-
mented by dbgAssert
dbgEnableLog Enables the management of the runtime log.
dbgAssert Used to find out and point out the possible errors via assertive programming. Use
dbgAssert in the code where an error may occur. A window is displayed if an error
occurs
Part 2: Creating an application, a site

dbgStartRecording Starts recording a test scenario (also called reproduction scenario).


dbgLogStatus Enables you to find out and modify the status of the runtime log (enabled, disabled,
paused).
dbgEndRecording Stops recording the scenario.
dbgInfo Returns some debugging information
dbgLogOption Enables you to find out and modify the options of the runtime log.
dbgStandardOutput Writes information into the standard output stream "stdout" (also called "con-
sole")
These functions are detailed in the online help.
Tome1_2.book Page 107 Vendredi, 28. mai 2010 5:50 17

107

11. THE USER GROUPWARE WD WB

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.

Part 2: Creating an application, a site


ples: Note: the user groupware is available in WinDev applica-
• administrative assistants can see the price list and tions and dynamic WebDev sites running on Windows or
create orders Linux. The user groupware is not available for the static
sites, the semi-dynamic sites, PHP, AWP or Ajax.

11.2 How does the user groupware work?


An application or a site running the user groupware has Configuring the groupware consists in creating users and
two use levels: groups, associating the users with the groups as well as
• the user level managing the rights granted to each user (or group) on
• the supervisor level each window/page found in the application. The rights
can be defined for the menu options, for the groups of
11.2.1 The user level controls and for the controls. The supervisor can gray
these elements, or make them inactive or invisible. These
The user connects to the application via a login window/ configurations have priority over any configuration defi-
page and he can access the features that have been ned in the program.
allowed for him.
For more details about the groupware configuration by
Note: user groupware enables you to connect through a the supervisor, see the ’Configuring the application using
LDAP directory. user groupware’ paragraph, page 115.
11.2.2 The supervisor level Note: all the information regarding the users and their
The supervisor connects to the application via a login rights are stored in HyperFileSQL format files. The files
window/page and he can access an advanced menu regarding the users can be common to several applica-
allowing him to configure the users and their rights, or to tions. The files containing the rights granted to the users
start the application. on the different windows/pages found in the application
The configuration window/page allows the supervisor to: are specific to the application and they cannot be sha-
red.
• start the application.
• configure the groupware.
Tome1_2.book Page 108 Vendredi, 28. mai 2010 5:50 17

108

11.3 Implementing the user groupware


11.3.1 Adding user groupware to an application in the LDAP directory will be automatically requested
To implement the user groupware in a WinDev application from the user.
or a WebDev site, only one option is needed: "Workshop Two modes are available:
.. Configure the user groupware". The window for confi- • Without right management: In this case no groupware
guring the user groupware lets you define: file will be created. If the application is started in auto-
•The management mode of the user groupware. matic mode, the login window/page will ask the user to
•The way to launch the user groupware. identify himself. If the user is saved in the LDAP direc-
tory, the application will start; otherwise, it will be
•The location of the data files of the user groupware. closed. A supervisor cannot configure the rights on the
Mode for including the user groupware windows or pages.
Two methods can be used to include the user groupware: • With right management: only users found in the LDAP
• Included by default: all the user groupware program- directory will be able to connect. The rights can be con-
ming is automatically included in your application. figured on the windows or pages.
A new window or page is included in your project: the See the online help for more details.
login window/page. It comes up when starting the Note: the user groupware works with Active Directory. It
application and allows the user to connect to the appli- does not operate with openLDAP.
cation. You can customize this window/page by
applying the skin template of your application for ins- Data files of User Groupware
tance. Two categories of data files are managed by the user
Part 2: Creating an application, a site

• Custom inclusion: all the user groupware programming groupware:


is automatically included in your application. All the • the data files used to identify the users. These data
windows or pages required to manage the user grou- files can be common to several applications.
pware (login, user management) are automatically • Data files used to manage the user rights on the diffe-
added to your project. You can customize all the win- rent widows of the application. These files are specific
dows or pages used by the user groupware. to the application.
The different windows or pages used by the user grou-
pware are presented in details in the ’WinDev windows’ The password of the data files
paragraph, page 117. By default, the data files of user groupware have a speci-
fic password. This password is: "PCSGPW2001".
Starting the user groupware
To change this password, enter the new password. The
Two modes are available for starting the user groupware: characters typed are displayed as stars.
• Automatic launch: the login window or page of the user Note: This password is used for instance after reindexing
groupware is displayed before any other window/page files or when opening files with the WDMAP tool.
of the application. The initialization code of the project
is run once the login window/page is opened and vali- See the ’Data files’ paragraph, page 118, for more
dated. details about these files and their configuration (setup
directory, etc.)
• Manual launch: the login window or page will only be
opened if the gpwOpen function is used. This option 11.3.2 Running the test of the application
allows you to run the initialization code of the project
before opening the login window/page. You have the When running the test of an application that manages the
ability to display a window or a page requesting the user groupware, the first window/page displayed is the
runtime language of the application for instance. login window/page (regardless of the first window/page
defined in your application).
Automatic login in test mode
By default, a single user exists: the supervisor. To connect
You can specify the login and password to use in "Auto- as supervisor, enter the following information in the login
mated test" mode. This information will be used if an window/page:
automatic test is run on the application.
• Name: SUPERVISOR
LDAP directory • Password: SUPERVISOR
If the company of your customer uses an LDAP directory, You can now run the test of your application or configure
you have the ability to branch the user groupware in this the user groupware.
directory. Therefore, the account and the password found
Tome1_2.book Page 109 Vendredi, 28. mai 2010 5:50 17

109

Notes: 11.3.4 Installing an application that uses user


• If you do not want the first window of your application groupware
to be the login window/page, select "Manual start" in An application that uses the user groupware is installed
the User Groupware options. Use the gpwOpen func- the same was as a standard application via "Workshop ..
tion instead to open the login window/page. Create the setup procedure".
• The windows/pages for managing the user groupware A screen specific to the user groupware enables you to
are run before the initialization code of the project. configure the location of the data files for the user grou-
• The first window/page of your application (defined in pware.
the project) will be run after the login window/page
(when the user is not the supervisor). Notes:
• If you do not want to launch the user groupware during • If the data files of the user groupware have been confi-
the test of the application, simply clear "Workshop .. gured for your client, they must be selected when pre-
Configure the user groupware". If the user groupware paring the setup program. Therefore, the list of setup
is re-enabled later, the data files previously used by the files must be customized.
user groupware will not be erased. • If the groupware files have not been configured, only
the Supervisor user will be able to login when the appli-
11.3.3 Creating the WinDev executable cation is started for the first time.
When creating the executable that supports the user Advice: if you do not configure the different use levels of
groupware ("Workshop .. Generate the executable"), a the user groupware for your clients, we recommend that
user groupware specific screen is displayed. you provide them with a document listing all the controls
This enables you to define the location of the user grou- found in your windows/pages in order to get an optimized
pware’s common files (files containing information about configuration.

Part 2: Creating an application, a site


the users).

11.4 Configuring the application that uses the user groupware


Once the application is deployed, the user groupware is The user can be defined as being a supervisor of the
configured by the application supervisor. This setting application.
consists in creating users and groups of users, and in A user can be modified or deleted. When deleting a user,
granting them specific rights for each control found in you have the ability to delete the entire user or to delete
each window of the application. These rights are used to his rights only.
gray controls, groups of controls or menu options, and to The users can be organized into groups. When creating a
make them visible or invisible. group, you have the ability to copy the rights previously
To configure the user groupware, you must defined for another group or user.
1. Start the application (executable or test from A group can be created or deleted. When deleting a
WinDev or WebDev), and login as supervisor: group, you have he ability to delete the group and its
•Name: SUPERVISOR users or to delete the group only. In this case, the users
•Password: SUPERVISOR are no longer associated with a group.
2. Choose "Configure the groupware"
Notes:
11.4.1 Managing the users • The supervisor password should be changed when it is
To create a new user, you must specify: first used.
• the last name of the user (mandatory) • The "Default" group is the group proposed by default
in the user groupware. By default, this group has all the
• the first name of the user rights on the application.
• the login of the user. This login corresponds to the iden- • The <None> group and the DEFAULT group cannot be
tifier of the user when he connects to the application. deleted.
• the password of the user. This password is optional and • if you are using an LDAP directory, you can import users
it can be entered by the user himself during his first found in the directory in order to manage the rights of
login (check the corresponding option). these users.
Tome1_2.book Page 110 Vendredi, 28. mai 2010 5:50 17

110

11.4.2 Managing the rights • the groups of controls


The supervisor can manage the rights granted to each • the menu options
user (or group of users) on the elements found in the pro-
The states available for each element are as follows:
ject’s windows.
• Default: the behavior of the element corresponds to
For each association between a user and a window/
the default behavior, defined in the application.
page, a specific status can be defined for all the ele-
ments found in the window or in the page. • Disabled: the element is displayed but no input can be
performed.
The elements managed in the windows, internal windows,
pages, internal pages, window templates and page tem- • Grayed: the element is grayed out. No input can be per-
plates are as follows: formed.
• the controls • Invisible: the element is not displayed.

11.5 Tips for developing an application with user groupware


11.5.1 Using groups of controls When configuring the user groupware, the supervisor can
To simplify the configuration of the user groupware accor- define other visibility characteristics. The characteristics
ding to the users, the controls should be organized in defined by the supervisor have priority. For example, a
groups of controls. button is used to make a control active. This control was
grayed by the supervisor. Your code will be ignored and
In your windows or in your pages, you have the ability to the control will not be active.
create groups of controls according to the controls that
must be displayed for a specific type of user. The ability to
Part 2: Creating an application, a site

11.5.3 Defining the rights


associate a control with several groups of controls
increases the number of possible combinations. To get a definition of the rights corresponding to the fea-
tures of your application, we advise you to:
These groups of controls can be created in your applica-
tion for managing the groupware, no specific program- • configure the rights for your application before you
ming is required. create the setup program. Then, all you have to do is
add the groupware files when creating the applica-
11.5.2 Visibility of controls tion’s setup program.
When developing your application, you can define the • supply a programming documentation that gives the
visibility options for the elements found in your windows names of the controls, groups of controls and options
or in your pages: that must be configured according to the level of use
defined for the application.
• when describing the element (7-tab window)
• by programming (State or Visible property)

11.6 User groupware elements


11.6.1 WinDev windows Supervisor menu window (GPWSupervisorMenu. WDW)
Depending on the integration mode of the user grou- This window is available in custom mode only.
pware in your application, one or more windows can be This window allows the supervisor to either start the
included in your project. These windows are as follows. application, or to configure the rights.
Note: the operating mode of these windows is presented in User form window (GPWUserForm.WDW)
details in ’Configuring the application using the user groupware’
(page 115). This window is available in custom mode only.
This window allows the supervisor to enter a new user as
Login window (GPWLOGIN.WDW) well as his personal details.
This window is used by all the application users to con-
nect to the application. In this window, the user must User and association configuration window (GPWAsso-
enter his name and password (optional) that were pre- ciationConfiguration. WDW)
viously defined by the application supervisor. When star- This window is available in custom mode only.
ting the application, you can use the "SUPERVISOR" This window allows the supervisor to manage the users,
login and the "SUPERVISOR" password. the groups and the rights.
Tome1_2.book Page 111 Vendredi, 28. mai 2010 5:50 17

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.

Part 2: Creating an application, a site


group.
This window allows the supervisor to view the history of
connections (and to clear this history if necessary). Connection History Form page
(GPWConnectionHistory_WB. WDW)
11.6.2 The WebDev pages This page is available in custom mode only.
Depending on the integration mode of the user grou- This page allows the supervisor to view the history of con-
pware in your application, one or more pages can be nections (and to clear this history if necessary).
included in your project. These pages are as follows.
Note: the operating mode of these pages is presented in details
11.6.3 The data files
in ’Configuring the application using the user groupware’, page Two categories of files are managed:
115. • Files used to identify users. These files can be common
Login page (GPWLOGIN_WB.WDW) to several applications.
This page is used by all the Web users to connect to the • Data files used to manage the user rights on the diffe-
site. In this page, the Web user must enter his name and rent elements of the application. These files are speci-
password (optional) that were previously defined by the fic to the application and cannot be shared with
site supervisor. When starting the application, you can another application.
use the "SUPERVISOR" login and the "SUPERVISOR" By default, these data files are created in HyperFileSQL
password. Classic format, but you can use HyperFileSQL Client/Ser-
This page also allows: ver data files. See the online help for more details.
•the Web user to change his password Password: by default, the user groupware data files have
•the supervisor to configure the rights and start the a specific password. This password is: "PCSGPW2001".
site. To change this password:
User form page (GPWUserForm_WB.WDW) 1. Display the window for configuring the user grou-
pware ("Workshop .. Configure the user grou-
This page is available in custom mode only. pware").
This page enables the supervisor to enter a new user and 2. Enter the new password in the "File" tab. The
his or her information. characters typed are displayed as stars.
User and configuration association page Note: this password is used for example when reindexing
(GPWAssociationConfiguration_WB. WDW) files or when opening files with the WDMAP tool.
Tome1_2.book Page 112 Vendredi, 28. mai 2010 5:50 17

112

User data files Right data files


These files are the following ones: These files are the following ones:
GPWUser File of users. Contains all the cha- GPWConfiguration File containing the description of
racteristics of the users (login, the available configurations. Each
name, password, …) configuration is associated with a
GPWUserConfigura- File of groups of users group of users.
tion GPWElementConfi- Status of each application ele-
GPWConnectionLog File containing the history of con- guration ment for each configuration. For
nections. This file is found only if example, enables you to store
the history of connections was whether the "Statistics menu"
requested. must be grayed for the "Assis-
tant" user.
The items of these files are presented in details in the GPWElement File containing the different ele-
online help. ments of the application to confi-
Where are these files created? gure (window or page controls,
menu options, etc.).
• By default, these data files (HyperFileSQLClassic
mode) are created in a subdirectory of your project The items of these files are presented in details in the
(EXE\GPW_<Project_Name> directory). When inclu- online help.
ding the user groupware, a different directory can be
specified to run the test of your application. Where are these files created?
When creating a WinDev executable, you can specify a • By default, these data files (HyperFileSQL Classic
Part 2: Creating an application, a site

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>.

11.7 Modifying user groupware


11.7.1 Customizing the windows or pages of All the windows or pages of the user groupware
groupware If all the windows/pages of the user groupware have
The login window/page been included in your project, they can all be customized.
You may want to customize the login window/page that is However, only the login window/page will be seen by all
displayed when your application is started. If this win- the users. The windows/pages for configuring the grou-
dow/page is included in your project, the style or the skin pware can be seen by the application supervisor only.
templates used by your application can be applied to this Caution: the GPWLOGIN et GPWSupervisorMenu win-
window/page. dows as well as the GWPLogin_WB page should not be
Caution: this window/page should not be renamed. renamed.
Tome1_2.book Page 113 Vendredi, 28. mai 2010 5:50 17

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

Part 2: Creating an application, a site


the messages to translate. must:
3. Run the application in the requested language. To 1. Select "Manual start".
do so, you can, for instance: 2. Open the login window/page anywhere in the
•Ask (if necessary) for the language in which the code with gpwOpen.
application must be run (via a specific window or
page for instance). 11.7.5 Defining menu rights
•Configure the runtime language of the application To define the rights on the popup menus of a WinDev
with Nation. application, all the windows of user groupware must be
•Open the first window/page for managing the user included. You can then modify the window for managing
groupware with gpwOpen. rights (GPWConfigurationDetails.WDW).
// Initialization code of the project To get the list of popup menus, use EnumSubElement
nLanguage is int = (associated with the enumFirst + enumContextualMenu
Open(Select_Language") constants).
// Configure the language
Nation(nLanguage) Special case: the "?" menu of a WinDev application:
// Open the first window of the Some options of the automatic menu should be used
// user groupware with great care. These options are as follows:
gpwOpen()
• Optimize the access speed to the database
See ’Multilingual applications and sites’, page 235, for • Save the data
more details. • Save the application
11.7.3 Modify the first window/page of the • Repair the database.
application according to the user The operating mode of these options with the user grou-
pware is as follows:
To change the first window/page of the application
according to the user, use gpwGetUserInfo in the initiali- • By default, these options are grayed if the user is not
zation code of your project. This option enables you to get the supervisor.
information about the user such as his name or password • To allow a non-supervisor user to access these options,
for instance. modify the rights of the internal window named
IW_MenuHWinDevHelp that contains the popup menu.
Tome1_2.book Page 114 Vendredi, 28. mai 2010 5:50 17

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

the same time.


Note:

11.8 Functions for managing the user groupware


The following WLanguage functions enable you to customize the user groupware.
gpwInLDAPMode Notifies the user groupware that user authentication will be done through an LDAP
directory.
gpwImportLDAPUsers Imports the users stored in an LDAP directory into the user file of the user grou-
pware.
gpwInitAnalysis Initialize the analysis of the user groupware
gpwLogin Connects a user to an application that uses the user groupware
gpwOpen Opens the login window/page of the user groupware (required if the user groupware
was included with the "Manual Launch" option
gpwOpenConfiguration Opens the page for configuring the user groupware
gpwOpenConnection Opens a connection to access the data files of the user groupware in a Client/Ser-
ver application
gpwGetFileInfo Retrieves the directory of the files for the user groupware
gpwGetLDAPInfo Retrieves the configuration of the LDAP server used by the user groupware.
gpwGetUserInfo Gets information on the current user
These functions are detailed in the online help.
Tome1_2.book Page 115 Vendredi, 28. mai 2010 5:50 17

115

12. WINDEV/WEBDEV COMPONENTS


12.1 Overview
12.1.1 Definition 12.1.2 What is a component made of?
A component is a set of WinDev/WebDev elements: win- A component is defined and generated from an existing
dows, pages, reports, analysis, ... This set of elements WinDev, WebDev or WinDev Mobile project. It can then be
performs a specific feature. For example, a component included in other WinDev, WinDev Mobile or WebDev pro-
can correspond to one of the following features: jects.
• Sending faxes All the component elements are independent from the
• Sending emails project where the component is included. The compo-
•… nent can have its own analysis, windows, pages, reports,
files, ... When creating the component generation, spe-
A component can be distributed to other WinDev/Web- cify whether these elements will be made available or not
Dev developers (for free or for a fee). These developers to the WinDev or WebDev project that includes this com-
will be able to easily include the feature offered by the ponent.
component in their application or their site. The compo- The component is made of three files:
nent will be included in the application or the site and
distributed along with the application or the site. <Component- Component file. Contains all the

Part 2: Creating an application, a site


Name>.WDK elements of the component.
When creating the component, the author specifies: This file is required to include the
component in a project.
• the origin of the component. The developer can build a
This file must also be provided in
component from a WinDev project linked to a WebDev the setup program of the applica-
project and/or a WinDev Mobile project ("Project .. tion that uses the component.
Project description .. Multi-product"). <ComponentName>.WDI Component description (only for
• the component elements visible (or not) to the user of application development).
the component. The visible elements will be accessible This file is required to include the
in the project diagram or by programming. component in a project.
• the mode for using the component (how to use the This file must not be supplied in
the setup program of the applica-
component, the parameters used to access the featu- tion that uses the component.
res of the component, …). A short documentation (to
<Component Optional file
be completed) is automatically generated and asso- Name>.WDO (optional File in text format containing the
ciated with the component. file) list of additional elements supplied
with the component (data files, .INI
Caution: A component is not a supercontrol. The super- files, …). See ’the WDO file’, page
control can only be made of controls while a component 133.
is made of windows, pages, reports, ... In most cases, the
component expects parameters, processes them and 12.1.3 What is included in a component?
returns a result to the application that uses it. Further-
more, unlike a supercontrol, a component has a specific A component contains:
setup. • the different elements to distribute (windows, pages,
Notes: reports, etc.). These elements can be accessible or not
when importing a component into a WinDev or WebDev
• To optimize the organization of your projects, you have project.
the ability to use internal components. Internal compo-
nents allow you to group your resources according to • a short description of the component.
specific topics and to share them with other develo- • a help allowing this component to be reused. This help
pers via SCM. See ’Internal component’, page 135, for is generated from the code comments.
more details. Note: by default, if a component uses an analysis, files,
• Several examples of components are supplied with ... the HyperFileSQL functions will handle these elements
WinDev, WebDev and WinDev Mobile. These compo- in an independent context. These parameters can be
nents can be accessed from the "Wizards, Examples modified in the advanced options of the component. See
and Components" pane ("Components" option). the online help for more details.
Tome1_2.book Page 116 Vendredi, 28. mai 2010 5:50 17

116

12.2 Creating and generating a component


12.2.1 Overview 3. To run from the component, a procedure of the
A component must be created from a project containing project containing the component, use the Execute-
all the elements required for the component to operate. Process function with the trtProjectProcedure para-
Therefore, we recommend you use a specific project to meter.
create each component.
The creation of a component is performed in several 12.2.3 Creating a component
steps: To create a component:
1. Developing the component elements. 1. Select "Workshop .. Component .. Define a new
2. Creating the component component from this project".
3. Defining the advanced options of the component. 2. In the wizard for component creation:
4. Generating the component. •Specify the name and caption of the component.
The component can then be distributed and reused. •Select the elements of the current project required
for the component to operate.
12.2.2 Developing a component •For each component element, specify whether this
A component is developed from a WinDev or WebDev element must be accessible from the project that
project. We recommend that you use a specific project to uses the component. If the element is accessible, the
develop each component. developer will be able to use the element like any
The following points must be taken into account when other project element. See the ’Visibility of a compo-
developing the different elements of a component: nent element’ paragraph, page 131, for more details
Part 2: Creating an application, a site

1. Code comments about the elements to make visible or not.


When developing the component elements, don’t 3. Validate. The component is created. To distribute
forget to insert comments in your source code. These it, it must be generated beforehand.
comments will be used to create the documentation The component can be immediately generated. This
of your component. These comments will provide option is recommended if all the component’s ele-
help to the users of your components. See the ’Auto- ments have been created, tested and are ready to be
mated documentation’ paragraph, page 131, for deployed.
more details. Note: the various components found on the current com-
If these comments are not found in your code, Win- puter can be accessed from the "Wizards, Examples and
Dev or WebDev will automatically document the Components" pane ("Components" option). See the
accessible elements of the component by specifying online help for more details.
the input/output parameters expected by each ele-
ment. 12.2.4 Advanced options of the component
For example:
The advanced options of the component are used to
Description of input/output parameters of define:
’Window1’ :
Parameters :
• the access rights of the component on the elements of
Param1: < Enter the role of Param1 here >
the application that uses the component.
Return value : • the management mode of the skin templates on the
None component elements.
2. Declaration and visibility of the elements Access rights of the component on the ele-
Depending on the declaration mode of the elements ments of the application that uses the com-
(classes, set of procedures), the accessible ele- ponent
ments may be more or less accessible to the compo- Three possibilities:
nent’s user. See the ’Visibility of a component • the component and its host application use indepen-
element’ paragraph, page 131, for more details. dent contexts (default option):
The component cannot handle the data files or the ele-
Note: if a component uses an analysis, some files, ... ments of the host project.
by default, the HyperFileSQL functions will handle • the component is allowed to handle only the data files
these elements in an independent HyperFileSQL of the host application. In this case, the HyperFileSQL
context. This operating mode can be modified in the contexts will be identical.
advanced options of the component. See the "Com-
ponent advanced options" paragraph for more • the component is allowed to handle the data files of
details. the host application as well as its elements (windows,
Tome1_2.book Page 117 Vendredi, 28. mai 2010 5:50 17

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).

Part 2: Creating an application, a site


By default, the skin template of the host project can be - in the properties of the WDI and WDK file in the
applied to the different elements of the component. Windows explorer ("PC SOFT" tab).
•Select the image of the component. This image will
To modify the advanced options of the component: be used in the Windows explorer and in the
1. Select "Workshop .. Component .. List of compo- "Wizards, Examples and Components" pane.
nents generated from this project".
2. Select the component you want.
3. Click "Options ... ".
Reminder: the various component found on the
12.2.5 Generating a component current computer can be accessed from the
"Wizards, Examples and Components" pane
A component can be distributed and reused only if it has ("Components" option). See the online help for
been generated. Generating the component is used to more details.
create the files required for distributing the component. •Enter the general overview of the component.
This generation can be performed:
This overview will be automatically displayed in
• when creating the component WinDev when the component found in the
• at any time "Wizards, Examples and Components" pane is
•via "Workshop .. Component .. Generate a compo- hovered by the mouse cursor.
nent". Note: The different components found on the cur-
•from the list of components found in the project rent computer are accessible from the "Wizards,
("Workshop .. Component .. List of components Examples and Components" pane ("Compo-
generated from this project"). nents" option). See the online help for more
details.
Note: if the component was modified, you need to rege- •The generation wizard automatically presents the
nerate it before distributing it again. See the ’Modifying a technical documentation associated with the com-
component’ paragraph, page 129, for more details. ponent.
To generate a component: See ’Automated documentation’, page 131, for
1. Select "Workshop .. Component .. Generate a more details about the rules for creating com-
component". ments.
2. In the wizard for component generation: •Specify the component’s compatibility mode.
•Select (if necessary) the name of the component The component can be:
to generate. - WinDev compatible only: the component can only
be used in WinDev projects.
•Select the elements of the current project required This option is recommended if your component
for the component to operate. contains windows, …
Tome1_2.book Page 118 Vendredi, 28. mai 2010 5:50 17

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

12.3 Distributing a component


12.3.1 Overview text files, etc.), you need to create a <Component
Once the component has been created, checked and name>.WDO file after generating the component. This
generated, it can be made available to the developers. file contains the list of external files (data files, text files,
Several methods are available: and so on) used by the component.
The files referenced in <ComponentName>.WDO will be
•direct use of the component automatically copied to the EXE directory of the project
Example: the component is directly used on the com- that uses the WinDev component.
puter of the developer who created it.
•simple distribution, by directly providing the neces- 12.3.3 Simple distribution of a component
sary files. The simple distribution of a component consists in provi-
Example: the component is intended to be used ding via simple copy the files required for the component
within the same company, by several developers. In to operate. The files are copied into a specific directory.
this case, the necessary files can be copied to a This directory can be found on a network server for ins-
network drive. tance.
•component setup procedure (with a setup proce- When importing the component into a WinDev or WebDev
dure of the component identical to the one used for project, select the WDI file corresponding to the compo-
applications). nent in the distribution directory.
Example: This distribution mode is recommended if
the component is intended to be sold or distributed To distribute a component, you must supply:
on a large scale, with regular upgrades. • The files automatically generated by WinDev or Web-
Dev (<ComponentName>.WDK and <Component-
12.3.2 Direct use of the component Name>.WDI files).
The component is created and used on the same compu- • If necessary, the specific files handled by the compo-
ter. nent (data files, initialization files, and so on) as well as
When importing the component into a WinDev or WebDev <ComponentName>.WDO.
project, select the WDI file corresponding to the compo- <ComponentName>.WDO contains the list of files that
nent. This file is available in the EXE directory of the com- must be supplied with the component. See the ’WDO
ponent project. file’ paragraph, page 133, for more details about this
Caution: if the component uses specific files (data files, file.
Tome1_2.book Page 119 Vendredi, 28. mai 2010 5:50 17

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.

12.4 Using a component in an application or in a site

Part 2: Creating an application, a site


A component can be reused at anytime in any WinDev can be accessed and used are displayed in :
application or WebDev site: you just need to know the •the graph of the project. These elements are bor-
directory of the component’s files. dered by a green line.
•The "Project" pane. A specific icon indicates that
12.4.1 Including the component in the project the element comes from a component.
To include a component in a project:
1. Open the project. Files automatically copied when the component is inclu-
2. Select "Workshop .. Component .. Import a com- ded in a project
ponent into the project". A file picker is opened. When a component is included in the project, all the files
3. Select the WDI file of the component to import. required by the component are automatically copied into
Depending on the selected distribution mode, this the directory of the project:
file can be found: •the <ComponentName>.WDI file is copied into the
•in the creation directory of the component if the project directory
computer where the component is created and the •the <ComponentName>.WDK file is copied in the
computer where the component is used are identi- EXE subdirectory of the project.
cal •If files were specified in the optional file named
•in the directory where the component files have <ComponentName>.WDO, these files are copied to
been made available the EXE directory of the project (respecting the tree
•in the directory where the setup procedure of the structure specified in the WDO file).
component has copied the component files.
4. Validate. The description window of the selected 12.4.2 Handling a component in your pro-
component is displayed. This window presents: grams
•the description of the component (company, ver- The visible elements of a component included in a project
sion, …). can be handled by programming only.
You have the ability to choose the load mode of the To handle an element from the component (window,
component (when running the project or when a page, etc.) by programming, simply handle the element
component element is used for the first time). the same way as if it were created directly in the project:
•the documentation of the component. This docu- • view the element’s documentation.
mentation explains how to use the different ele- To do so, double-click the element from the "Project"
ments of the component. pane or from the graph of the project, or press [F2]
5. Validate. The different component elements that from the code of the element. The documentation of
Tome1_2.book Page 120 Vendredi, 28. mai 2010 5:50 17

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

MyVariable is … list of components found in the project ("Workshop ..


object ComponentClass Component .. List of components imported into the pro-
ject", "Update" button).
The variable is then used like any object variable.
If the component was distributed with a WinDev applica-
No specific WLanguage function is required to handle tion or with a WebDev site, the component must be upda-
the component. ted. See the "Deploying an application that uses a
Note: The technical documentation of the component is component" for more detail.
available:
• when including a component in a project ("Workshop ..
12.4.4 Creating the executable
Component .. Import a component into the project") The method for creating the executable that uses the
• when double-clicking the icon of the component found component is the same as the method for creating the
in the "Wizards, Examples and Components" pane or executable for a standard WinDev application. The DLLs
via the "Description" option of the component’s required for the component to operate are automatically
popup menu. detected.

12.5 Deploying an application or a site that contains a component


The method for deploying an application or a site that 12.5.1 Updating the components and the
uses one or more components is the same as the method deployed executables/sites
for deploying a standard application or site ("Project .. When upgrading a deployed component and/or an exe-
Create the setup procedure" or "Project .. Create the cutable (or site), you have the ability to install on the end-
client version"). user computer (or on the site’s deployment computer):
When deploying an application or a site that uses a com- • the executable of the application (or site), the compo-
ponent, the following files are automatically installed on nent and the files required for them to operate.
the user computer or on the server:
• the executable of the application (or site) and the files
• <ComponentName>.WDK, required for the application/site to operate.
• <ApplicationName>.EXE (WinDev only), • the component and the files required for the compo-
• the files required for the component and the applica- nent to operate.
tion to operate.
See the online help for more details about managing the
compatibility between the application and its compo-
nent.
Tome1_2.book Page 121 Vendredi, 28. mai 2010 5:50 17

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>

Part 2: Creating an application, a site


•The new version is used to correct the problems of
an earlier version. Benefit: the component’s update is easier; it is done
directly in the component’s directory (and not in each
•New features have been added to the component application/site).
but they are not required for running the applica-

12.6 Modifying a component


A component that has been created and generated can The wizard for component modification starts with
be modified at any time. The following modifications can the options of the selected component. The diffe-
be performed: rent options of the component can be modified
• adding elements to the component. (add elements, modify the visibility of the ele-
• deleting elements from the component. ments, etc.).
• modifying the rights on the component elements. •Find out and modify the elements included in the
component.
• modifying one of the component elements.
•Make visible (or not) the elements included in the
In any case, after this modification, the component must component.
be regenerated in order to take the modifications into •Modify the access rights of the component on the
account. client project.
4. Regenerate the component ("Workshop .. Com-
12.6.1 Modifying a component ponent .. Generate a component").
To add or delete a component element:
1. Open the component’s project ("File .. Open a To modify a component’s element:
project"). 1. Open the component’s project ("File .. Open a
2. Select "Workshop .. Component .. List of compo- project").
nents generated from this project". 2. Open the element you want ("File .. Open").
3. The description window of components is dis- 3. Perform the necessary modifications.
played. This window enables you to perform the fol- 4. Save these modifications ("File .. Save").
lowing modifications: 5. Regenerate the component ("Workshop .. Com-
ponent .. Generate a component").
•Modifying a component ("Modify" button).
Tome1_2.book Page 122 Vendredi, 28. mai 2010 5:50 17

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.

12.7 Advanced component settings


12.7.1 Automatic documentation
A component must be supplied with a documentation in
order to be re-usable.
WinDev simplifies the creation of this documentation by
offering:

Part 2: Creating an application, a site


• a general overview of the component. This general
overview is entered when the component is generated.
When using a component in a WinDev application or in
a WebDev site, this overview will be visible when rolling
the mouse cursor over the component listed in the When is the documentation generated?
"Wizards, examples and Components" pane. See The component documentation is generated when gene-
’Managing component ("Wizards, Examples and Com- rating the component for the first time ("Workshop ..
ponents" pane)’, page 134, for more details. Component .. Generate a component").
• an automatic generation of the technical documenta- When generating this documentation:
tion from the comments inserted in the code of the • the comments found in the code are used to create the
component’s elements. documentation.
Which code comments are taken into • if there is no comments, WinDev/WebDev will automa-
account? tically document the accessible elements of the com-
The following comments are automatically taken into ponent by specifying the input/output parameters
account for the documentation of the component: expected by each element. The corresponding com-
• The comments found at the beginning of the WLan- ments are automatically created in the different ele-
guage procedures ments.
• the comments found at the beginning of the following Note: each time the component is generated, you can
processes: generate the documentation associated with the compo-
•Initialization code of windows/pages nent again ("Regenerate" option in the "Component
•Initialization code of the reports history" window).
•Initialization code of the classes Caution: if you use the "Regenerate" button, the modifi-
cations performed in the generation wizard will be lost.
•Initialization code of the sets of procedures.
Tome1_2.book Page 124 Vendredi, 28. mai 2010 5:50 17

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

If the procedure is public in the component,


• by double-clicking this element (from the "Project" the procedure will be public in the project that
pane or the project graph) or by pressing [F2] from the uses the component.
code of this element. If the procedure is private in the component,
• directly from the list of components included in the the procedure will not be accessible in the pro-
ject that uses the component.
project ("Workshop .. Component .. List of compo-
nents imported into the project"). Set of proce- No access to the pro- The global variables of
dures cedures the set of procedures
12.7.2 Visibility of a component element cannot be handled.
If these variables must
When creating a component, you have he ability to define be handled, procedures
the component elements that will be accessible (or not) used to read or modify
by the user of the component. the global variables of
the set of procedures
• If the element is accessible, the user of the component must be included in the
will see this element in the list of project elements. The component.
user of the component will be able to handle these ele- If the procedure has no access attribute in the
ment by programming (as any other project element). component, this procedure is invisible in the
Note: However the code of this element is not visible. project that uses the component.
• If the element is not accessible, the user will not even If the procedure is public in the component,
know that this element exists. the procedure will be public in the project that
uses the component.
Caution: depending on the declaration mode of the pro- If the procedure is private in the component,
ject’s elements (class, Set of procedures, etc.), the ele- the procedure will not be accessible in the pro-
ject that uses the component.
ments that are accessible or not may very. The table
below presents the different methods for accessing an Project The project can be included (or not) in the
component. No visibility option can be defined.
element according to its declaration mode. The project will always be invisible.
Summary table about the elements and the visibility If the project is included in the component, the
initialization code of the project and the closing
options code of the project will be automatically run
when loading/unloading the component.
Element Not accessible Accessible
Class No access to the The syntax used to Caution: if an analysis is included in the com-
class, to its members access the class, its ponent and if a password has been defined for
or to its methods members or its methods this analysis, you need to include the project
must comply with the with the component.
OOP syntax.
Tome1_2.book Page 125 Vendredi, 28. mai 2010 5:50 17

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

Part 2: Creating an application, a site


tion information, and so on)
project for component creation, this data file is found in
These two files must be distributed along with the com- the EXE directory of the project.
ponent. In order for the component to be supplied and installed
If the component uses additional elements (data files, with the data file, the WDO file must be created in the EXE
…), you need to add the following in the project’s EXE directory of the project where the component was crea-
directory: ted. This file must contain the following lines:
• A <ComponentName>.WDO file: This file contains the .\CEDEX.Fic
list of external files (data files, text files, and so on) .\CEDEX.NDX
used by the component. These files must be supplied Distributing a component with WDO
and installed with the component.
To distribute a component that uses a WDO file:
• the files that must be distributed with the component.
These files can be located in a specific tree. In this • If you do not use a setup program for the component,
case, the code of the component must manage the you must provide:
access to these files in this tree structure. •the WDK file
•the WDI file
What is this WDO file ?
•the WDO file
The <ComponentName>.WDO file is a file in TXT format
that can be created and modified at any time. This file •all the necessary files referenced in the WDO file.
can be created and modified with the standard text editor • If you use a setup procedure for the component, the
of Windows, Notepad. WDO file will be created automatically when creating
This file contains the list of external files (data files, text the component’s setup program.
files, and so on) used by the component and that must In the wizard, you must:
be supplied and installed with the component. These 1. Request the modification of the files to install
files must be copied to the EXE directory of the projects ("Modify the list of files to install" in the "Additional
that use the component. modules")).
2. Select the additional files to install.
This ".WDO" file may contain : The WDO file will be automatically created and ins-
• the complete name of the file. talled with the component.
For example: C:\Components\RadioButtonCompo-
nent\InitialState.INI
Tome1_2.book Page 126 Vendredi, 28. mai 2010 5:50 17

126

12.8 Managing components ("Wizards, Examples and Components" pane)


The "Wizards, Examples and Components" pane simpli- • <Browse> option: this option enables you to find the
fies the management of components. The "Wizards, WDI file of a component to add it to the list of custom
Examples and Components" pane enables you to display components.
the available components and to include them in any • Option <Search> option: this option lets you search for
project by "Drag and Drop". components found in a directory (and its subdirecto-
Reminder: the components included in a project are visi- ries if needed). All the new components found are
ble in the "Project" pane (like windows, pages, reports, automatically displayed and added to the list of cus-
and so on) via the "Component" option. tom components.
The "Wizards, Examples and Components" pane ena-
bles you to view all the available components. 12.8.2 What actions can be performed from
the "Wizards, Examples and Components"
To display information regarding the components: pane?
1. Display the "Wizards, Examples and Compo- For each component displayed in the "Wizards, Exam-
nents" pane if necessary ("Display .. Toolbars .. ples and Components" pane (default or custom WinDev/
Wizards, Examples and Components").
WebDev component), you can:
2. Click the "Components" button.
• view the component’s overview when rolling the
12.8.1 What does the "Wizards, Examples and mouse cursor over its name. This overview is displayed
Components" pane contain? in a tooltip.
For the components, the "Wizards, Examples and Com- • view the complete documentation of the component
Part 2: Creating an application, a site

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

13.2 Creating an internal component

Part 2: Creating an application, a site


13.2.1 The different steps component. The inaccessible elements (or "private"
To create an internal component: elements) can only be used by another element of
1. Select "Workshop .. Internal component .. Crea- the internal component (the auto-complete feature
ting an internal component". The wizard for creating will propose these "private" elements only from the
an internal component starts. elements of an internal component).
2. Specify the characteristics of the internal compo- 5. Specify the management mode of the data and
nent: runtime contexts. Three management modes of data
and runtime contexts are available:
•its name. The name of the internal component will
be used for the WCI file corresponding to the des- •Full share: the internal component accesses the
cription of the internal component. This name will project’s data file. The internal component and the
also be used to create a subdirectory in your pro- project use the same runtime contexts.
ject containing all the elements of the internal This mode corresponds to the default mode if the
component. component uses no analysis.
•its caption. •Share data only (advanced mode): the internal
component accesses the project’s data files. The
•its description. internal component and the project use different
3. Indicate the elements that must be included in runtime contexts.
the internal component. An internal component can This mode is reserved to special cases.
contain all the types of elements found in a project:
windows, pages, reports, templates, sets of proce- •Full autonomy: the internal component accesses
dures, … its own data files. The internal component and the
Note: if the elements included in the internal compo- project use different runtime contexts.
nent contain links to elements found for example in This mode corresponds to the default mode if the
the project or in another internal component, a com- component uses an analysis.
pilation error comes up indicating that you cannot In this case, the analysis used by the internal com-
access a project element from an internal compo- ponent must be specified. You also have the ability
nent. to create a new analysis directly. This analysis will
4. Specify the elements of the internal component be associated with the internal component.
that will be directly accessible in the code and in the 6. Validate the creation of the internal component.
preset actions of the project hosting the internal You will have the ability to:
component. •Modify the characteristics of the internal compo-
Note: the accessible (or "public") elements of the nent via the description window of the internal
internal component will be offered automatically by component.
the completion feature. They can be used by the ele- •Handle the internal component and its elements.
ments found in the project or from another internal
Tome1_2.book Page 128 Vendredi, 28. mai 2010 5:50 17

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.

13.3 Sharing the internal components (via SCM)


13.3.1 Overview 4. The internal component and all its element are
Part 2: Creating an application, a site

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).

14.1 Documentation of the complete project


14.1.1 Type of documentation •Description of flexible modeling (diagram, list of
Several types of documentation are offered: applications, etc.).
•Analysis/File/Queries documentation: contains •Description of sets of procedures (code, multilingual
information about the analysis, the files and the que- messages, etc.).
ries of the project. •Description of automated tests (code, summary of
•UI documentation (User Interface): only contains the results).
presentation of windows (or pages) and reports, as
well as their sequence. •Description of business rules (description, attached

Part 2: Creating an application, a site


•Code documentation: contains all the processes of files, links, etc.).
all the objects in the project. For each section, you have the ability to choose the infor-
•Technical documentation: contains the processes mation that will be printed. For queries for instance, you
and the technical description of all the objects in the may choose to print none or several pieces of informa-
project. tion:
•Complete documentation: contains all the informa- • the graphic representation of the queries,
tion about the project. This documentation combines • the general information of the queries (logical name
all the other types of documentation. and physical name of the queries, type of queries, ana-
lysis associated with the queries, …),
14.1.2 Content of the documentation
• the information specific to the results of the queries
The project documentation can contain several sections: (result items, parameters of the queries, sort criteria,
•Description of the project (project diagram, project …),
elements, project code, etc.) • the information about the characteristics of the queries
•Description of the analysis (analysis diagram, data (selection conditions, groups, …),
dictionary, etc.) • the SQL code corresponding to the queries.
•Description of windows/pages (image of windows/
pages, list of controls found in each window/page, For each section, you have the ability to choose the ele-
etc.) ments that will be presented in details.
•Description of queries (image of queries, correspon- For example, the project windows are listed. You have the
ding SQL code, etc.) ability to select one or more windows from this list. Only
the information regarding the selected windows will be
•Description of reports (image of reports, list of con-
displayed in the documentation.
trols found in each report, etc.)
•Description of classes (code of classes, etc.) Attention: if graphic representations must be printed
•Description of UML models (UML diagrams, list of (project diagram, UML diagrams, etc.), you need to confi-
diagram relationships, etc.) gure the print areas. See ’Print areas’, page 138, for more
details.
Tome1_2.book Page 130 Vendredi, 28. mai 2010 5:50 17

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

14.2 Documentation of the current element


14.2.1 Content of the documentation •the code of the controls found in the window,
The contents of this documentation can be customized: •the procedures of the window,
only the selected information will be detailed. •the multilingual messages of the window.
For instance, if the current element is a window, you have
Note: if the current element is a code window, "File ..
the ability to print one or more of the following details:
Print the documentation" only prints the processes dis-
•general information about the window (logical and played in this window.
physical names, title, etc.),
Part 2: Creating an application, a site

•the image of the window, 14.2.2 Edit mode of the documentation


•information about the controls found in the window The documentation can be:
(name and caption of the controls, characteristics of •printed,
the controls, etc.),
•exported to a RTF document or to an XML file,
•information about the window menus (name of the
•exported to an HTML file (an Internet browser must
options, option shortcuts, etc.), be installed on the current computer),
•the code of the window,
•exported to a text file.

14.3 Print areas


14.3.1 Overview - choose the number of pages on which the gra-
To print graphic representations (project diagram, LDM, phic representation must be printed (the
UML diagram, and so on), the print area must be configu- mouse cursor turns into a North-West/South-
red before the documentation is printed. East double arrow).

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

15. CREATING THE EXECUTABLE WD WDMobile

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.

15.1 Creating the executable program of a WinDev application


To create an executable program: •the use of patches for updates. In this case, all
1. Select "Workshop .. Executable .. Generate the you have to do is copy the file corresponding to
Windows executable" or click . The wizard for the patch into the executable directory.
creating executables starts. •the languages supported by the executable.
2. Specify: •the files found in the library (if there is one).
•the general options of the executable (name, •whether to include the components used in the
icon of the executable program, splash screen, project to the executable.
etc.) •the location of the user groupware’s files (only
•the operating mode of the executable: if your application manages the user grou-

Part 2: Creating an application, a site


- Multi-instance: this program can be started pware).
several times from the same computer; •the location of the data files to use by the exe-
several instances will be open at the same cutable.
time. •the version information. This information will
- Single-instance: this program can be star- be displayed in the "Version" tab of the execu-
ted only once from the same computer; only table’s property window (accessible from Win-
one instance will be open at the same time. dows explorer). The version number can be
If the developer tries to run another instance incremented automatically each time the exe-
of the program, the instance already running cutable is created.
will be activated.
•the operating mode of the WinDev framework
•the library’s use mode. This library is optional. (using the framework specific to the application
It can be created in a separate file (".WDL" or using the framework common to all the Win-
extension) or added to the executable. Dev applications installed on the computer).
Including the library in the executable program
presents the benefit of having only one file to •the manifest to use (when running on Windows
install or update, but it increases the size of the Vista only).
".EXE" file. •whether the executable must be saved in the
•the error message that will be displayed when reusability center.
a programming error occurs. •whether a project backup needs to be done.
•whether to accept User Macro-CodeUMC). If 3. Validate the executable’s description. The execu-
UMC is active, end users will be able to create table is automatically generated based on the provi-
their own macros to modify the application. ded information. The executable can be run directly
after it has been created.
Tome1_2.book Page 132 Vendredi, 28. mai 2010 5:50 17

132

15.2 Creating the executable program of a WinDev Mobile application


To create an executable program: directly to the Pocket PC connected to the current
1. Select "Workshop .. Executable .. Generate the computer.
executable" or click . The wizard for creating exe- •If the executable must not be copied to the Pocket
cutables starts. PC connected to the current computer, the execu-
2. Specify: table creation is completed.
•the general options of the executable (name, •If the executable must be copied to the Pocket PC
icon of the executable program, etc.). connected to the current computer, specify the
directory where the application (executable, libra-
•the operating mode of the executable: ries and WinDev Framework if necessary) must be
- Multi-instance: this program can be started copied.
several times from the same computer; At the end of the copy to Pocket PC, the executable
several instances will be open at the same will be automatically run. Specify a command line
time. if necessary.
- Single-instance: this program can be star- Caution: the directory must be specified using the
ted only once from the same computer; only notation recognized by the Pocket PC (for example:
one instance will be open at the same time. "\MyApp") and the Pocket PC must be connected
If the developer tries to run another instance to the current computer.
of the program, the instance already running 5. If you have decided to copy the executable to the
will be activated. Pocket PC, select the files to copy. All the files found
•the library’s use mode. This library is optional. in the EXE directory of the project will be selected by
Part 2: Creating an application, a site

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. JAVA GENERATION WD

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

Part 2: Creating an application, a site


requires the Java runtime in order to be run. windows and WLanguage functions are converted to Java
automatically.
To compile (in Java) a Java project developed with Win-
Dev, Sun J2SDK (version 1.4.2 or later) must be installed Note: the number of WLanguage functions that can be
on the development computer. A version is available on used in a Java project is limited in this version. This num-
the setup CD of WinDev. This program can also be down- ber of functions will increase in forthcoming versions.
loaded from the Sun Web site.

16.2 Features of a Java project


16.2.1 Creating a Java project file in the EXE directory of the project.
A Java project is created as any other WinDev project. To • The setup module only handles the files required for
do so, select "File .. New .. Project". The wizard for pro- deploying the Java application.
ject creation starts. In one of the first screens, the wizard Note: we recommend creating a new WinDev project to
enables you to choose the type of generation for your pro- develop a Java application rather than transforming a
ject. All you have to do is select "Java" and follow the WinDev application into a Java application.
instructions given by the wizard.
By default, a WinDev project for Java corresponds to a 16.2.2 JAVA RAD
specific configuration of the project. You can modify the As with any project associated with an analysis, RAD can
type of project generation at any time. To do so, create a be used to generate the windows of your application.
new project configuration. RAD takes into account all the requirements for genera-
As soon as the project is configured as a Java project, all ting Java code (controls, processes, functions available
the tools available in WinDev are automatically configu- for a WinDev application generated in Java).
red for the Java project: Regardless of the type of window to generate, the first
• The window RAD or the full application RAD is specific screen of the wizard is used to specify the type of connec-
to a database handled by a Java application tion to the database:
• The compiler indicates whether the project contains • HyperFileSQL (in Windows or Linux): the standard win-
functions or controls that cannot be used in Java. A dow creation wizard is offered.
purple message is displayed in the "Code" pane. • JDBC: you can then specify the parameters for connec-
• The creation of the archive is used to generate a ".jar" ting to the database using the JDBC driver.
Tome1_2.book Page 134 Vendredi, 28. mai 2010 5:50 17

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

16.2.5 Creating a Java archive Create the setup procedure".


See the online help (keyword:"Java") for more details.
WinDev enables you to:
Tome1_2.book Page 135 Vendredi, 28. mai 2010 5:50 17

135

17. PHP GENERATION WB

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-

Part 2: Creating an application, a site


install a PHP engine on the development computer. A ber of functions will increase in forthcoming versions.

17.2 Features of a PHP project


17.2.1 Creating a PHP project 17.2.3 Testing a PHP site in the editor
To create a PHP project, simply specify in the project When testing a PHP site, the site is compiled in PHP and
creation wizard ("File ... New ... Project") that you want run in your browser. To directly view the PHP pages gene-
to generate a dynamic PHP site. rated by WebDev.
As soon as the project is configured as a PHP project, all Reminder: a PHP engine is required on the development
the tools available in WebDev are automatically configu- computer.
red for the PHP project:
• The PHP RAD that generates the PHP code from a pro-
17.2.4 Compiling a PHP site in WebDev
ject for a large number of WebDev features. Compiling a PHP site allows you to:
• The compiler indicates the functions or controls that • get the WLanguage programming errors
cannot be used in PHP. A purple message is displayed • view the controls, processes, WLangage functions not
in the "Code" pane. available for PHP generation. These errors appear in
• Deployment of the PHP site via the WDDeploy tool. purple in the "Code" pane.
Note: we recommend you create a new WebDev project See the online help for more details about the WebDev
to develop a PHP site rather than convert a WebDev site elements that are not available for a PHP site.
into PHP.
17.2.5 Deploying a PHP site
17.2.2 PHP RAD The method for deploying a PHP site is the same as the
As with any project associated with an analysis, RAD can method for deploying a static site. When creating the
be used to generate the windows of your site. setup procedure, WDDeploy starts and assists you in set-
ting up your PHP site.
RAD takes into account all the requirements of genera-
ting PHP code (controls. processes, functions available See the online help for more details.
for a PHP site generated from WebDev).
Tome1_2.book Page 136 Vendredi, 28. mai 2010 5:50 17

136

18. DEPLOYING AN APPLICATION


WINDEV WD

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

18.1 Setup: Summary table


18.1.1 Setup media To optimize your setup, choose the recommended gene-
Depending on the setup medium used (Internet, in- ration mode.
house network, and so on), WinDev offers several modes
for generating the setup.
Part 2: Creating an application, a site

Modes for generating the setup offered by WinDev

Self Diskettes Directories Directory CD ROM


Extractable- the size of unique
Executable diskettes

Internet X (recommen-
ded)

CD ROM X X (recommen-
ded)
Autorun possible
Setup media

In-house X X (recommen- X
network ded)

ZIP disk X X X X (recommen-


ded)

Diskettes X (recom- X
mended)
Tome1_2.book Page 137 Vendredi, 28. mai 2010 5:50 17

137

18.1.2 Tools for creating the setup program


Several tools are available for creating the setup pro-
gram, for maintaining it and for customizing it.

Wizard WDINST, setup Customizing


editor WDSETUP

Creating a standard setup program (in X (recommen- X


French and in English by default) ded)

Maintaining a setup program X X

Customizing a setup program (the pro- X X


gram that is started on the user compu- (multilingual setup for ins-
ter) tance)

Start mode "Workshop .. Option "Tools .. WDSETUP project available


Create the WDINST" in the "Examples" sub-
setup proce- directory of the setup direc-
dure" tory of WinDev.

Part 2: Creating an application, a site


18.1.3 The different types of setup The setup is performed in two steps:
Two types of setup are available in WinDev: •The reference application is installed on the server.
• Standalone setup: recommended for single-computer The reference application corresponds to the setup
applications. program of the application on the user computers.
The setup program installs the application on the user •The final application is installed on each user compu-
computer. ter by running the setup program found on the server.
The updates will be automatically performed when
• "Multiuser setup": recommended for multiuser appli- the reference application evolves on the server.
cations.

18.2 Creating the setup program


Different types of setup are available: This setup enables you to:
- Standard setup - manage the automatic update of the application ins-
The setup program is independent of the applica- talled on the network.
tion. All the files required by the application are ins- - find out the characteristics of the users connected to
talled on the user computers. To take an update into the application at a given time.
account, this update must be run on each user com- - configure the location of the files required by the
puter. application. Different cases can be managed, for ins-
- Compact setup tance:
A standard installation is performed. However, the - Install all the application files on the server.
setup program is smaller because it does not use - Install the database on the server and install the
specific DLLs and some custom options are not files required to run the application (".EXE",
available. ".WDL", ".DLL" and so on) on each user compu-
- Setup via a MSI package ter.
A standard installation using the features of the inte- - Install part of the database on the server and ano-
grated Windows installer is performed. ther part on each user computer. The files required
- Setup with automatic update (network setup) to run the application (".EXE", ".WDL", ".DLL"
and so on) are also installed on each user compu-
ter.
Tome1_2.book Page 138 Vendredi, 28. mai 2010 5:50 17

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

19. DEPLOYING A WINDEV MOBILE APPLICA-


TION WDMobile

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, …).

19.1 Creating the setup program


To create a setup program allowing you to: - use WPINST ("Tools .. WPINST - Setup editor"). This
• deploy a WinDev Mobile application, you can: editor enables you to customize the setup program.
- use the wizard for creating the setup program directly • provide other files, you need to use the setup program
from WinDev ("Workshop .. Create the setup proce- creation wizard started from the WPINST setup editor
dure"). This wizard enables you to easily create the ("File .. New" from WPINST).
setup program. Reminder: To start the WPINST setup editor, select

Part 2: Creating an application, a site


"Tools .. WPINST - Setup editor".

19.2 Installing a WinDev Mobile application


To install your application, run the application’s setup •in MSI format: run the setup program of the upgrade
program: (".MSI" file) on the PC. The application files modi-
•on a PC (MSI file). fied by the update are replaced when synchronizing
If this PC is connected to a Pocket PC, the application the PC and the Pocket PC.
will be immediately installed on the Pocket PC. •in CAB format: you can get the upgrade’s setup pro-
If no Pocket PC is connected, the setup will be perfor- gram (CAB file) from an Internet site through GPRS
med during the next synchronization between the PC for instance.
and the Pocket PC.
Special case: installing a Smartphone
•directly on the Pocket PC (CAB file).
On a Smartphone, only the data found in the "Storage"
The files required by the application are installed in the directory (and in its sub-directories) and in the storage
specified setup directory. card are kept once the phone is switched off. The appli-
cation must be installed in one of these directories.
To install an update of your application:
Tome1_2.book Page 140 Vendredi, 28. mai 2010 5:50 17

140

20. DEPLOYING A DYNAMIC SITE WB

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

20.1 Implementing a library


Before you can proceed with the installation, all the host and will allow your WebDev site to be installed on
objects found in your site must be included in a library. A the Web Server. To install your WebDev site, the host
library is a file that groups all the elements created must:
Part 2: Creating an application, a site

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

20.2 Remote deployment (via FTP)


20.2.1 The steps 4. Create the remote setup program from the editor
The deployment steps are as follows: ("Workshop .. Create the setup procedure"). The
1. Install the WebDev application server at the host needed files are copied into the transfer directory.
(optional step). See the documentation of the Web- 5. Taking the WebDev site live.
Dev application server for more details.
2. Creation by the host of a WebDev account (in the 20.2.2 Creating the setup
administrator) and of an FTP account (in the FTP ser- You need to define the following in the wizard:
ver). 1. The information about the remote computer. This
3. The host provides the names and associated pas- information must be provided by the host:
swords as well as the server name (IP address).
Tome1_2.book Page 141 Vendredi, 28. mai 2010 5:50 17

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.

Part 2: Creating an application, a site


the Web server then.
6. Specify whether your site uses Native AS/400
•Scheduled updates: access.
The site’s files are compressed and transfered Reminder: if you site uses Native AS/400 access,
immediately on the Web server (the Web server you need to install the AS/400 DLLS on the Web ser-
must be accessible from the installation compu- ver.
ter). The WebDev site will be installed on the server If you don’t use an unlimited computer license, you
at the specified date and time. This way you can need to manage the number of concurrent connec-
update your site at night (between midnight and 3 tions in the WebDev site (INI file or registry).
a.m. for instance), when there are fewer users.
Caution: the specified date and time are the ones Summary of the elements installed and their loca-
on the server. Make sure that they are valid. tion :
•Activate the site after the setup:
The site will only be available after its installation:
Server of sites Data server
Directory of the WebDev sites Data directory
of user N of user N
Directory defined by the host. Directory defined by the host.
In this directory, a subdirectory will be created for each In this directory, a subdirectory will be created for the
site of the user N. data files of each site of the user N.
The following elements are installed in this site subdi- The following elements are installed in this data subdi-
rectory: HTML pages, the library (".WDL"), the image rectory: the ".FIC" files, the ".NDX" files, the ".MMO"
directory. files
Example: The directory of sites for the user N is Example: The directory of data for the user N is
"C:\UserN\WebDev Sites". "D:\UserN\WebDev Data".
The user N installs his site named "Boat". This site will The user N installs his site named "Boat". By default,
be installed in "C:\UserN\WebDev Sites\Boat". the data files will be installed in "D:\UserN\WebDev
Data\Boat".
Tome1_2.book Page 142 Vendredi, 28. mai 2010 5:50 17

142

20.3 Deployment by deployment package


20.3.1 The steps 4. Specify whether your site uses Native AS/400
The deployment steps are as follows: access.
1. Create the deployment package from the editor Reminder: if you site uses Native AS/400 access,
("Workshop .. Create the setup procedure"). A you need to install the AS/400 DLLS on the Web ser-
setup file is created. ver.
2. Send the deployment package (through Internet, If you don’t use an unlimited computer license, you
a CD, etc.) to the web server administrator (Internet need to manage the number of concurrent connec-
provider for instance) tions in the WebDev site (INI file or registry).
3. Install the WebDev application server at the host
5. The default profile of the Web server to use. These
(optional step). See the documentation of the Web-
parameters can be entered or modified by the per-
Dev application server for more details.
son who installs the deployment package.
4. Creation by the host of a WebDev account (in the
administrator) and of an FTP account (in the FTP ser- 6.Setup configuration: choose the type of remote
ver). setup to perform:
5. Run the deployment package on a machine and •Scheduled updates:
install the WebDev site. The site’s files are compressed and transfered
6. Taking the WebDev site live. immediately on the Web server (the Web server
must be accessible from the computer that installs
20.3.2 Creating the setup the package). The WebDev site will be installed on
You need to define the following in the wizard: the server at the specified date and time. This way
Part 2: Creating an application, a site

you can update your site at night (between midni-


1. The files to install. By default, the wizard selects
ght and 3 a.m. for instance), when there are fewer
the library, the data files, the images and the HTML
users.
pages.
Caution: the specified date and time are the ones
2. If an update of the analysis has been performed, on the server. Make sure that they are valid.
select the automatic data file modification during •Activate the site after the setup:
the installation. The site will only be available after its installation:
Note: if this option is chosen, the update will be offer you’ll be able to connect to it either by using the
during the installation. right address, or through a static page with a link
Special case: if the data files found on the server are pointing to the site. If this option is not checked,
in HyperFile 5.5 format, they need to be migrated to the site can be enabled via the remote administra-
HyperFileSQL Classic format. This migration must be tor.
performed only when the site is first updated.
3. Configuring the site. These options let you confi- 20.3.3 Installing a dynamic site
gure the site’s connection options as soon as it is To install a site, simply:
installed. 1. Run the deployment package.
These parameters can be modified if necessary: 2. Specify the settings of the Web server where the
•by the deployment administrator found on the ser- WebDev site must be installed (settings of the FTP
ver. account for the server, and settings of the WebDev
•by the remote administrator, that can be used by account for the server).
the site manager. 3. Validate the site’s installation.

20.4 Deployment by physical media


This deployment is performed in three steps: 20.4.1 Creating the setup
1. Creating the setup version. You need to define the following in the wizard:
2. Installing the WebDev application server on the
Web server if needed. See the documentation of the 1. A title and a version name for your setup. A title
WebDev application server for more details. can be entered in each language that may be chosen
3. Installing the site at the host. when running the setup program.
2. A default directory.
3. A layout for the setup window. You can customize
Tome1_2.book Page 143 Vendredi, 28. mai 2010 5:50 17

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:

Part 2: Creating an application, a site


Note: if this option is chosen, the update will be offer 1. Install your site on a "shared" server. This server
during the installation. manages the sites for several customers. This server
Special case: if the data files found on the server are is configured when installing the WebDev application
in WebDev 1.5 format, they need to be migrated to server. The WebDev administrator
WebDev 7 format. This migration must be performed (WD150ADMIN.EXE) lets you individually configure
only when the site is first updated. each WebDev site installed on this server.
7. If some programs not built using WebDev must Caution: the memory resources of the server are sha-
access HyperFileSQL files on your site, choose to ins- red among all the sites.
tall the ODBC driver. 2. Install you site on a "dedicated" Web server
Note: if this option is chosen, the driver installation (recommended solution). You own this server.
will be offered during setup. In this case, you must:
8. Specify whether your site uses Native AS/400 •configure the Web server,
access. •manage the memory resources for your site.
Reminder: if you site uses Native AS/400 access,
you need to install the AS/400 DLLS on the Web ser- To install the WebDev site on a Web server (at a host or
ver. on an Intranet):
If you don’t use an unlimited computer license, you 1. If needed, install the WebDev application server
need to manage the number of concurrent connec- on the Web server.
tions in the WebDev site (INI file or registry). Caution: if the WebDev application server is not ins-
9. Print the deployment documentation: talled on the Web server, the WebDev dynamic site
The deployment documentation lists the WebDev will not work properly.
license as well as all the modules installed during Note: For each Web server hosting WebDev sites, the
deployment. It also specifies the registry keys gene- host must own a license for the WebDev application
rated for the WebDev site. server.
When the site is installed on the server, these keys 2. To install the WebDev site, on the Web server run
can be updated directly in the registry or saved into a INSTALL.EXE which is provided with the setup pro-
file for further examination. gram.
The deployment documentation must be provided to
the person in charge of installing your WebDev site Important: To update an existing site, you must first
(host or Intranet network manager). block access to the site using the WebDev adminis-
10. If needed modify the setup generation directory. trator (select "Blocked WebDev site" in the "Sites"
By default the setup is generated in the "INST" sub- tab).
directory of your project.
Tome1_2.book Page 144 Vendredi, 28. mai 2010 5:50 17

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

If the configuration of the Web server was not perfor-


•Case 2: your Web server is listed in gray: your Web med automatically, two cases may occur:
server was not detected. To select it, all you have to •Case 1: Your server was detected and a configura-
do is check "Display all the servers". tion file was generated: you can view, modify (if
Then, you must ask to generate a configuration file in necessary) and run this file.
order to be able to run the configuration later (if you
want to install your server later for instance). •Case 2: Your server was not detected: see the
online help for more details.
•Case 3: your Web server can be selected directly:
select your server. 11. Use the WebDev administrator to unlock the loc-
You can ask to generate a configuration file in order ked sites and configure the settings of your dynamic
to run the configuration later. site.
The configuration file can be modified before it is run. These parameters correspond to:
Depending on the selected server, the extension of •the total number of authorized connections to the
the configuration file will be .reg, .conf or something site,
else. •the number of authorized connections for a user,
5. Select the setup directory: •the authorized idle time.
<webroot> specifies the root directory of the Web
12. Test the WebDev site from the WebDev adminis-
server of the computer. Depending on the selected
trator using the [Test Page] option ("Sites" tab).
Web server, the root directory is detected and dis-
played. If the root directory of the Web server is not Notes:
displayed, it can be entered in the gray area or it can • The WebDev administrator (WD150Admin.EXE) must
be found using the "…" button. be started and run as a background task. You can ins-
Caution: if the area already contains information, tall it as a service in Windows NT.
avoid modifying it.
• See ’The WebDev administrator’ chapter, page 156, for
6.Updating the data files (optional step, only in the more details about the WebDev administrator.
case of a site update).
To update the data files associated with the WebDev Important: Resources required per connected Web user
site, choose to run the automatic modification of the For each connected Web user, you must plan for:
data files. •about 400 KB of RAM per connection, in addition to
Contact the provider of the site if you don’t know the memory required by the server.
whether you must perform this update or not. •about 1 MB of disk space (virtual memory) per con-
Caution: The data files must not be in use. Use the nection, in addition to the space required by the site.
Tome1_2.book Page 145 Vendredi, 28. mai 2010 5:50 17

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).

20.5 Taking the dynamic site live


To enable web users to access your site installed at a pro- site, that is, for example, toward the address:
vider, create a link on your home page allowing your "http://195.51.231.57/WD150AWP/
dynamic WebDev site to be launched. WD150AWP.EXE/CONNECT/prettyeyes"
If you have perform the setup through a physical media,
the address to use was provided at the end of the setup Example of META tag to put in the "HEAD" section of an
program. Replace <localhost> by your site’s address. HTML page:
<meta http-equiv="refresh" con-
Example starting a "OURAPP" site from the PC SOFT
tent="0;URL=http://195.51.231.57/
site:
WD150AWP/ WD150AWP.EXE.EXE/ CONNECT/
http://www.windev.com/WD150AWP/
prettyeyes">
WD150AWP.EXE/ CONNECT/OURAPP
To start the site by using its address (mysite.com for ins- Special case: if a home page has been defined in your
tance), simply: dynamic site, the address of this home page is as fol-
1. Creating an "Index.html" type home page. lows:

Part 2: Creating an application, a site


2. In the page’s header, use the html commands http://<ServerAddress>/<SiteName>_WEB/
(META REFRESH) to redirect towards the WebDev
Tome1_2.book Page 146 Vendredi, 28. mai 2010 5:50 17

146

21. DEPLOYING A STATIC, SEMI-DYNAMIC OR


PHP SITE WB

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.

21.2 Creating the setup


To deploy your static site: •Characteristics of the FTP server used to update
1. Select "Workshop .. Create the setup proce- the site. These characteristics are provided by the
Part 2: Creating an application, a site

dure". WDDeploy starts. host, …


2. Create the profile corresponding to your site. This 3. Click the "Prepare" button. WDDeploy prepares
profile contains the following information: the list of files to install. For an update, WDDeploy
•Location of the local files ("<Project- compares the files found on the development com-
Name>_WEB" subdirectory of your project). puter and the files already installed.
•Address of the WebDev site. 4. Click the "Synchronize" button. The files of your
site are copied to the location specified in the pro-
•Location of the files of the deployed site (network file.
or FTP server).
See the online help for more details.
Tome1_2.book Page 147 Vendredi, 28. mai 2010 5:50 17

147

22. THE WEBDEV ADMINISTRATOR WB

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.

Part 2: Creating an application, a site


option).
•… The WebDev administrator is automatically started
during the first test of the site.
In deployment, two types of WebDev administrators are The administrator can then be run in background task.
available: By default, the WebDev administrator allows ten simulta-
• the WebDev deployment administrator allowing the neous connections to the same dynamic WebDev site
host to manage the dynamic WebDev sites installed on (GO icon).
a Web server.

22.2 Interface of the WebDev administrator


The WebDev administrator is made of a window contai- •the site affected by the connection,
ning several tabs: •the identity of the connected client. At run time, the
•"Connections" tab. client is identified by its IP address or by its Internet
•"Sites" tab. address,
•"Management" tab. •the current time of the connection,
•"Configuration" tab. •the idle time of the connection.
•"Advanced" tab. • The refresh rate: this parameter corresponds to the
speed at which the table listing the different connec-
22.2.1 Characteristics of the current connec- tions is refreshed.
tions
The "Connections" tab provide various information The "Connections" tab can also be used to:
about the current connections. This information can be • Directly test the sites installed on the computer (only
consulted at any time on the server: with the development version):
Select the site from the combo box, then click "Test".
• the number of current connections indicates the total This test mode is used to run the test of options speci-
number of connections to the dynamic WebDev sites fic to the management of cookies on the development
managed by the administrator. computer for instance.
• the current connection table indicates for each con- • Stop a current connection:
nection: Select one of the connections and click "Disconnect".
•the identifier of the connection, • Stop all the current connections and close the admi-
nistrator: click "Disconnect All".
Tome1_2.book Page 148 Vendredi, 28. mai 2010 5:50 17

148

22.2.2 Sites installed "Sites" tab.


The "Sites" tab provides information about the dynamic • Maximum number of connections for a user to a site:
WebDev sites installed on the computer. Maximum number of simultaneous connections
allowed for a given Web user to each site managed by
The "Sites" tab returns the list of dynamic WebDev sites the administrator.
installed on the computer and managed by the WebDev If this parameter is set to zero, a Web user trying to
administrator. For each site, the following information is simultaneously connect to the same site will be auto-
displayed in a table matically disconnected then reconnected.
• the name of the site, If this parameter is greater than zero, an error message
• the full setup directory of the site on the computer, will be automatically displayed after x simultaneous
• the name of the corresponding "project" file. connections.
This number can be modified for each site ("Sites"
The "Sites" tab can also be used to: tab).
• Delete the site selected in the table.
The site is deleted from the administrator: the WebDev The configuration of the sessions and requests is done
site is still found on the disk. through the following options:
• Refresh the display of the sites listed in the table. • Disconnect the idle users since:
This refresh operation is used to check the presence of This is the maximum connection time allowed without
a site in the administrator once it has been installed. any action performed by the Web user. When this time
• Add a site in the table. is exceeded, the Web user is automatically disconnec-
ted and an error message is displayed.
• Configure each site found on the computer. This number can be modified for each site in the
The configuration used by default is the one defined in "Sites" tab.
Part 2: Creating an application, a site

the "Configuration" tab.


You also have the ability to create a specific configura- • Duration of AWP contexts:
tion for the selected site. Validity period of the AWP contexts. As soon as the spe-
This configuration affects the number of authorized cified duration is over and if no new request was perfor-
connections, the authorized idle time and whether the med, the context file is deleted.
site must be locked during an update. See the "Confi- • Maximum duration of a request:
guration" tab for more details. Maximum time-out allowed between the beginning of
To validate the new setting immediately, click the an action performed by the Web user (via a button or a
"Apply" button. link) and the display of a response. When this time is
exceeded, an error page is displayed but the Web user
22.2.3 General configuration is not disconnected.
The general configuration corresponds to the default The WebDev administrator is used to manage a specific
connection options for the WebDev sites found on the log file allowing you to follow the traffic statistics.
server and managed by the administrator. • Generating a log file to manage the traffic statistics
The "Configuration" tab enables you to: (.log):
• Configuring the connections. This option enables you to generate a log file (".LOG"
• Configuring the sessions and the requests. extension) used to view the traffic statistics of the Web-
Dev sites via WDStatistics.
• Managing the log file to get traffic statistics. See the help about WDStatistic for more details.
• Managing the remote debugging. The location of the log file can be specified in the
"Directory" control.
The configuration of the connections is done through the
This option can be modified for each site in the "Sites"
following options:
tab.
• Maximum number of connections on the server:
• Save in the global file and in the file of each applica-
Maximum number of simultaneous connections
allowed for all the sites managed by the administrator tion:
(a connection = a Web user). This option is used to save the statistics both in the log
file of the application and in the log file of the server.
• Maximum number of connections to a site: Indeed, if the log file is defined both at server level and
Maximum number of simultaneous connections at application level ("Sites" tab), some information
allowed for each site managed by the administrator. may be "lost".
This number can be modified for each site in the
Tome1_2.book Page 149 Vendredi, 28. mai 2010 5:50 17

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

Part 2: Creating an application, a site


The WebDev administrator enables you to specify a
The "Lock the server (during an update)" option makes name or an IP address to identify a specific computer.
updating a site easier by forbidding any connection from You also have the ability to specify the port number. For
a new user. Each time a connection is tried with one of example: localhost:8080.
the sites located on the server, the user receives a mes- This computer will be used:
sage indicating that the site is temporarily unavailable
and asking the user to try again later. Already connected • when clicking the "Diagnostic" button.
Web users can continue to use the WebDev site. • when clicking the "Test page" button.
• when running the test of a site, page, report, ... from
Error messages the WebDev editor ("GO" icon).
The "Errors" button displays the various errors that can
be displayed in the browser of the Web user. You have the Test
ability to customize the error message and the HTML The "Test Page" button enables you to display in the
page where the error message is displayed. browser a page allowing you to start each one of the
dynamic WebDev sites installed on this computer.
22.2.5 Advanced options See the ’Testing an application, a site’ chapter, page 97,
The "Advanced" tab is used to: for more details about testing a WebDev site.
• Choose one of the Web servers installed on the current Email spooler
computer to run the WebDev sites. If this option is selected, your sites can send emails
• Perform a diagnostic regarding the configuration of the without blocking the execution of the various processes.
current computer. The asynchronous mode must be enabled when starting
• Specify the name or IP address of the current compu- the email session (by EmailStartSMTPSession).
ter. If the asynchronous mode is enabled, all the outgoing
• Display in the browser a page used to start all the Web- emails will be redirected to a "Spooler". The emails are
Dev sites installed on the current computer. queued up before they are sent.
• Manage the emails in asynchronous mode. Note: the email spooler is cleared when the WebDev
• Manage the server sockets. administrator is closed: the pending emails will not be
sent and they will be removed from the spooler.
• Manage the print jobs.
If "Disable the email spooler" is checked while emails
Server used are still found in the spooler, these emails will not be lost:
The "Server" button enables you to choose one of the the administrator continues to send them but no new
Web servers installed on the current computer to run the email will be accepted by the spooler.
Tome1_2.book Page 150 Vendredi, 28. mai 2010 5:50 17

150

Sockets or network printer of the Web server.


If "Allow the server sockets" is checked, your sites will be Note: If a network printer is selected, the print rights must
able to handle the server sockets (via the Socketxxx func- be defined for this printer.
tions of WLanguage).
Printer used by default (intranet site only)
The "Configure the printouts" button enables you to
select the printer used by default when printing to a local
Part 2: Creating an application, a site
Tome1_2.book Page 151 Vendredi, 28. mai 2010 5:50 17

151

23. SHARING A PROJECT


23.1 Overview
The development of a large IS system requires the partici- To share a project, you can use
pation of several developers. These developers must • the developer groupware. It is kept for backward com-
work on a single WinDev, WinDev Mobile or WebDev pro- patibility. It will not be addressed in this chapter. See
ject while sharing the resources (queries, classes, and so the online help for more details (Keyword: "Developer
on). groupware").
• the source code manager.

23.2 THE SOURCE CODE MANAGER


23.2.1 Overview ble via the developer groupware. This technology is still
WinDev/WebDev/WinDev Mobile are innovating in res- available.
pect to team work with the source code manager (also
called SCM). 23.2.2 Principle

Part 2: Creating an application, a site


Setup
Completely integrated with the environment, the source
code manager (SCM) allows you to:
•enhance teamwork,
•store the history of modifications and versions,
•save the source code of the development team.
Sized for team between 1 and 100 developers, SCM faci-
litates and standardizes the exchanges between the
developers (even when developing alone, SCM is useful
because it contains the history of your applications).
SCM is a source repository: procedures, classes, win-
dows, pages, reports, components, analyses, …
This database can be installed on a server (in HyperFi-
leSQL Classic or HyperFileSQL Client/Server mode) or on
a network computer in a shared directory.
SCM can be run locally or remotely via Internet or via an
HTTP or HTTPS connection. This feature gives you the abi-
lity to work on a project from an agency or from a remote All the project elements are saved in the SCM database
site without losing the modifications. (on the server). This operation is performed when crea-
SCM can also be used in offline mode (train, plane, …). ting the project or when importing an existing project into
the Source Code Manager.
Note: In the earlier versions, teamwork was made possi- Each developer who uses the Source Code Manager gets
a local copy of the project.
Tome1_2.book Page 152 Vendredi, 28. mai 2010 5:50 17

152

Use element back in (via the messaging software).


To work on a project element (window, page, and so on), To benefit from the modifications performed, the other
the developer must check out the element from the SCM developers must synchronize their local project with the
database, modify it and check it back in. reference project (found in the SCM database).
Tips
The source code of your applications is essential.
This source code must be handled with great care!
Tips for configuring the server that will host your source
code:
• Use a dedicated server with a comfortable size disk
(200 GB at least)
• Use the Source Code Manager (SCM) in Client/Server
mode.
• The hard disks may encounter physical problems: if
possible, use a RAID I system on your server (several
drives storing redundant information)
• Use a UPS to protect the power supply of your server.
• Perform regular backups of the SCM database (at least
once a week)
• Place the server in a "secure" zone and use a firewall.
Part 2: Creating an application, a site

If the element is already checked out, the developer can


ask the user who performed the check-out to check the

23.3 Creating a SCM database


23.3.1 Overview •when creating a project that uses SCM.
To share a project via the Source Code Manager, a SCM •when importing a project into the Source Code
database must be created. This SCM database must be Manager.
created once only on a server. •in the SCM administrator directly.
The operating system and the file system where the SCM Once the SCM database is created, all the shared Win-
database is installed must support files exceeding 4 GB. Dev, WebDev and WinDev Mobile projects can be impor-
The SCM database can be created in a shared directory ted into this SCM database.
on the network: all SCM users must have the proper
rights on this directory. The SCM database will be in 23.3.3 Converting an existing SCM database
HyperFileSQL Classic format. from HyperFileSQL Classic to HyperFileSQL
To do so, specify the network directory where the SCM Client/Server
database must be created.
The following operations enable you to convert an exis-
•on a HyperFileSQL Client/Server server: the source ting SCM database from HyperFileSQL Classic to HyperFi-
database will be in HyperFileSQL Client/Server for- leSQL Client/Server:
mat. In this case, you must specify: 1. Optimize the format of the HyperFileSQL Classic
- the server SCM database. To do so, open the SCM administra-
- the database tor ("SCM .. SCM Administrator") and select "Tools
- the port used .. Maintenance .. Migrate database to most recent
- the name and password of an administrator of the format".
HyperFileSQL database. 2. If needed, install a HyperFileSQL server on the
computer where the SCM HyperFileSQL Client/Ser-
23.3.2 When should a source database be ver database must be installed.
created? 3. In the SCM administrator, select "Tools .. Mainte-
The SCM database must be created once only. nance .. Converting the database into Client/Server.
WinDev, WebDev and WinDev Mobile enable you to 4. All the users can connect to the SCM HyperFi-
create this SCM database: leSQL Client/Server database by passing the requi-
•when installing WinDev, WebDev or WinDev Mobile. red parameters (server, database, port, name and
Tome1_2.book Page 153 Vendredi, 28. mai 2010 5:50 17

153

password of an administrator of the HyperFileSQL 23.3.4 Backups


database). We advise you to perform backups of the SCM database
on a regular basis. To do so, all you have to do is copy and
archive the data files corresponding to SCM.

23.4 Configuring the project to work with SCM


Some operations are required before an existing project ments into the project directory and to share them
can be used by the Source Code Manager. with the corresponding SCM element.
6. Select (if necessary) the dependencies that will
23.4.1 Adding a project to SCM be added to the SCM database. All the dependen-
To add a local project to SCM: cies are added by default.
1. Open your project in WinDev, WebDev or WinDev 7. Validate the addition of the project to the SCM
Mobile. database.
2. In the project editor, select "SCM .. Add the entire The developer who added the project to the Source Code
project". Manager becomes the master of the project.
3.In the wizard that starts, select the SCM database
to use. To add to SCM a network project managed by the user
Note: if you have not already created a source data- groupware:
base yet, click the "Install database" button. 1. All the developers must check in all the objects
Specify whether you want to use: into the project shared in developer groupware mode

Part 2: Creating an application, a site


•a source database found on a network share (SCM ("Project .. Status of checked-out elements",
database in HyperFileSQL Classic format). Specify "Check all in" button.
the directory of the SCM database (network com- 2. All the developers must exit the project.
puter or shared directory). 3. The project manager must:
•a SCM database found on a HyperFileSQL Client/ •load the project in the corresponding product
Server server. The SCM database will be in HyperFi- (WinDev, WebDev or WinDev Mobile)
leSQL Client/Server format. In this case, you must •check whether all the elements have been checked
specify: in ("Project .. Status of Elements (checked out,
- the server …)").
- the database •add the project to the Source Code Manager
- the port used ("SCM .. Add the entire project"). The project is
- the name and password of an administrator of the automatically copied to his local computer. The
HyperFileSQL database. steps for including the project in SCM are identical
Click the "Create" button. to the steps for including a local project.
Note: the operating system and the file system on 4. We advise you to rename the network directory
which the SCM database is installed must know where the project was found. Therefore, the project
how to manage files over 4 GB. will not be loaded when starting the product.
4. Specify the name of the directory where the pro- 5. Each developer can restart the relevant product
ject will be found in the SCM database. By default, (WinDev, WebDev or WinDev Mobile).
the projects are organized according to the product 6. Each developer (except for the project manager)
used. Any directory can be specified (the "Remote can load the project in a local directory using "File ..
directory" area can be modified). Open from SCM".
5. Select the elements that will be added to the SCM 7. The project manager can directly load the project
database. By default, all the project elements are that was copied locally onto his computer.
added.
If the project uses a shared analysis, that is not Notes:
found in the project directory, the wizard offers to • If test files or specific files were found in the network
associate it with an existing analysis of SCM, if this directory, they still can be used via the network or they
analysis has the same name. In this case, the analy- can be copied locally (each developer will have to
sis in SCM is automatically shared among the make a copy).
various projects: no additional operation is needed. • If some elements are shared among several projects,
If the project uses elements shared among several see "Including projects that share the same resources
projects: if these elements are not found in the pro- in the SCM".
ject directory, the wizard offers to copy these ele-
Tome1_2.book Page 154 Vendredi, 28. mai 2010 5:50 17

154

23.4.2 Sharing resources ment.


•Click "Import a copy" to import the element into
Sharing files the project without sharing it.
A first project was imported into the Source Code Mana-
ger. This project contains some elements shared with Solution 2: share from the SCM administrator
other projects (classes, windows, procedures, style 1.Open the source database administrator ("SCM ..
sheets, and so on). SCM Administrator").
The wizard for project addition proposes to associate the 2. In the SCM administrator:
elements already found in SCM with your project. •Select the files to share in the directory of the
The following operations explain how resources can be source project.
shared among the different projects found in SCM. •Drag and Drop these files to the directory of the
To share elements (resources) among different projects second project that shares these elements.
of SCM: •Accept to share the files.
Solution 1: direct share (recommended solution) Note: to get the recent versions of common resources,
1. Select "SCM .. Import an element from SCM". remember to regularly get the version found in SCM.
2. In the window that opens:
•The "Search" tab is used to search for an element Sharing an analysis
found in the SCM database based on its name. A first project was imported into SCM. This project con-
•The "Browse" tab is used to browse all the ele- tains an analysis shared with other projects.
ments found in the SCM database. The wizard for project addition proposes to associate an
3. Select the requested element, then: analysis already found in SCM with your project. No spe-
Part 2: Creating an application, a site

•Click the "Share" button to share the selected ele- cific operation is required.

23.5 Working with SCM


23.5.1 Opening the project from SCM (1st pro- ("Project .. Project description"). These options are
ject opening only) checked by default.
To work on a project found in the Source Code Manager: • Propose to get the latest version of the elements when
1. You must get a local copy of the project found in the project is opened:
the Source Code Manager. To do so, open the project When opening a project found in the SCM database,
from the Source Code Manager. this option proposes to retrieve the latest version of the
This operation must be performed once only by each project elements. By default, the latest version of the
developer who uses the project. The developer who elements is automatically retrieved.
added the project to the Source Code Manager has
no operation to perform. • Propose to check in the elements when the project is
Important: do not locally copy all the files using Win- closed:
dows explorer. When the project is closed, this option is used to dis-
2. Select "File .. Open a project from SCM". play the list of all the elements currently checked out so
3. In the wizard, specify: that they can be checked back in.
•the path of the SCM database (network computer By default, the checked-out elements are not checked
or shared directory) in when the project is closed.
•the user name and password (if necessary). • Propose to check in and to get the latest version of the
4. Select the directory of the SCM database corres- elements when generating executables, libraries,
ponding to the requested project. components, …
5. Specify the local directory into which the project When creating an executable, a library and so on, this
will be copied. option is used to display the list of checked-out ele-
6. Validate. The project is copied locally and it is ments in order to check in and get the latest version of
automatically opened in guest mode. the elements. Therefore, the executable, the compo-
nent or the library can contain the most up-to-date ele-
23.5.2 Options of a project affecting SCM ments.
Several options enable you to configure a project han- By default, the executable and the library are genera-
dled by the Source Code Manager. These options are ted with the project elements currently found on the
grouped in the "SCM" tab of the project description local computer.
Tome1_2.book Page 155 Vendredi, 28. mai 2010 5:50 17

155

• Check out/Check in the project automatically: ger offers to:


This option is used to automatically manage the "pro- •Show the characteristics of the checked-out element
ject file". If this option is checked, the project file is ("Properties")
checked out only if the action performed requires it. •Send a message to the person who checked out the
Once the action has been performed on the project, element ("Send a message").
the project file is automatically checked in. Reminder: an email program is provided with Win-
This option allows you to not have the "Master/Guest" Dev, WebDev and WinDev Mobile. This email
management on the project. This option can also be software uses the settings specified in the control
enabled via "SCM .. Manage the project .. Manage the centers (users, file location, and so on).
project checkout automatically". To display the email program, select"Display .. Tool-
bar .. Additional modules .. Messaging".
23.5.3 Checking out an element
•Check out the element for test only. In this case, the
The different checkout modes modifications made to this element will not be taken
SCM offers two modes for checking out the project ele- into account.
ments:
• the standard mode: if you display a SCM element that 23.5.4 Checking in an element
is not checked out, a panel indicates that this element
must be checked out before it can be modified. The The elements checked out from the Source Code Mana-
element can be checked out immediately (checkout ger are bordered by a red line in the project editor.
button found in the panel).
To check in an element, select "Check in" from the
• the automatic mode: if you attempt to modify an ele- popup menu of the element (in the project diagram or in
ment that is not checked out, SCM automatically pro- the "Project" pane).

Part 2: Creating an application, a site


poses to check out this element. Once the checkout is
When checking in an element, a screen comes up where
validated, the element can be modified. the following actions can be performed before the ele-
Note: this mode is not recommended when using SCM ment is checked in:
with a slow Internet connection.
•find out the modifications performed
To change the checkout mode, select "Tools .. Options of
WinDev/WebDev/WinDev Mobile" and select the •compare the element found in the SCM database
"General" tab. "Check out the elements during the first with the local (checked-out) element
modification" enables you to switch all the projects ope- •access the history of the element in the SCM data-
ned from the current software to the automatic mode. base.
Opening a project element to modify its You can check in the modifications made to the element
characteristics while keeping the element checked out ("Keep the file
To modify the characteristics of a project element mana- checked out").
ged by SCM:
1. Check out the element from the Source Code 23.5.5 Project management modes
Manager. Two project management modes are available with SCM:
2. Select the checkout mode of the element : • Management of the project in Master/Guest mode
The checkout mode can be: • Management of the project in automatic mode
•exclusive: no one will be able to check out this ele-
ment until it is checked back in. The element can Master and guest
be checked out for test only. The Source Code Manager distinguishes between 2 types
•For testing: the element can be modified but the of users:
modifications cannot be checked back in. • the master: the master is the user who put the project
•multiple: the element can also be checked out by in the Source Code Manager.
other developers. In this case, the differences • the guests: the guests are the developers who handle
between the different versions of the element can the project from the Source Code Manager.
be displayed when the element is checked back in. There is no need to be connected in master mode on a
3. Validate. The element is opened. The title bar indi- project. The "Master" mode is required to:
cates that the element is checked out. • modify the characteristics of the project and check in
Checking out an element already chec- these modifications into the SCM database.
ked out in exclusive mode • check in all the elements to create the executable and
If the element to check out was already checked out in the setup program of the application.
exclusive mode by another user, the Source Code Mana- To switch from master mode to guest mode, select "SCM
Tome1_2.book Page 156 Vendredi, 28. mai 2010 5:50 17

156

.. Project management .. Become guest on the project cally".


(and check all in)".
23.5.6 Special case
Modifying the analysis
In this case, the Source Code Manager proposes to check The analysis is opened in read-only by default. Therefore,
in all the project elements (including the .WDP file). it cannot be modified.
To switch from guest mode to master mode, select "SCM To modify the analysis, it must be checked out:
.. Project Manager .. Become master on the project". 1. Open the analysis in the data model editor.
Caution: modification of the project’s options: 2. Click the "Check out" button in the toolbar of
All the users of the project (master or guests) can modify SCM.
the characteristics of the project (first project window, 3. Validate the checkout. The analysis is opened in
animation, programming charter, …). These modifica- modification mode. It can be modified.
tions will have to be checked in into the Source Code
Manager by the master of the project. The modifications performed on the analysis can affect
The modifications made by a guest will be lost when the several project elements (pages, windows, controls, …).
project is updated from the SCM database. Before generating the analysis, we advise you to get the
latest version of all the project elements. Indeed, the
Automatic mode checked-out elements cannot be modified and therefore
With the automatic mode, the project file is checked out they cannot be synchronized with the analysis. Make sure
only if the action performed requires it (regardless of the that:
user). Once the action has been performed on the pro- •all the project elements are checked in
ject, the project file is automatically checked in. •the latest version of the project elements is found on
Part 2: Creating an application, a site

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-

23.6 Working in offline mode with the SCM


23.6.1 Overview 23.6.2 Disconnecting from SCM
The Source Code Manager enables you to easily work in To work in offline mode (or mobile mode):
offline mode (or mobile mode). 1. Open the relevant project.
This mode allows a developer who uses a laptop compu- 2. Select "SCM .. Remote work .. Disconnect for a
ter to continue to work on a project found in the SCM mobile use".
database while being disconnected from the SCM data- 3. In the wizard, select "I want to disconnect from
base. Source Code Manager" (Caution: this wizard is also
The principle is straightforward: used to disconnect from the control centers’ shared
database. Select the requested option for the con-
•before you disconnect, select "SCM .. Remote work .. trol centers).
Disconnect for a mobile use". Before the disconnec- 4. In the next screen, you can:
tion, we advise you to check out the different ele-
ments that will be modified (therefore, these •View the elements currently checked out by your-
elements will be "already checked out" for the other self from the project. These elements cannot be
users). You can work on your project locally. The diffe- modified by the other developers as long as you
rent project elements can be handled directly. are disconnected from SCM.
•when you reconnect, select "SCM .. Remote work .. •Check out new elements ("Status of elements"
Reconnect and synchronize". Then, all you have to do button). The checked-out elements cannot be
is check in the modified elements. modified by the other developers as long as you
are disconnected from SCM.
•Check in the checked-out elements: this option is
Tome1_2.book Page 157 Vendredi, 28. mai 2010 5:50 17

157

used to avoid locking elements unnecessarily; to 23.6.3 Reconnecting to SCM


do so, select the elements that must be checked To reconnect to SCM:
back in ("All without conflict", "All", "None"). 1. Select "SCM .. Remote work .. Reconnect and
These elements will be checked back in during the synchronize".
disconnection. 2. In the wizard, select "I want to reconnect to the
The following details are displayed for the checked out Source Code Manager".
elements: 3. The following checks are performed when you
•the modifications performed ("My Modifications" reconnect:
button) •The elements modified by the mobile developer
•the history of operations ("History" button). must be checked out (only if these elements have
•the properties ("Properties" button) not been checked out before the disconnection).
•the comparison with the element found in the data- •The new elements added by the mobile developer
base. must be added to the SCM database.
5. The disconnection is performed. The project is When you reconnect:
available locally on your computer. There is no link
with SCM. All the project elements are available and •The modifications performed by the other developers
they can be modified. are not retrieved automatically. The project must be
synchronized.
•The modifications made to the checked-out elements
are not carried over. The checked-out elements must
be checked back in into the SCM database.

Part 2: Creating an application, a site


23.7 SCM administrator
23.7.1 Overview Managing the files
The SCM administrator enables you to handle the diffe- The SCM administrator allows you to:
rent projects included in the Source Code Manager. •Add a file ("File .. Add a file"). This option enables
It allows you to: you to add a file found in the local project to the refe-
•manage the SCM databases (creation, connection to rence project.
a SCM database) •Rename a file ("File .. Rename a file"). This option
•manage branches enables you to rename the file currently selected in
the SCM administrator. This file is found in the refe-
•manage the files and the directories found in a pro- rence project (found on the SCM server).
ject of the SCM database (add, delete, rename files Note: This operation should be performed carefully.
and directories) Indeed, the renamed file will not be available to the
•manage the different files found in the SCM data- users of SCM until a full synchronization of the project
base (checkin, checkout, share, and so on). is performed. We advise you to rename the file in the
•start some tools (options, maintenance, and so on). local project then to update the reference project.
•Delete a file ("File .. Delete a file"). This option ena-
23.7.2 Managing the SCM database bles you to delete the selected file from the SCM
To connect to a SCM database: administrator. This file is found in the reference pro-
1. Select "File .. Connecting to a SCM database". ject (found on the SCM server).
2. Specify the characteristics of the database (loca- Note: This operation should be performed carefully.
tion, user, …). Indeed, only a file not used by the project can be
3. Validate. If the SCM database is accessible, you deleted. Otherwise, deleting a file from SCM may trig-
are automatically connected to this SCM database. ger problems with the project.
You can restore a deleted file: simply display the pro-
To create a SCM database: perties of the project directory found in the source
1. Select "File .. Creating a new SCM database". code manager ("Properties" options of the direc-
2. Specify the characteristics of the SCM database. tory’s popup menu). The "Deleted files" tab enables
3. Validate. If the SCM database is accessible, you you to restore the deleted files.
are automatically connected to this SCM database.
Managing the directories
23.7.3 Managing the files and the directories The SCM administrator enables you to:
•Add an existing directory. This option enables you to
Tome1_2.book Page 158 Vendredi, 28. mai 2010 5:50 17

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

of the project, stored in the history).


"Tools .. Options" allows you to:
To restore a version of a project:
1. Select the requested project in the left section of •Configure the display of the dialog boxes during the
the SCM administrator. following operations:
2. Select "History" from the popup menu. The win- - Check-in without modification
dow named "History of a directory " is displayed. - Add files to the database
3. In the table, select the requested version of the - Add dependencies to the database.
project. - Update the element dependencies
4. Click the "Save as" button. •Configure the use of the email software. You have the
5. Select the directory where the specified version of ability to send a message whenever a check-in ope-
the project must be saved. ration is performed.
6. Validate. The requested version of the project is •Configure the paths used when creating branches.
automatically saved in the specified directory. •Optimize the database performance (HyperFileSQL
Client/Server used via DSL).
23.7.4 Managing the files of the SCM data-
base Management
The SCM administrator enables you to perform all the The administration tools are available only when connec-
check-in and check-out operations. You can also see the ting to the SCM database as Administrator.
history of modifications for each element, see the diffe- If you are using a SCM database in HyperFileSQL Client/
rences, or share elements among different projects. Server format, the administrator is "Admin" by default
(without password).
Check-in and check-out operations, …
If you are using a SCM database in HyperFileSQL Classic
The SCM administrator can be used to perform the fol- format, the administrator corresponds to the "Admin"
lowing operations: user by default.
•Get the latest version of the selected file.
•Check out the selected file to the local directory of The available administration options are as follows:
the project. •Configuring the authentication: If you use a SCM
•Check out the selected file for test database in HyperFileSQL Classic format, you can
use the user database from the Project Monitoring
•Check in the selected element. Center.
All these operations can be performed directly in WinDev, •Changing the password of the administrator.
WebDev or WinDev Mobile. We advise you to perform •Undo the checkouts: This option allows the adminis-
these operations directly from the relevant project. trator to undo all the checkouts currently performed
on a project. A message can be automatically sent to
Tome1_2.book Page 159 Vendredi, 28. mai 2010 5:50 17

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/

Part 2: Creating an application, a site


be installed directly on a share name. Server format is over, you must inform all the users in
For example, if the files are installed on "\\Ser- order for them to change their parameters for connec-
ver\SCM" where "SCM" is the name of the shared ting to the SCM database.
directory, the option will not work. The files must be ins- • "Tools .. Maintenance .. Reindex and repair" lets you
talled on "\\Server\SCM\SCMDatabase" for ins- reindex the SCM database (regardless whether it is in
tance HyperFileSQL Classic mode or in HyperFileSQL Client/
If this is not the case, the data files can be moved Server mode). This option is also used to cancel the
manually (all the users must be disconnected). The transactions locked in the SCM database.
Tome1_2.book Page 160 Vendredi, 28. mai 2010 5:50 17

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,

1.1 Some characteristics of WLanguage


• The WLanguage functions can be written using lower- •preset constants,
case, uppercase or any uppercase-lowercase combi- •variable declaration statements,
nation. The code editor recognizes both. •function and procedure declaration statements,
The code editor shows the different WLanguage
keywords in different colors. This feature is very useful •keywords,
to check for example that you did not make any error •status variables,
when entering the function names. •….
• With WLanguage, you can practice event-driven pro- • WLanguage supports the object paradigm.
gramming without having to manage it.
For each object created with WinDev, WebDev or Win- • WLanguage functions have a name that is close to the
function’s use.

Part 3: Basic WLanguage syntax


Dev Mobile, you can associate one or more processes
that will be executed on the action of a given event. You • All the WLanguage keywords (functions, preset cons-
do not have to manage anything, you only need to enter tants, properties, and so on) also exist in French.
each process.
In WebDev, processes can be entered: • There is a debugger for WLanguage. It can be called
•in server code: the process will run on the server. from the start of the project, or by programming or
•in browser code: the process will be executed in when testing an element (window, page, …) or a pro-
ject.
the browser displayed on the end user’s machine
(WLanguage code entered as browser code is In the rest of this programming guide:
automatically translated into JavaScript).
WD Indicates a WLanguage feature only
For instance, for edit controls you can define: accessible from WinDev
• a process that runs when initializing the control,
• a process that runs when entering into the control, WB s Indicates a WLanguage feature only
accessible from WebDev server code.
• a process that runs when exiting the control,
• a process that runs when exiting the control, when the WB b Indicates a WLanguage feature only
control has been modified, accessible from WebDev browser
• other processes linked to other events that you can add code.
directly in the code editor. WDMobile Indicates a WLanguage feature only
accessible from WinDev Mobile
• WLanguage is made of keywords that represent:
•functions,
•properties, If nothing is specified, the presented feature is accessi-
ble from all the products and all types of code.
Tome1_2.book Page 164 Vendredi, 28. mai 2010 5:50 17

164

1.2 Server code and browser code programming WB

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.

2.1 Simples types


2.1.1 Principle WD, WB s, • Numeric: type recommended for cal-
A variable is defined by its name and by its type. WDMobile culations performed on real values
The type of the variable defines the values that can be requiring a guarantee precision on
taken by the variable, its memory footprint and the decimal places. A numeric manages
available operations. 38 significant digits (up to 32 digits
for the integer part and up to 6 digits
Reminder: Each type is identified by a WLanguage
for the decimal part).
keyword. These keywords are reserved words.
Example: MyCurrency is numeric
2.1.2 Types of variables • Real: recommended type for simple
The "simple" WLanguage types are as follows: calculations on real values.

• Boolean: recommended type for A real manages 15 significant digits,


but the precision of the decimals is

Part 3: Basic WLanguage syntax


logical operations where only two
alternatives are possible: not guaranteed. The precision of the
decimals is not guaranteed. To per-
•True (value different from 0) form precise calculations use the
•False (value equal to 0) "Currency" type.
Example: b is boolean For advanced calculations, WLan-
guage offers different types of real
• Int: recommended type for calcula- numbers.
tions performed on integer values. See ’The real type’, page 177, for
For advanced calculations, WLan- more details.
guage proposes different types of
Example: VAT is real
integers.
Example: b is int • String: recommended type for
managing characters and strings.
WD, WB s, • Currency: recommended type for With this type, there is no need to
WDMobile calculations performed on real declare the length of the string. This
values requiring a guaranteed deci- one can freely change when using
mal precision, such as currency the variable.
values.
For advanced management of cha-
A currency manages 24 significant
racter strings (mainly for the Win-
digits (up to 18 digits for the integer
dows APIs), WLanguage offers
part and up to 6 digits for the deci- different types of strings.
mal part). The precision is precise to See ’The String type’, page 178, for
6 decimals. more details
See ’The currency type’, page 177,)
for more details. (next) • Buffer: recommended type to write
Example: MyCurrency is currency code that is portable between Win-
Dev and WinDev Mobile.
Tome1_2.book Page 166 Vendredi, 28. mai 2010 5:50 17

166

WD, WB s, • Date, Time, DateTime, Duration: OR


<Variable Name> is <Variable Type>
WDMobile recommended types to manage
dates and times. <Variable Name> = <Value>
The "Date" and "Time" types ena- Note: When several variables of the same type are decla-
ble you to easily handle the dates red and initialized on the same line, only the last variable
and the times, and to manage the is actually initialized.
conversions almost automatically.
CustomerName is string
See the ’Date type’ paragraph and
CustomerName = "Dupond"
the ’Time type’ paragraph, page 168,
Counter is int = 7
for more details
i,j,k are int = 21
The "DateTime" type enables you to // Only k is initialized to 21
manage a date and a time at once.
See ’The DateTime type’, page 179, Limit values for the types of data
for more details. If a variable is assigned with a value that exceeds the
The "Duration" type enables you to limits of its type:
easily manage the differences • an error message is generated when running the test of
between times or dates. See ’The a window, page or project.
Duration type’, page 180, for more • no error message signals the overflow when the pro-
details. gram is run. The value of the variable is wrong.
WD, WB s, • Variant: recommended type to store To find out the limit values for the different types of data,
WDMobile any other simple WLanguage type. see the "Limits.WL" file found in the "Personal\Extern"
The Variant type allows you to directory of WinDev/WebDev. This file can be opened by
manage the NULL value. See ’The any text editor.
Variant type’, page 180, for more
details. To simplify your tests, the limit values for the different
Part 3: Basic WLanguage syntax

data types have been assigned to constants in the


"Limits.WL" file. To include these constants in your
2.1.3 Declaring a simple type application, use the following line of code in your project:
Declaring one or more variables Extern "Limits.WL"
<Variable Name> is <Variable Type>
The "Limits.WL" file will be automatically sought in the
or "Personal\Extern" directory of WinDev/WebDev. There
<Variable 1 Name>, <Variable 2 Name> are
is no need to copy the "Limits.WL" file into the project
<Variable Type>
directory.

CustomerName is string Limitations: Declaring variables with the same name


Counter is int Several variables with the same name cannot be used in
Price is real the same process (regardless of the type of these varia-
i,j,k are int bles).
If variables with the same name are declared in the diffe-
Declaring and initializing a variable rent processes of the project, the rule for variable scope
<Variable Name> is <Variable Type> = <Value>
applies (see page 202)
Tome1_2.book Page 167 Vendredi, 28. mai 2010 5:50 17

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.

Part 3: Basic WLanguage syntax


Note: All advanced types (different form the "Int" type) • the number of digits in the integer part and in the deci-
are recommended for using Windows APIs. mal part.
Default value A numeric type can be used:
An "Integer" variable that is declared but not initialized • to declare a simple variable.
is equal to 0. • as element of an array
2.1.5 The currency type • as element of a composite variable
• as element of a structure
WD, WB s, The Currency type can be used only in • as element of a class.
WDMobile WinDev, in WebDev server code and in A variant can contain a numeric value.
WinDev Mobile.
2.1.7 The real type
A currency variable is a real coded on 10 bytes. Currency
WLanguage offers two types of real values:
type can have up to 23 significant digits (maximum 17 for
the whole part and maximum 6 for the decimal part) and • Real (8-byte real): A real number can have up to 15
can have a value found between -604 462 909 807 314 significant digits. The precision of the decimals is not
587.353 087 and +604 462 909 807 314 587.353 087. guaranteed. To perform precise calculations use the
The currency type uses a different coding system that "Currency" type. Minimum value: 1.7*10-308, Maxi-
does not trigger rounding errors. mum value: 1.7*10+308
For a better precision, we recommend that you use the • 4-byte real: A real on 4 bytes can have up to 6 signifi-
numeric type (38 significant digits). cant digits. The precision of the decimals is not guaran-
teed. To perform precise calculations use the
For other calculations, we recommend that you use real "Currency" type.
types, which are faster. Minimum value: 3.4*10-38, Maximum value:
Default value 3.4*10+38.
A "Currency" variable that is declared but not initialized Default value
is equal to 0. A "Real" variable that is declared but not initialized is
equal to 0.
Binary coding of real numbers
Tome1_2.book Page 168 Vendredi, 28. mai 2010 5:50 17

168

Binary coding of the reals • Unicode string on:


All the real values contain the same number of significant Fixed-length string containing characters in UNICODE
digits (15). format only.
If the result of a calculation performed on real values Note: Select "We recommend you use the "String" type.
involves more than 15 significant digits, this result will be All the advanced types (different from the "String" type)
automatically rounded to 15 significant digits. To get bet- are available for compatibility with other programming
ter precision, use the currency type. languages (Turbo Pascal Windows, C, Visual Basic Win-
dows,…) or for receiving results from a Windows APIs.
2.1.8 The String type
WLanguage offers different types of character strings: Default value
A "String" variable that is declared but not initialized cor-
• Character: 2-byte character. responds to an empty string ("").
• String: dynamic size string. String type
The "string" type is specific to the WLanguage. With WinDev Mobile and WinDev do not offer the same types
this type, there is no need to declare the length of the of character strings. See the online help for more
string. This one can freely change when using the varia- details.
ble.
• String on: Fixed-length string, ending with a binary 0 Passing a string in parameter to a procedure
(like in C) A "String" variable can be passed in parameter to a pro-
. The specified length corresponds to the maximum cedure.
number of characters in the string. Caution: If the string is a "Fixed String" type, you need to
This type of string is used to create a compatible Win- remove the blank spaces. For example:
Dev/WinDev Mobile code when calling APIs found on MyString is fixed string of 30
the two platforms. MyString = "WinDev is great"
• ASCIIZ string on: String ending with a binary 0 (identi- // Delete the space characters from
cal to C). // MyString
Part 3: Basic WLanguage syntax

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

Part 3: Basic WLanguage syntax


// 31/12/2001
TodaysDate is date = DateSys()
WD, WB s, The DateTime type can only be used in
WDMobile WinDev, in WebDev (server code) and
Properties that can be used with the dates in WinDev Mobile.
See the online help to find out which properties can be
used with dates. The DateTime type enables you to easily manage a date
and a time as a single object. The DateTime type can be
StartDate is date = "20011201"
used to perform calculations (subtraction, addition, and
StartDate..Year +=5 // Add 5 years
so on) on the dates, the times and the durations.
StartDate..Month = 5 //Modify the
month StartDate is DateTime = "200112311524"
// Calculate the end date (30 days // 12/31/2001 at 15hr24mn
later) Properties that can be used on DateTime type
EndDate = StartDate
See the online help to find out which properties can be
EndDate..Month++
EndDate..Day--
used with DateTime type variables.
StartDate is DateTime
Range of dates StartDate = "200112011530"
The Date type enables you to manage the dates found StartDate..Year +=5 //Add 5 years
between 01/01/0001 and 12/31/9999. StartDate..Month = 5 //Modify the
month
2.1.11 The time type // Displays the date
Info("Date" + StartDate..Date)
WD, WB s, The Time type can be used only in Win- // Displays the time
WDMobile Dev, in WebDev server code and in Info("Time "+ StartDate..Time)
WinDev Mobile.
Interval of data
The Time type enables you to manage times easily. This The DateTime type can be used to manage the data
found between 01/01/0001 at 00:00 and 12/31/9999
Tome1_2.book Page 170 Vendredi, 28. mai 2010 5:50 17

170

2.1.13 The Duration type • the content of a variable


• the content of a simple control
WD, WB s, The Duration type can be used only in • the content of an item
WDMobile WinDev, in WebDev server code and in
WinDev Mobile. nValue is variant = 10
nValue = Edit1
nValue = Customer.Name
The Duration type lets you handle date and time intervals
easily. The Duration type can be used to perform calcula- Variant type and NULL
tion for instance (difference, addition, …). To specify that a Variant variable contains no value, use
StartTime is Time="1330" the NULL constant.
EndTime is time "1730" Note:
ConferenceDuration is Duration = … • for a Variant type, NULL means "Not assigned"
EndTime - StartTime vVal is variant
IF vVal = Null THEN ...
Properties available for the durations // returns True because not assigned
vVal = 0
See the online help to find out which properties can be
IF vVal = Null THEN ...
used with Durations.
// returns False because variant
StartTime is Time="1330"
assigned
EndTime is time "1730"
// with an integer whose value is 0
ConferenceDuration is Duration = …
vVal = 5
EndTime - StartTime
IF vVal = Null THEN ...
Info("The conference lasted: "+…
// returns False because variant
ConferenceDuration..Hour+"
assigned
hours")
// with an integer whose value is 5
Supported values
Part 3: Basic WLanguage syntax

• for a numeric type, NULL means "equal to 0".


The duration type enables you to manage the durations
nVal is int
included between plus and minus 2 billion days. The pre-
IF vVal = Null THEN ...
cision is up to the millisecond.
// the test returns True because
2.1.14 The Variant type nVal=0
nVal = 5
WD, WB s, The Variant type can be used only in IF vVal = Null THEN ...
WDMobile WinDev, in WebDev server code and in // The test returns False because
WinDev Mobile. nVal=5

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

2.2 Operations available for the dates, times and durations, …


The following operations are available for the following See the online help for more details.
types of variables: Date, Time, DateTime and Duration:
Note: WLanguage also have functions for handling dates
• addition and times (see the date and time management functions
• subtraction in the online help).
• comparison
Tome1_2.book Page 171 Vendredi, 28. mai 2010 5:50 17

171

2.3 Managing the NULL value


Or
WD, WB s, The NULL constant can be used only
HExecuteQuery(CustomerLastNameFirst-
WDMobile in WinDev, in WebDev server code and Name, …
in WinDev Mobile.
hQueryDefault, Null, "John")
The Null keyword can be used in different ways in WLan- will run the query:
guage: SELECT * FROM CUSTOMER
• to specify that a parameter must be ignored in a query WHERE FIRSTNAME=’John’
• to specify that a variant variable does not have a value
• to compare a value to 0 Query parameters entered in an edit
control: Null if empty
• In some WLanguage functions, to indicate that the
parameter should be ignored In order for your query to run even if no value was entered
• to check whether an object is allocated or not by the user, check "NULL if empty" for the edit controls
("Details" tab of the control description).
2.3.1 Null and the queries When this option is checked, if the control is empty, the
value of the parameter passed to the query will corres-
Ignoring parameters: Null in HExecute- pond to the NULL constant. No error will occur when the
Query query is generated: the condition(s) that depend on this
When running a query with parameters with HExecute- parameter will be ignored.
Query, all the query parameters do not have to be speci- For example, the SQL code run is:
fied. The query conditions that use parameters that are SELECT NameOfItems
not specified or whose value is Null will be ignored. FROM NameOfFiles
WHERE Item = {Param1}

Part 3: Basic WLanguage syntax


Example: Lets take the"Customer_lastname_firstname"
query whose SQL code is as follows: The "Ex1" query is run in the "Btn_OK" button by HExe-
SELECT * FROM CUSTOMER cuteQuery. The WLanguage code used is as follows:
WHERE LASTNAME = {Param1} HExecuteQuery(Ex1,HQueryDefault,…
AND FIRSTNAME = {Param2} EditControl1)

• 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

operators can be used (= and <>). …


Notes: If MyDynamicObject = Null Then
// Create a dynamic automation
• for a variant type, NULL means "Not Assigned" (see // dynamic
above) MyDynamicObject = …
• for a numeric type, NULL means "equal to 0" new object …
nVal is int dynamic automation MyServer
IF vVal = Null THEN ... END
// The test returns True because
nVal=0
nVal = 5
IF vVal = Null THEN ...
// The test returns False because
nVal=5

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

dow/page, local procedures, etc.) same project:


• the opening code of a report to be used in all the • the variable will be used in the process where it was
report’s processes (report code, code of the controls declared and in all the processes related to this pro-
found in the report, local procedures, etc.) cess. For example, the variable is declared in the click
• the class declaration code to be usable in the class. code of a button. When a click is performed on this but-
•To access this constant from a method of the class, ton, this variable is passed in parameter to a local pro-
use the syntax "::<Constant Name>". cedure. This variable will be used in this local
procedure.
•To access this constant from a code external to the
class, use the syntax "<Class Name>::<Constant • the constant will be used in all the other processes.
Name>". If a constant "global" to the project and a constant "glo-
bal" to a window have the same name:
Note: a constant is always global to: • the constant "global" to the window will be used in all
• to a project. the processes of the window and window controls, as
• a window/page. well as in the "local" procedures of the window.
• to a report. • the constant "global" to the project will be used in all
• to a class. the other processes.

Declaring constants with the same name Declaring a constant member


Several elements (variables or constants) with the same A constant member cannot be declared in:
name cannot be declared in the same process. • a structure.
If a constant and a variable have the same name in the • a composite variable.

2.5 The advanced types

Part 3: Basic WLanguage syntax


2.5.1 Simple array
An array is a structured type that is used to group a set of CustomerArray is array of 5 …
elements of the same type. Each array element can be by 7 by 3 int
directly accessed by its subscript. // Equivalent to :
CustomerArray is …
The Dimension function can be used to resize an array. array of 5,7,3 int
Note: The Array keyword is used to define a "simple" // Resize the array
array. Other types of "advanced" arrays are available: Dimension(CustomerArray,7,9,4)
• Dynamic array: Array allocated on demand. Referring to a "simple" array
• Fixed array: Fixed-size array (recommended for Win- • Referring to an element in a one-dimensional array:
dows APIs). <Array Name>[Subscript1]
• Associative array: Array used to stored elements • Referring to an element in a two-dimensional array:
indexed on any type of information. <Array Name>[Subscript1, Subscript2]
OR
Syntax <Array Name>[Subscript1][Subscript2]
Declaring a "simple" array • Referring to an element in a n-dimensional array:
<Array Name> is array of <Dimension 1>
<Array Name>[Subscript1,…,SubscriptN]
[by <Dimension 2>]…[by <Dimension 10>] OR
<Type of Array Elements> <Array Name>[Subscript1]…[SubscriptN]
Or • Passing an array in parameter to a procedure:
<Array Name> is array of <Dimension 1> <Procedure Name>(<Array Name>)
[,<Dimension 2>]…[,<Dimension 10>]
<Type of Array Elements> Note: An array cannot be handle as a whole. For ins-
tance, an array cannot be assigned to another array.
CustomerArray[2,5,3] = 47
// Equivalent to :
CustomerArray[2][5][3] = 47
Tome1_2.book Page 174 Vendredi, 28. mai 2010 5:50 17

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

Note: An array cannot be handled as a whole. For ins- optional parameters).


tance, an array cannot be assigned to another array.
CustomerArray[2,5,3] = 47 A dynamic array cannot be made of:
// Equivalent to : • composite variables.
CustomerArray[2][5][3] = 47 • arrays.
Freeing a dynamic array (optional) Declaring variables with the same name
A dynamic array is automatically freed at the end of the Several variables with the same name cannot be used in
lifetime of the variable (when the window is closed for the same process (regardless of the type of these varia-
instance) or when allocating new dimensions. bles).
To explicitly free a dynamic array, use the following syn- If variables with the same name are declared in the diffe-
tax: rent processes of the project, the rule for variable scope
Delete <Name of Dynamic Array> applies.
Passing a dynamic array in parameter to a procedure WLanguage functions and dynamic arrays
A dynamic array can be passed in parameter to a proce- Several WLanguage functions can be used to handle the
dure. To do so, use the following syntax : dynamic arrays. You have the ability to perform sorts,
<Procedure Name>(<Array Name>) searches, ... See the online help for more details.
SupplierArray is dynamic array
SuppArray = … 2.5.3 Fixed array
new dynamic array of
10 by 50 strings WD, WB s, The fixed arrays can only be used in
// Call the procedure WDMobile WinDev, in WebDev (server code) and
// DisplayArray in WinDev Mobile.
DisplayArray(SupplierArray)
A fixed array is an "advanced" type of array: the dimen-
Declaring a dynamic array member sions of this array are set at compilation time and cannot

Part 3: Basic WLanguage syntax


A "dynamic array" member can be declared in: be modified.
• a structure, The dimensions of a fixed array are defined during the
• a composite variable, compilation, only if the dimensions of this array corres-
pond to:
• a class.
• an integer.
The dynamic array must be allocated after the declara-
tion of the structure, composite variable or class. • a constant that was previously created.
// Declare a structure Otherwise, a WLanguage error occurs during the compi-
Struct is structure lation of the project.
x1 is int Reminder: An array is a structured type that is used to
x2 is dynamic array group elements of the same type. Each array element can
END be directly accessed by its subscript.
// Declare a variable of
We advise you to use:
// structure type
MyStruct is struct • a fixed array to pass an array as parameter to Windows
// Allocate the array API functions.
x2 = new dynamic array … • a dynamic array or a "simple" array when the array
of 4,7 int can be resized during the program’s execution.
• An associative array to store elements indexed on any
Dynamic array dimension type of information.
The Dimension function allows you to:
• find out the number of elements in a dynamic array. Syntax
• resize a dynamic array. Declaring a fixed array
Caution: The Dimension function does not allow you to <Array Name> is array fixed of
modify the number of dimensions in a dynamic array. <Dimension 1> [by <Dimension 2> ...
Elements of a dynamic array [by <Dimension 10>]]
A dynamic array can be made of classes only if these <Type of Array Elements>
classes have a constructor without parameter (or with
Tome1_2.book Page 176 Vendredi, 28. mai 2010 5:50 17

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":

Referring to a fixed array


• Referring to an element in a one-dimensional array:
<Array Name>[Subscript1]
• Referring to an element in a two-dimensional array:
<Array Name>[Subscript1, Subscript2]
OR
<Array Name>[Subscript1][Subscript2]
• Referring to an element in a N-dimensional array:
<Array Name>[Subscript1, ... , SubscriptN]
OR This memory representation is compatible with the Win-
<Array Name>[Subscript1]…[SubscriptN] dows APIs. Therefore, a fixed-size array can be transmit-
• Passing an array in parameter to a procedure: <Proce- ted to a function of the Windows APIs.
dure Name>(<Array Name>) Dimension of a fixed array
Note: An array cannot be handle as a whole. For Dimension allows you to find out the number of elements
instance, an array cannot be assigned to another in a fixed array.
Part 3: Basic WLanguage syntax

array. Reminder: Fixed arrays cannot be resized.


CustomerArray[2,5,3] = 47 Elements of a fixed array
// Equivalent to : A fixed array can be made of objects. An object repre-
CustomerArray[2][5][3] = 47 sents the instantiation of a class. If the class has a cons-
tructor, this constructor must be without parameter (or
Passing a fixed array in parameter to a procedure with optional parameters).
A fixed array can be passed in parameter to a procedure.
To do so, use the following syntax : A fixed array cannot be made of:
<Procedure Name>(<Array Name>) • composite variables.
SuppArray is fixed array … • arrays.
of 10 by 50 strings
// Call DisplayArray procedure
Declaring variables with the same name
DisplayArray(SupplierArray)
Several variables with the same name cannot be used in
the same process (regardless of the type of these varia-
Declaring a fixed array member bles). If variables with the same name are declared in the
A ’fixed array’ member can be declared in: different processes of the project, the rule for variable
• a class. This fixed array is directly allocated in the scope applies.
memory zone of this class.
2.5.4 Associative array
• a composite variable. This fixed array is directly alloca-
ted in the memory zone of this composite variable. WD, WB s, Associative arrays can be used only in
• a structure <Structure Name>. This fixed array is WDMobile WinDev, in WebDev server code and
directly allocated in the memory zone of each <Struc- in WinDev Mobile.
ture Name> variable.
An associative array is an "advanced" type of array: it is
used to group a series of elements of the same type.
Each array element is indexed on any type of information
(and not only on a numeric index as in the other types of
arrays).
Tome1_2.book Page 177 Vendredi, 28. mai 2010 5:50 17

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.

Part 3: Basic WLanguage syntax


WD, WB s, The composite variables can only be • Class. This class must have a constructor without para-
WDMobile used in WinDev, in WebDev (server meter (or with optional parameters).
code) and in WinDev Mobile.
All the other types of data (string, constant, and so on)
A composite variable is made of different types of ele- are forbidden.
ments (members). Declaring an array member in a composite variable
Note: if you use custom variables, we recommend you Declaring a ’simple array’ member:
declare: The array dimensions are fixed when the array is decla-
•a composite variable if a single variable of this type red. The array’s dimensions can be modified by the
is used in your project. Dimension function.
•a structure type if several variables of this type are Declaring a dynamic array member:
used in different processes of the project. The array dimensions must be defined (which means that
the array must be allocated) before using the array.
Syntax // Declare a composite variable
Declaring a composite variable MyCompVar is composed of
<Variable Name> is composed of x1 is int
<Members of the composite variable> x2 is dynamic array
END END
ProductRef is composed of // Allocate the array
SCode is int MyCompVar.x2 = new array …
PdtCode is fixed string on 10 dynamic of 4,7 int
END // Initialize the array
MyCompVar.x2[1,1] = 25
Handling a member of a composite variable
<Variable Name>.<Member Name> Limits of a composite variable
ProductRef.SCode = 7 You cannot:
ProductRef.PdtCode = "Screen" • directly assign a composite variable to another compo-
site variable: each member must be assigned one by
one.
• compare two composite variables.
Tome1_2.book Page 178 Vendredi, 28. mai 2010 5:50 17

178

• pass a composite variable in parameter to a proce-


dure. Declaring a structure variable
<Variable Name> is <Structure>
• define an inheritance in a composite variable. ProductRef is structure
• restrict the access to a member of a composite varia- SCode is int
ble: all the members of a composite variable must be PdtCode is fixed string on 10
public. END
Which "advanced" types can be a member? Armchair is ProductRef
An "advanced" variable can be a member of another
Handling a member from a structure variable
"advanced" variable. The table below presents the diffe- <Name of Structure Variable>:<Name of Structure
rent combinations: Member>
Can be a Variable Structure Class Array ProductRef is structure
member of composite SCode is int
Variable No No No No PdtCode is fixed string on 10
composite END
Structure Yes Yes Yes Yes Armchair is ProductRef
Armchair:SCode = 7
Class Yes Yes Yes Yes Armchair:PdtCode = "Furniture"
Array Yes Yes Yes No
Declaring the structures
Declaring variables with the same name If <Structure Name> is declared:
You cannot declare: • in the project code, you will be able to declare a
• two variables with the same name (regardless of the <Structure Name> type variable for the whole project.
type of these variables) in a process. • in the declaration code of the global variables of a
• two members with the same name in the same compo- window/page you will be able to declare a <Structure
Name> variable in this window/page, in the controls of
Part 3: Basic WLanguage syntax

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

Declaring an array member in a structure You cannot declare:


Declaring a ’simple array’ member: • two variables with the same name (regardless of the
The array dimensions are fixed when the array is decla- type of these variables) in a process.
red. The array’s dimensions can be modified by the • two members with the same name in the same struc-
Dimension function. ture.
Declaring a dynamic array member: If variables with the same name are declared in the diffe-
The array dimensions must be defined (which means that rent processes of the project, the rule for variable scope
the array must be allocated) before using the array. applies.
// Declare a structure
Struct is structure 2.5.7 Dynamic structure
x1 is int
x2 is dynamic array WD, WB s, The dynamic structures can only be
END WDMobile used in WinDev, in WebDev server
// Declare a structure code and in WinDev Mobile.
// variable
MyStruct is struct A structure can be allocated dynamically: It is called
// Allocate the array dynamic structure instantiation.
MyStruct.x2 = new array dynamic of 4,7 The dynamic structure instantiation enables you to create
int a structure at a given time and to free this structure when
// Use the array it is no longer used.
MyStruct:x2[1,1] = 25

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

Part 3: Basic WLanguage syntax


The table below presents the different combinations: used anymore. However, you can force the destruction of
Can be a Variable Struc- Class Array the structure.
member of composite ture
File is structure
Variable No No No No
Name is String
composite
Extension is String
Structure Yes Yes Yes Yes Directory is String
Class Yes Yes Yes Yes End
SourceFile is dynamic File
Array Yes Yes Yes No
//…
Passing a structure in parameter to a procedure SourceFile = New File
A "structure" variable can be passed in parameter to a //process the object …
procedure. //…
//free the object
Delete SourceFile
To do so, use the following syntax:
Declaring a dynamic structure
<Procedure Name>(<Name of Structure Variable>)
ProductRef is structure
<Variable Name> is <Structure Name> dynamic
SCode is int The important parameters of this syntax are as follows:
PdtCode is fixed string on 10
END <VariableName>
Armchair is ProductRef Name identifying the variable of the structure.
// Call DisplayProduct procedure
DisplayProduct(Armchair) <StructureName>
Name identifying the structure, defined when creating
Limits of a structure the structure
Structure inheritance is not allowed.
The access to a structure member cannot be restricted: Instantiating a dynamic structure
all the members of a structure are public. <Variable Name> = …
new <Structure Name> [<Parameters>])
Declaring variables with the same name
Tome1_2.book Page 180 Vendredi, 28. mai 2010 5:50 17

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)

Lifespan of an automation object A dynamic automation object is an automation object


The automation object is created when it is declared. allocated upon request, in the program.
The automation object is automatically destroyed at the Syntax
end of the process containing its declaration.
Declaring a dynamic automation object
An automation object declared "global" in the code of <Name of Dynamic Automation Object> is dynamic
the: automation object
• window initialization: will be deleted at the end of the // Declaration
window closing process. MyDynamicObject…
• project initialization: will be deleted at the end of the is dynamic automation object
window closing process of the project’s first window.
Tome1_2.book Page 181 Vendredi, 28. mai 2010 5:50 17

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

Part 3: Basic WLanguage syntax


• window initialization: will be deleted at the end of the that can be performed on a view (or on a query) can be
window closing process. performed on a Data source variable associated with a
view (or with a query).
• project initialization: will be deleted at the end of the
window closing process of the project’s first window. To describe a temporary data source, you must:
1. Declare a "Data source" variable.
To explicitly free a dynamic automation object, use the 2. Initialize the data source (hExecuteSQLQuery or
following syntax: hCreateView).
Delete <Name of Dynamic Automation Object> 3. The data source is automatically freed at the end
of the variable’s life.
Allocating a dynamic object
When allocating a dynamic automation object, the auto- Note: when closing the application (or the process where
mation server is automatically started. the data source was created), the data source will be
To allocate a dynamic automation object with an existing deleted automatically.
instance of an automation server, use GetActiveObject. Syntax
Passing parameters to a method Declaring a data source
The methods of automation servers can accept one or <Variable Name> is data source
more parameters. Declaring several data sources
When calling a method, the sequence of parameters <Name of Variable 1>, <Name of Variable 2> are
must be respected (see the documentation for more data sources
details). MyDataSource …
• With some automation servers, some method parame- is data source
ters are not valued: only the presence of the parameter MyDataSource1, MyDataSource2 …
is important. The value taken by this parameter has no are data sources
importance.
For instance, the "EditReplace" method of Word Basic Initializing a "Data source" variable (query or view)
accepts 10 parameters, the last one (ReplaceAll) To initialize a "Data source" variable, use:
being not valued. • HExecuteSQLQuery if the variable is associated with a
In WLanguage, any ordinary value can be passed to query.
non-valued parameters.
Tome1_2.book Page 182 Vendredi, 28. mai 2010 5:50 17

182

• HCreateView if the variable is associated with a view.


Declaring variables with the same name
MyQuery is data source
Several variables with the same name cannot be used in
//MyQuery is associated with a query
the same process (regardless of the type of these varia-
//Init. of the MyQuery variable
bles).
HExecuteSQLQuery(MyQuery,…
"SELECT NAME FROM CUSTOMER") If variables with the same name are declared in the diffe-
MyView is data source rent processes of the project, the rule for variable scope
// MyView is associated with a view applies.
// Init. of the MyView variable
HCreateView(MyView, CUSTOMER, "*",…
2.5.11 File description
"NAME,CITY", "NAME]=’A’", hViewDe-
fault)
WD, WB s, The File Description variables can only
WDMobile be used in WinDev, in WebDev server
Deleting the data source (query or view) code and in WinDev Mobile.
When the same Data Source variable is used several
times with different data sources, the first data source A File description variable is used to describe one or
must be freed. more temporary data files. The description of each file is
To free the memory space occupied by the data source validated by HDescribeFile.
(query or view), use: After this validation:
• HCancelDeclaration if the variable is associated with a • the file can be handled like any other file described in
query. the analysis.
• HDeleteView if the variable is associated with a view. • the "File description" variable is reinitialized and it can
MyQuery is data source be used to describe another temporary data file.
MyQuery = HExecuteSQLQuery(… Syntax
MyQuery,"SELECT NAME FROM CUSTO-
MER")
Declaring a file description
Part 3: Basic WLanguage syntax

<Variable Name> is file description


// Delete the data source
// associated with the MyQuery varia- Declaring several file descriptions
ble <Name of Variable 1>, <Name of Variable 2> are
HCancelDeclaration(MyQuery) file descriptions
MyQuery = HExecuteSQLQuery(… MyFile …
MyQuery,… is file description
"SELECT NAME FROM SUPPLIER") MyFile1, MyFile2 are…
MyView is data source file descriptions
// MyView is associated with a view
// Initialize the MyView variable Describing a "File description" variable
HCreateView(MyView, CUSTOMER, "*",… To describe a "File description" variable, use the WLan-
"NAME,CITY", "NAME]=’A’", hViewDe- guage properties specific to file descriptions.
fault)
// Delete the data source
To validate the description of a "File description" varia-
// associated with the MyView variable
ble, use HDescribeFile.
HDeleteView(MyView) // Describe the "CUSTOMER" file
HCreateView(MyView, CUSTOMER, "*",… MyFile..Name = "CUSTOMER"
"NAME,FIRTSNAME", "NAME]=’C’", MyFile..Type = hFileNormal
hViewDefault) MyFile..FicCryptMethod = …
hCryptStandard
Handling a query or a view by programming // Description of
To handle a query or a view by programming, we recom- // the file items
mend that you use a "Data source" variable. …
However, you have the ability to give a logical name when // Validate description
initializing the query or the view. In this case, the Extern // of "CUSTOMER" file
keyword must be used to directly handle the view of HDescribeFile(MyFile)
query in the code editor. This method can slow down the
Properties specific to the description of the data files
execution of your processes.
The properties specific to the description of data files are
Note: when using a logical name, the query or the view detailed in the online help.
are not deleted automatically: you need to use the HCan-
celDeclaration and HDeleteView functions.
Tome1_2.book Page 183 Vendredi, 28. mai 2010 5:50 17

183

How to describe temporary files? 2.5.12 Link description


To describe temporary files, you must:
1. Declare "File description", "Item description" WD, WB s, Link description type variables can be
and "Link description" variables (if necessary). WDMobile used only in WinDev, in WebDev ser-
2. For each file: ver code and in WinDev Mobile.
•describe the characteristics of the file using the
HyperFileSQL properties. A Link description variable is used to describe a link
•describe the characteristics of the items using the between two temporary data files. The description of
HyperFileSQL properties. each link is validated by HDescribeLink.
•validate the description of each item (HDescri- After this validation:
beItem). • this item can be handled as any other link described in
•validate the description of the file (HDescribeFile). the analysis.
3. Describe, if needed, the characteristics of the • the "Link Description" variable is reinitialized and it
links via the HyperFileSQL properties. can be used to describe another link.
4. Validate (if necessary) the description of each link
(HDescribeLink). Syntax
Declaring a link description
Handling the items of a temporary file <Name of Variable> is link description
When a file is created in the data model editor, the
names of the file and items are automatically recognized Declaring several link descriptions
by the compiler. <Name of Variable 1>, <Name of Variable 2> are
When creating a temporary file with a "File Description" link descriptions
variable, the name of the temporary file and its items are MyLink …
defined with the Name property. These names are not is link description
automatically recognized by the compiler. A compilation MyLink1, MyLink2 are …
error occurs if these names are used to define the tempo-

Part 3: Basic WLanguage syntax


link descriptions
rary file or its items.
Describing a "Link description" variable
In order for the name of the temporary file to be recogni-
zed by the compiler, this file name must be declared as To describe a "Link Description" variable, use the WLan-
data source via the data source keyword. This temporary guage properties specific to link descriptions.
file can then be handled by its name in the code editor. To validate the description of a "Link Description" varia-
MyFile is description … ble, use HDescribeLink.
of file // Description and validation
… // of the City and Customer files
MyFile..Name = "CUSTOMER" …
… // Describe the "LIVES" link
HDescribeFile("CUSTOMER") MyLink..Name = "LIVES"
… MyLink..SourceFile = "CITY"
CUSTOMER is data source MyLink..LinkedFile = "CUSTOMER"
… MyLink..SourceKey = "CITYNAME"
HReadFirst(CUSTOMER, CUSTOMER.CUST- MyLink..LinkedKey = "CUSTCITY"
NAME) // Validate description
// of the "LIVE" link
Note: you can also declare the name of the temporary file HDescribeLink(MyLink)
using Extern. However, the execution speed of the pro-
cess will be slower. Properties specific to the link description
The properties specific to link descriptions are detailed in
Declaring variables with the same name the online help.
Several variables with the same name cannot be used in
the same process (regardless of the type of these varia- How to describe temporary files?
bles). If variables with the same name are declared in dif- To describe temporary files, you must:
ferent processes of the project, the rule for variable 1. Declare "File description", "Item description"
scope applies. and "Link description" variables (if necessary).
2. For each file:
•describe the characteristics of the file using the
HyperFileSQL properties.
•describe the characteristics of the items using the
Tome1_2.book Page 184 Vendredi, 28. mai 2010 5:50 17

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).

Part 3: Basic WLanguage syntax


Declaring variables with the same name If variables with the same name are declared in different
Several variables with the same name cannot be used in processes of the project, the rule for variable scope
the same process (regardless of the type of these varia- applies.
bles).
2.5.15 Connection
If variables with the same name are declared in different
processes of the project, the rule for variable scope WD, WB s, Connection type variables can be
applies. WDMobile used only in WinDev, in WebDev ser-
ver code and in WinDev Mobile.
2.5.14 Font
A Connection variable is used to describe one or more
WD, WB s, The font variables can only be used in connections to external databases (HyperFileSQL Client/
WDMobile WinDev, in WebDev (server code) and Server, Native Access, etc.).
in WinDev Mobile. The connection can be opened by HOpenConnection.
A Font variable is used to create a dynamic font. The pro- The Connection variable enables you to:
perties of this font can be modified in the program. • describe a new connection (equivalent to HDescribe-
A dynamic font enables you to select the font used Connection)
• in drawings (dFont). • create a connection (that will be opened by HOpen-
• in charts (grLabelFont, grLegendFont, grTitleFont and Connection)
grAxisTitleFont). • modify an existing connection.
• for printouts (iFont). Syntax
• in the controls of a window (Font property of a window Declaring a connection
controls). <Variable Name> is connection
• in the controls of a report (Font property for the report Declaring several connections
controls). <Name of Variable 1>, <Name of Variable 2> are
Syntax connections
MyConnection is Connection
Declaring a font
<Variable Name> is font
Tome1_2.book Page 186 Vendredi, 28. mai 2010 5:50 17

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

The following functions can be used to handle a Queue


the end of the queue and they are retrieved in enqueue
order. variable

Syntax Dequeue Retrieves the element at the


Declaring and initializing a queue beginning of the queue.
<Queue Name> is Queue of <Type of Elements in Deserialize Deserializes a queue.
the Queue>
Enqueue Adds an element at the end of
• For example, if the elements are added in the following
the queue.
order: 1, 2, 3, they will be retrieved in the same order 1,
2, 3 Serialize Serializes a queue.
MyQueue is queue of int Deletes all Deletes all the elements from a
queue.
// Enqueue the values 1, 2 and 3
Enqueue(MyQueue, 1) Queues and multithreading
Enqueue(MyQueue, 2) Enqueue(MyQueue, Multithreading management is taken into account when
3) adding and deleting an element (Enqueue and Dequeue
functions).
// Display the trace: 1, 2, 3 • You also have the ability to use properties during mul-
x is int tithread management but the result is not permanent.
WHILE Dequeue(MyQueue, x) For example
Trace(x)
IF MyQueue..Occurrence>0 THEN
END
// When the thread arrives here, …
the queue may be empty
END

Browsing through queues:


The FOR EACH syntax can be used to browse through the
queues. The elements are browsed in enqueue order that
is similar to the dequeue order.
Tome1_2.book Page 187 Vendredi, 28. mai 2010 5:50 17

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:

Part 3: Basic WLanguage syntax


IF MyList..Occurrence>0 THEN
2.5.17 List // When the thread arrives here, …
A list is a structured type that is used to group a set of ele- the list may be empty
ments of the same type. The elements can be added at END
the end of the list or they can be inserted into the list Browsing through the lists.
Syntax The FOR EACH syntax can be used to browse through the
Declaring and initializing a list lists.
<List Name> is List of <Type of Elements in the • The syntax used corresponds to the one used for the
List>
arrays:
WLanguage properties that can be used with the List FOR EACH [ELEMENT] <Variable> …
type [, <Counter> [, <Counter>]] …
The following properties can be used to handle a List OF <List> [<Direction>]
variable ...
END
Name of the property Effect
The elements can be modified during the browse opera-
Occurrence Returns the number of tion. If the list is modified during a browse operation, the
occurrences of the list. browse operation is affected by the additions and by the
Empty True if the list is empty, deletions. The functions available during the browse ope-
False otherwise. ration are as follows:
•Syntax: Insert(<List Name>, BeforeCurrentElement,
Note: <Value>)
These properties can be handled via one of the following •Caution: the element will be read with the next itera-
syntax: tion if the loop is descending.
•<Variable Name>..<Name of > •Syntax: Insert(<List Name>, AfterCurrentElement,
•<Variable Name>.<Property Name> <Value>)
•Caution: the element will be read with the next itera-
tion if the loop is ascending.
•Syntax: Delete(<List Name>, CurrentElement)
Tome1_2.book Page 188 Vendredi, 28. mai 2010 5:50 17

188

Notes: Empty True if the stack is empty,


False otherwise
•The content of the list can be displayed in the debug-
ger. Note: These properties can be used with the following
•A list can be used to type a procedure parameter. syntax:
•Une liste peut être copiée avec l’opérane liste. •<Variable Name>..<Property Name>
•<Variable Name>.<Property Name>
•A list can be initialized by a list of elements
WLanguage functions for managing the stacks.
2.5.18 Stack The following functions can be used to handle a Stack
A stack is a structured type that is used to group a set of variable.
elements of the same type. The elements are added at
the end of the stack and they are retrieved starting from Pop Retrieves the element at
the most recent one. the beginning of the
stack.
Syntax
Declaring and initializing a stack Deserialize Deserializes a stack.
<Stack Name> is stack of <Type of Elements in Push Adds an element to a
the Stack> stack.
• For example, if the elements are added in the following
Serialize Serializes a stack.
order, 1, 2, 3, they will be retrieved in the following
order, 3, 2, 1.: DeleteAll Deletes all the elements
MyStack is stack of int from a stack.
// Pop the values 1, 2 and 3 Stacks and multithreading
Push(MyStack, 1)
Push(MyStack, 2) Push(MyStack, 3)
Multithreading management is taken into account when
adding and deleting an element (Push and Pop func-
// Display the trace: 3, 2, 1
Part 3: Basic WLanguage syntax

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

Notes: •A stack can be copied by the operator =. You also


•In the debugger, the content of the stack is displayed have the ability to copy an instance of class or struc-
in pop order. ture containing a stack.
•A stack can be used to type a procedure parameter. •A stack can be initialized by a list of elements in push
order

2.6 Local variables/global variables


Two types of variables are available: • The global variables declared in a child window cannot
• Local Variable: can only be used in the process where be used in its parent window.
it was declared. • When the window/page where the variable was decla-
• Global Variable: can be used in all the processes rela- red is closed, this variable cannot be used anymore.
ted to process where it was declared. Availability of the variables in WebDev in browser code:
Caution: You cannot declare two variables with the same the Server variables global to a page are available in the
name (especially a global variable and a local variable). page’s browser code only for the following types: boo-
lean, integer, real, string.
2.6.1 Global variable Caution: modifications performed on these global varia-
Variables global to a project bles in browser code are not applied to the server.
WD, WB s, The variables global to a project can Tip: global variables declared in the server code can be
WDMobile only be used in WinDev, in WebDev used to transfer information to the browser.
server code and in WinDev Mobile.
Browser variables that are global to a page
The global variables declared in the initialization pro- The global variables declared in the "Page Load

Part 3: Basic WLanguage syntax


cess of a project can be used in all the processes: (onLoad)" code can be used in all the browser proces-
• of the project. ses:
• of the windows/pages (processes of the window/page, • of the page.
of its associated controls and local procedures). • of the page controls.
• of the reports (processes of the report, its associated • of the local procedures associated with the page.
controls and local procedures).
Availability of the variables in server code: the Browser
Availability of the variables in WebDev Browser code: the
variables global to a page are not available in the page’s
global server variables of the project are available in server code.
browser code only for the following types: boolean,
integer, real, string. Caution: the modifications perfor- Tip: global variables declared in browser code can be
med on these global variables in browser code are not used to transfer information between different processes
applied on the server. running in the browser.
Tip: global variables declared in the server code can be
used to transfer information to the browser. Notes:
• The global browser variables cannot be initialized on
Variables global to a window/page the declaration line.
The global variables declared in the declaration process • The global browser variables can be initialized with the
of the global variables of a window/page can be used in value of a server global variable (only for the boolean,
all the processes: integer, real and string types).
• of the window/page. • We recommend that you disable the "cache" of your
• of the controls of the window/page. browser when developing the WebDev application.
• of the local procedures associated with the window/ Indeed, the global variables are translated into JavaS-
page. cript in ".JS" files. If the "cache" is enabled, the tests
of your pages may reload files corresponding to former
Limits: values of variables. See the online help for more
• The global variables of a window cannot be used by its details.
sibling windows.
Variables global to a report the report’s controls and of the local procedures associa-
The global variables declared in the opening process of ted with the report.
a report can be used in all the processes of the report, of
Tome1_2.book Page 190 Vendredi, 28. mai 2010 5:50 17

190

Variables global to a set of By default, a variable is local when it is declared.


procedures
The global variables declared in the initialization process WD, WB s, In browser code, only the following
of a set of procedures can be used in all the processes: WDMobile types can be used to declare the local
variables:
• of the different procedures found in the set.
• boolean
• of the current project.
• integer
Syntax • real
Declaring one or more global variables • string
GLOBAL
<Global variables>
• array of one of the previous types
GLOBAL // All the following declara-
tions
Syntax
// are global Declaring one or more local variables
// variables [LOCAL]
Subscript is int <Local variables>
CustomerName is string LOCAL // All the following
// declarations are local
2.6.2 Local variable // variables
The local variables can only be used in the processes I is int
where they have been declared. The local variables are CustomerFName is string
unknown outside these processes. These variables can-
not be shared among several processes.

2.7 Rule for variable scope


Part 3: Basic WLanguage syntax

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 Logical operators


3.2.1 Overview For example, the two following code lines are equivalent:
The logical operators are: IF TestNum THEN …
IF TestNum <> 0 THEN …
• AND and _AND_: Logical multiplication.
• OR and _OR_: Logical addition. The first syntax (IF TestNum THEN) should be preferred to
• NOT: Logical negation. the second one.

Part 3: Basic WLanguage syntax


The logical operators are used to perform logical opera- String variable
tions and to build conditions. A WLanguage error will occur if a string variable is han-
IF Customer.City = "Boston" AND … dled like a logical operator.
Customer.Title = "Mr" THEN For example, the following syntax, "IF ChTest THEN" will
ManBoston ++ return an error at run time (but not when compiling the
// Number of men living project).
// in Boston
END Priority
IF Customer.City = "Boston" OR … The operators AND and OR, _AND_ and _OR_ have the
Customer.City = "Miami" THEN same priority. Some brackets can be used to give priori-
BostonMiami++ ties to these operators. For example:
// Number of customers living IF (A = 2 AND B > 3) OR …
// either in Boston, or (A = 2 AND B < 0) THEN …
// in Miami
END Exceptions: in SQL filters and SQL queries, the AND ope-
rator has priority over the OR operator.
3.2.2 Rules For example:
• True AND True: returns True Condition1 AND Condition2 OR
• True AND False: returns False Condition3
• True OR True: returns True will be evaluated as follows:
• True OR False: returns True (Condition1 AND Condition2) OR
• NOT True: returns False Condition3

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

3.3 Arithmetic operators


3.3.1 Overview • "--": Decrementation.
The arithmetic operators are: • "+=": Add a value to the variable or control (numeric
• "+": Addition (numeric value or string). or text).
• "-": Subtraction (numeric value). • "-=": Subtract a value from the variable or control
(numeric).
• "*": Multiplication.
Therefore, this example generates an error during the
• "/": Division. compilation:
• "++": Incrementation (numeric value). n is int = 10
• "--": Decrementation (numeric value). Trace(n+=1)
• "+=": Add a value to the variable or control (numeric
or text). To display the result, perform the following modifications
n is int = 10
• "-=": Subtract a value from the variable or control
n += 1
(numeric).
Trace(n)
3.3.2 Calculation rules Equivalence
The different calculations are performed without loss of • j ++ is equivalent to j = j + 1
precision and without being truncated. The flow checks
• j - - is equivalent to j = j - 1
are performed when the result is assigned to a variable.
• j += 3 is equivalent to j = j + 3
3.3.3 Notes • j - = 3 is equivalent to j = j - 3
Displaying the result We recommend using the following syntax: "j++", "j--",
The result of the calculation cannot be directly displayed "j+=", and "j -=", which are faster than the usual syn-
Part 3: Basic WLanguage syntax

by the following operators: tax.


• "++": Incrementation.

3.4 Binary operators


The operations on the binary values are performed only:
Binary not
• with the WLanguage functions: BinaryAND, BinaryOR,
BinaryNOT, BinaryXOR The syntax is as follows: ~ <Value>
• with specific operators: binary operators, offset to the The type of result depends on the type of the operand:
right or to the left operators, bit access operators.
Operand Result
3.4.1 Binary operators
Binary AND, OR and exclusive OR 4-byte integer 4-byte integer
The following syntaxes can be used: 8-byte integer 8-byte integer
• Binary AND: <Value 1> & <Value 2>
• Binary OR: <Value 1> | <Value 2> Other 8-byte integer
• Exclusive binary OR: <Value 1> || <Value 2>
The type of result depends on the type of the operands: 3.4.2 Shift operators
Value 2 4-byte 8-byte Other Offset to the left:
Value 1 integer integer <Value 1> bitLeftShift <Value 2>
4-byte integer 4-byte 8-byte 4-byte bitLeftShift(<Value 1>, <Value 2>)
integer integer integer Offset to the right:
8-byte integer 8-byte 8-byte 8-byte <Value 1> bitRightShift <Value 2>
integer integer integer bitRightShift(<Value 1>, <Value 2>)
Other 4-byte 8-byte 8-byte
integer integer integer
Tome1_2.book Page 193 Vendredi, 28. mai 2010 5:50 17

193

Notes • 1 to 64 for a 8-byte integer.


• The bits of <Value 1> are shifted from <Value 2> bits to If the value of <n> is incorrect, the operation returns 0.
the right or to the left. Examples:
For example:
// Set the fifth and
bitLeftShift(4,1) // Returns 8 // seventh bits to 1
n is int
Indeed, 4 in decimal corresponds to 0100 in binary.
n[5] = 1
Shifting 1 bit to the left, we get 1000 in binary that cor-
n[7] = True
responds to 8 in decimal.
// Test the value of bits 4, 5, 6, and
Another example :
7
bitRightShift(4,2) // Returns 1 IF n[4] THEN Trace(4) // not displayed
IF n[5] THEN Trace(5) // displays 5
Indeed, 4 in decimal corresponds to 0100 in binary.
IF n[6] THEN Trace(6) // not displayed
Shifting 1 bit to the right, we get 0001 in binary that
IF n[7] THEN Trace(7) // displays 7
corresponds to 1 in decimal.
• The bits that exceed the size of <Value 1> are ignored. Access to a 1-byte, 2-byte or 4-byte integer
For example: Syntaxes:
bitLeftShift(4,30) // Returns 0 <Value 1> [ <n>, wlInt_1 ]
<Value 1> [ <n>, wlInt_2 ]
bitLeftShift(4,4) // Returns 0
<Value 1> [ <n>, wlInt_4 ]
• If <Value 2> is greater than the size of <Value 1> (32 These syntaxes are used to read or modify the value of
for a 4-byte integer and 64 for a 8-byte integer), the the 1-byte, 2-byte or 4-byte integer in the <Value 1>
result is always equal to 0. For example
value.
bitLeftShift(4,35) // Returns 0 Possible values for <n> according to the type of <Value
• The type of result depends on the type of the operand: 1>:

Part 3: Basic WLanguage syntax


Operand Value 1 Result Value 1 wlInt_1 wlInt_2 wlInt_4
4-byte 1 to 4 1 to 2 1
4-byte integer 4-byte integer integer
8-byte integer 8-byte integer 8-byte 1 to 8 1 to 4 1 to 2
integer
Other 8-byte integer If the value of <n> is incorrect, the operation returns 0.

3.4.3 Direct access operator Access to the value of several bits


Bit access Syntaxes:
Syntax: <Value 1> [ <n> ] <Value 1> [ TO <n> ]
This syntax is used to read or modify the value of the <N> <Value 1> [ <n> TO ]
bit in the <Value 1> value. <Value 1> [ <n> TO <o> ]
The counting of the bits starts from 1: <Value 1> [ <n> ON <Number> ]
• 1 to 32 for a 4-byte integer, These syntax are used to read or modify the value corres-
ponding to the specified bits.
Tome1_2.book Page 194 Vendredi, 28. mai 2010 5:50 17

194

3.5 Comparison operators


3.5.1 Overview
The comparison operators can be divided into several "Dupond" = "DUPOND" // returns Flase
categories: "Dupond" ~= "DUPOND" // returns True
" Dupond" ~= "DUPOND" // returns True
Equality Strict equality: =
Flexible equality: ~= " Dupond" ~= "Dupond" // returns True
Very flexible equality: ~~ "Crème brûlée" ~= "Creme brulee"
Starts with: [= // Returns True
"Comp. S.A.R.L" ~~ "Ent SARL"
Comparison Not equal: <>
// Returns True
Less than or equal to: <=
Greater than or equal to: >=
Equality and comparison: Real containing more than 6
Strictly less than: <
Strictly greater than: >
decimal places
Starts with: [= The test of equality between two real numbers is perfor-
med according to the first 6 decimal places. Indeed, the
Interval for Strictly included between:
rounding errors caused by the internal coding of the reals
comparison Value1< x< Value2
Included between: require a specific test.
Value1 < x <= Value2 This test must be run by comparing the difference
Value1 <= x < Value2 between the two values to test and a reference value.
Included between (including bounds): Depending on the type of your application, this value can
Value1 <= x <= Value2 be equal to 0.00001 or even less.
Included between (including bounds):
This rounding management is not specific to WinDev. It is
Value1 TO Value2
common to all the programming languages that handle
The comparison operators can be used with all the types reals in binary format.
Part 3: Basic WLanguage syntax

of operands. Diff, R1, R2 are real


The result of a comparison expression is a boolean. Diff = 0.00001
IF Abs(1-(R1/R2)) < Diff THEN
3.5.2 Detail // R1 and R2 are equal
Flexible equality and very flexible equality ELSE
The flexible equality (~=) and the very flexible equality // R1 and R2 are different
(~~) only apply to the character strings (except for the END
fixed strings). These operators enable you to: Comparison intervals
• make no difference between the uppercase characters The comparison intervals are used to simplify the syntax
and the lowercase characters, of complex comparisons. Therefore, the line
• ignore the space characters found before and after the IF x>5 and x<10 THEN …
string whose test must be run, can be replaced by
• ignore the lowercase accented characters, IF 5<x<10 THEN…
• ignore the space characters and the punctuation cha- The line :
racters inside the strings (very flexible equality only) IF x>5 AND x<10 THEN …
HyperFileSQL equivalence: to get equivalent behavior to can be replaced by
the very flexible equality when performing a search on a IF X=5 TO 10 THEN…
text key in a HyperFileSQL file, you must configure the fol-
lowing options when describing the item in the analysis: Example:
MyArray is array of 5 strings
I is int
MyArray[1] = "Dupond"
MyArray[2] = "Aida"
MyArray[3] = "Parapoline"
MyArray[4] = "Moulin"
MyArray[5] = "Foolamour"
Tome1_2.book Page 195 Vendredi, 28. mai 2010 5:50 17

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.

3.6 Operators on character strings


The character strings can be handled by specific WLan- HyperFileSQL equivalence: to get equivalent behavior to
guage functions or by the +, [[ and ]] operators. the very flexible equality when performing a search on a
The operators on character strings are as follows: text key in a HyperFileSQL file, you must configure the fol-
• "+": To concatenate strings. lowing options when describing the item in the analysis:
• "[[" and "]]" (double opening square brackets and
double closing square brackets): Sub-string extraction
operator.

Part 3: Basic WLanguage syntax


• "=": Strict equality
• "~=": Flexible equality (not available in WebDev brow-
ser code) 3.6.2 The [[ and ]] operator
• "[=": Start with The [[ and ]] operator is used to extract and to replace a
sub-string.
Text = "Programming Guide"
Text[[13]] // returns "G"
Some examples:
Text[[13 to 16]] // Returns "Guid" • STRINGTOEXTRACT[[<Position>]]:
Text[[13 to]] // Returns "Guide" Extracts a character from a
Text[[to 13]] // Returns "Programming string based on its position.
G" • EXTRACTSTRING[[<Position>]] =
Text[[13 on 3]] // Returns "Gui" <New string>: Replaces the cha-
"WinDev" + Text racter in the string with a new
// Returns "WinDev Programming string.
// Guide" • STRINGTOEXTRACT[[<Start> to
If Text [="Guide" Then Trace(Text) <End>]]: Extracts a character
string from a string according to
3.6.1 Flexible equality and very flexible equa- its Start and End positions.
lity • STRINGTOEXTRACT[[<Start> to]]:
The flexible equality (~=) and the very flexible equality Extracts a character string from
(~~) only apply to the character strings (except for the <Start> to the end of the string.
fixed strings). These operators enable you to: • STRINGTOEXTRACT[[to <End>]]:
• make no difference between the uppercase characters Extracts a character string from
and the lowercase characters, the beginning of the string to
• ignore the space characters found before and after the <End>.
string whose test must be run, • STRINGTOEXTRACT[[<Start> on <Num-
• ignore the lowercase accented characters, ber>]]: Extracts a set number of cha-
• ignore the space characters and the punctuation cha- racters based on the start position
racters inside the strings (very flexible equality only) and the specified number of charac-
ters.
Tome1_2.book Page 196 Vendredi, 28. mai 2010 5:50 17

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

3.7 Operator on address


The & operator returns the address of a variable as an addr = &t[5] //address of the 5th
integer. element
i is int addr = &s //address of the struc-
z is ASCIIZ string on 50 ture
t is array of 10 real //and therefore of s.age
s is composed of addr = &s.age
Age is int addr = &s.name
Name is ASCIIZ string on 50
Syntax
END
addr is int <Result> = &<Variable Name>
addr = &i Notes
addr = &z • The & operator enables you to get the address of any
addr = &z + 2 //address of the 3rd form of variable (simple of composite).
one
//character of String
• The & operator is mostly used to pass addresses to
addr = &t //address of the start of
CallDLL32.
the • The & operator does not return the address:
//array (therefore of the 1st •of a control
element) •of a HyperFileSQL item
Tome1_2.book Page 197 Vendredi, 28. mai 2010 5:50 17

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.

3.8 Indirection operators


The { and } operators enable you to access a control, a Indirection with a class
variable or a file item by dynamically building the name of // Declare a class with
the control, variable or file item. // two members
The benefits of the { and } operators are as follows: MyClass is class
• pass a control name or item name as parameter Member1 is string
Member2 is string
• build the name of a control or item by programming
END
Simple indirection //Display the value of a member
{"NAME"} = CustName PROCEDURE GLOBAL DisplayMember(…
// is equivalent to NAME=CustName Number)
{"NAME"} = {"CU.CUSTNAMEI"} // Retrieve the value of the
// is equivalent to NAME=CU.CUST- // chosen global member
NAME Value is string = …
{"WINCUST.NAME"} = CustName {"::Member"+Number}
//is equivalent to WINCUST.NAME=Cus- Info(Value)

Part 3: Basic WLanguage syntax


tName
Syntax
{"WINCUST"+".NAME"} = CustName
//is equivalent to WINCUST.NAME=Cus- Simple indirection
{<Expression>}
tName
Indirection in a procedure <Expression>: is used to identify the control, variable or
item to handle. A WLanguage error occurs if this expres-
ControlName is string
sion corresponds to an empty string ("").
ControlName = "EDIT1"
//EDIT1 is the name of the control Indirection on a class member
//call to a procedure used to make {<Expression>}
// a control invisible <Expression>: is used to identify the member of the
INVISIBLE(ControlName) class. If the member is:
PROCEDURE INVISIBLE(NControl) • global, use the following syntax: {"::MemberName"}
{NControl} .. Visible = False not global, use the following syntax: {":MemberName"}

A WLanguage error occurs if this expression corresponds


Indirection with a variable
to an empty string ("").
AliasName is string
AliasName = PreviousWin() Indirection by specifying the type of the element (optimi-
//NAME is the name of the control zes the execution speed)
//CustName is the value to assign {<Expression>, <Type>}
{AliasName+".NAME"} = CustName <Expression>: is used to identify the control, variable or
Abbrev is string item to handle. A WLanguage error occurs if this expres-
ItemName is string sion corresponds to an empty string ("").
{Abbrev+"."+ItemName} = CustName
{Abbrev+"."+ItemName} = {ControlName}
Tome1_2.book Page 198 Vendredi, 28. mai 2010 5:50 17

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

3.9 Miscellaneous operators


Part 3: Basic WLanguage syntax

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

Part 3: Basic WLanguage syntax


(FamilyCode="MO") THEN
Process IF Position(MyString, "W")<>0 THEN
END Info("Found") //Displays the result
Caption = "Enter the "+ … END
"customer name."
Tome1_2.book Page 200 Vendredi, 28. mai 2010 5:50 17

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

Important: The label and the GOTO statement must be Syntax


defined in the same process. FOR <Control Variable> = <Initial Value> TO
Res = fOpen(FileName, FOWrite <Final Value> [STEP <x>]
IF Res = -1 THEN GOTO OPENERR …
Res = fWrite(Res,"Processing OK") END
IF Res = -1 THEN GOTO WRITEERR
… Code to run
RESULT True The code to run is located between the FOR and END sta-
ERROPEN : tements.
Info("File "+FileName+…
" cannot be opened. "+…
Increment step
"Check its existence.") The increment step of the FOR statement must be cons-
RESULT False tant. A warning is displayed during the project compila-
tion if the increment step is likely to change at each
ERRWRITE : iteration.
Info("Unable to write into"+… Exiting from a FOR loop
" the "+FileName + "file")
RESULT False
Several statements are available:
• RETURN: Exits from the FOR loop and exits from the
Syntax current process (or procedure).
… • RESULT: Returns a status code to the calling process.
GOTO <Label Name> Exits from the FOR loop and exits from the current pro-
… cess (or procedure).
<Label Name>:
• BREAK: Exits the FOR loop and resumes the current
<Code of the label> process.
Code of the label

Part 3: Basic WLanguage syntax


Close lets you exit the FOR loop and close the current
Once the code of the label has been run, the program window.
runs the code lines that directly follow the label. Caution: RETURN and RESULT cannot be used in the
Limits of labels same process.
Several labels with the same name cannot be used in the Running the next iteration
same process (or procedure). To directly run the next iteration without ending the code
A warning is displayed during the compilation of the pro- of the current iteration, use the Continue statement:
ject if a label is used by no GOTO statement. FOR <Control Variable> = <Initial
Value> TO <End Value> [STEP <x>]
Label and FOR and FOR EACH statements

The GOTO statement does not let you access a FOR or IF <Condition> THEN CONTINUE
FOR EACH statement block directly. // Return to the FOR keyword
This is why the following code triggers a compilation error: …
FOR Subscript = 1 TO 10 END
RestartLabel: Res ++
END In this case, the control variable is automatically incre-
GOTO RestartLabel mented.

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

•browse with filter,


Note: the search key is automatically set by the HyperFi-
•browse with filter based on a specified key, leSQL engine.
•browse with filter on the search key.
Browse with filter based on a specified key
Note: Both the FOR EACH and FOR ALL statements are FOR EACH <File> WHERE "<1st Condition>
accepted. In this documentation, we will be using the [AND/OR/NOT <2nd Condition>
FOR EACH statement but it can be replaced by FOR ALL. [AND/OR/NOT…<Nth Condition>]]" [<Direc-
Syntax tion>]
ON <Key Item>
Full Browse
FOR EACH <File> [<Direction>] …
… END
END FOR EACH Customer WITH …
"CustomerCity = "+…
FOR EACH Customer
"’Boston’" ON CustomerNum
// Add the customers to the list
// Add the customers to the list
ListAdd(CustomerList,…
ListAdd(CustomerList,…
Customer.CustomerNum)
Customer.CustomerNum)
END
END
Note: the search key is automatically set by the HyperFi- City = "London"
leSQL engine. FOR EACH Customer WITH …
"CustomerCity = "+…
Full browse based on a specified key
"’"+City+"’ and CustomerAge >= 21"…
FOR EACH <File> ON <Search item> [<Direction>]
ONCustomerNum

// Add the customers to the list
END
ListAdd(CustomerList, …
FOR EACH Customer ON CustomerNum Customer.CustomerNum)
Part 3: Basic WLanguage syntax

// Add the customers to the list END


ListAdd(CustomerList,…
Customer.CustomerNum) Browse with selection on the search key
END
1. Comparison filter according to a value
FOR EACH <File> WITH …
Browse with filter
FOR EACH <File> WHERE "<1st Condition> <Key Item> [=][<=][>=] <Value> [<Direc-
[AND/OR/NOT <2nd Condition> tion>]
[AND/OR/NOT…<Nth Condition>]]" [<Direc- …
tion>] END
… 2. Comparison filter according to an interval of values
END
FOR EACH <File> WITH <Key Item> = …
FOR EACH Customer WITH … <Minimum Value> TO <Maximum Value> [<Direc-
"CustomerCity = ’Dallas’" tion>]
ListAdd(CustomerList,… …
Customer.CustomerNum) END
END
City = "London" or
FOR EACH Customer WITH … FOR EACH <File> WITH …
"CustomerCity = ’"+City+… <Minimum Value> <= <Key Item> <= …
"’ and CustomerAge > = <Max Value> [<Direction>]
21" …
// Add the customers to the list END
ListAdd(CustomerList,…
Customer.CustomerNum)
END
Tome1_2.book Page 203 Vendredi, 28. mai 2010 5:50 17

203

For example:
// Comparing to a "CustomerName > ’Smith’ and …
// value ZipCode = 34101 or CustomerAge >=
FOR EACH Customer WITH … 32"
CustomerName = "Smith&quot
// 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 &gt Greater than Valid for all the types
// value
FOR EACH Order WITH … &gt= Greater than or Valid for all the types
OrderDate <= "12/31/2003" equal to
// Add the orders to the list &lt Less than Valid for all the types
ListAdd(OrderList, …
ORDERS.OrderNumber)
&lt= 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)

Part 3: Basic WLanguage syntax


END
Notes:
// Comparing to an • The constant strings must be enclosed in simple
// interval of values quotes. For instance: "CustomerName = ’"+Custo-
FOR EACH Order WITH … mer+"’"
"01/01/2003" … • <Item Name> must only contain letters, digits and
<= OrderDate <= "12/31/2003" underscore characters ("_"). If <Item Name> contains
// Add the orders to the list other characters (quote, …), the name of the item must
ListAdd(OrderList, … be enclosed in double quotes. For example:
ORDERS.OrderNumber) "e_mail@"]’fr’
END • The comparisons between strings are performed accor-
Browse with "Start with" generic search ding to the ASCII value of the characters and not accor-
FOR EACH <File> WHERE <Key Item> [= … ding to the lexicographic value (’a’ > ’Z’).
<Start of sought value> [<Direction>] • The binary memos and the composite keys cannot be
… part of an <Item Value>.
END • If <Item Value> contains a simple quote (or a double
FOR EACH Customer WITH … quote), this simple quote (or double quote) must be
CustomerName [="From" preceded by a backslash character.
// Add the customers to the list Exiting from FOR EACH loop
ListAdd(CustomerList,…
Customer.CustomerNum)
Several statements are available:
END • RETURN: Exits from the FOR EACH loop and exits from
the current process (or procedure).
Code to run • RESULT: Returns a status code to the calling process.
The code to run is located between the FOR EACH and Exits from the FOR EACH loop and exits from the cur-
END statements. rent process (or procedure).
• BREAK: Exits the FOR EACH loop and resumes the cur-
Filter (syntaxes 2)
rent process.
The general syntax of a filter has the following format:
"<Item Name> <Operators> <Item Value>" Close lets you exit the FOR EACH loop and close the cur-
rent window.
Tome1_2.book Page 204 Vendredi, 28. mai 2010 5:50 17

204

Caution: RETURN and RESULT cannot be used in the


same process. // Retrieves the list of libraries
// loaded in memory
Behavior of the automatic file browse according to the LibraryList is string
mode used to exit from the loop LibraryList = ListDLL()
The automatic file browsing behaves differently depen- ALibrary is string
ding on whether it ends automatically or if the exit is trig- // For each library
gered by a BREAK, RETURN or Close command, … FOR EACH STR\xeb NE ALibrary …
OF LibraryList SEPARATED BY CR
If the browse operation ends automatically: // Add the library to the
•the position of the file before the browse operation is // Library_Table table
restored. TableAddLine(Library_Table,…
•the possible filter required for the browse is disabled. ExtractString(ALibrary, 1, TAB))
END
If the browse operation is stopped (BREAK, RETURN,
RESULT, Close and so on statements): This syntax will read all the substrings of the <Initial
•the position of the file before the browse operation is String>. The parsing is not performed if <Initial String> is
not restored. an empty string.
•the possible filter required for the browse is not disa- For each iteration, the <Substring> variable is assigned
bled. It must be disabled manually (HDeactivateFil- with the current substring.
ter. The behavior is undefined if the initial string or the sepa-
Running the next iteration rator is modified during the browse.
To directly run the next iteration without ending the code Note: If the <Initial String> ends with the separator,
of the current iteration, use the Continue statement: <Substring> returns a string empty at the end. Otherwise,
FOR EACH <File> ON <Key Item>
<Substring> corresponds to the last checked-out ele-
ment.
Part 3: Basic WLanguage syntax


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

This syntax will parse all the positions of the <Search>


substring in <Initial String>. // For each user listed
For each iteration, the <Position> variable is assigned // in the UserList list
with the position of the current substring. FOR EACH ROW OF </STRONG> UserList
// Send an email
The behavior is undefined if the initial string or the sought SendMessage(ColName, ColEmail)
string is modified during the browse. END
2. With option This syntax is used to browse through all the rows found
FOR EACH POSITION <Position> OF <Sought>… in a list box, table or looper.
IN <Initial String> WITH <Options>
For each row browsed:

• <Control Name> returns the subscript of the current
row.
END
• <Control Name>[<Control Name>] returns all the colu-
This syntax parses all the positions of the <Search> subs- mns separated by TAB characters.
tring in <Initial String>. • <Column Name> returns the value of the column for
For each iteration, the <Position> variable is assigned the row currently browsed.
with the position of the current substring. The browse operation has no effect on the current selec-
The behavior is undefined if the initial string or the sought tion.
string is modified during the parsing. The behavior is undefined if the number of control ele-
Code to run ments is modified during the browse.
The code to run is located between the FOR EACH and Note: the table’s rows are locked while browsing through
END statements. them. The MultitaskRedraw function is ignored.
Browsing through the selected elements in a control
Parsing Unicode strings FOR EACH SELECTED ROW OF <Control>

Part 3: Basic WLanguage syntax


<Substring>, <Initial String>, <Separator> and …
<Search> can correspond to: END
• ANSI strings.
• UNICODE strings. // For each user
However, ANSI strings and UNICODE strings cannot be // selected in the
used in the same syntax. // UserTable table
FOR EACH SELECTED ROW OF …
4.1.6 FOR EACH/FOR ALL statement, parsing UserTable
controls // Send an email
SendMessage(ColName, ColEmail)
WD, WB s, The FOR EACH/FOR ALL command END
WDMobile can only be used in WinDev, in Web- This syntax is used to browse all the selected rows found
Dev server code and in WinDev
Mobile. in a list box, table or looper.
For each row browsed:
FOR EACH is used to perform different types of parsing • <Control Name> returns the subscript of the current
on controls (list boxes, tables, loopers): row.
•Parsing the control elements. • Note: the table’s rows are locked while browsing
•Parsing the values of the selected elements. through them.
•Parsing the subscripts of the selected elements. • <Column Name> returns the value of the column for
the row currently browsed.
Note: Both the FOR EACH and FOR ALL statements are The browse operation has no effect on the current selec-
accepted. In this documentation, we will be using the tion.
FOR EACH statement but it can be replaced by FOR ALL.
The behavior is undefined if the number of control ele-
Syntax ments is modified during the browse.
Browsing through a control’s elements Browsing the subscripts of the selected elements
FOR EACH ROW OF <Control> FOR EACH SELECTED ROW <Subscript> …
… OF <Control>
END …
END
Tome1_2.book Page 206 Vendredi, 28. mai 2010 5:50 17

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

4.1.8 FOR EACH/FOR ALL statement, browsing


Browsing through the elements of an array according to
associative arrays the index key
FOR EACH ELEMENT <Variable>, <KeyVariable> OF
WD, WB s, The FOR EACH/FOR ALL command
<Array> [<Direction>]
WDMobile can only be used in WinDev, in Web-
Dev server code and in WinDev …
Mobile. END

For each iteration:


<b>FOR EACH</b> is used to perform different types of
browse operations on the associative arrays: • <Variable> directly refers to the current element in the
array. If the value of <Variable> is modified, the current
•Browsing through the elements of the associative element in the array is modified.
array.
• <KeyVariable> contains the value of the element key.
•Browsing trhough the values of the elements found in This value is read-only and it cannot be modified.
the associative array.
When exiting from the loop (standard exit or via the EXIT
•Browsing through the "key" elements of the associa- statement), the value of the last element read is assi-
tive array. gned to <Variable> but <Variable> does not directly refer
Note: Both the FOR EACH and FOR ALL statements are to the array element anymore.
accepted. In this documentation, we will be using the
FOR EACH statement but it can be replaced by FOR ALL. Browsing through the <key> elements of the array
FOR EACH ELEMENT <Variable> OF <Array> = <Key>
Syntax
[<Direction>]
Browsing through the elements of an array …
FOR EACH ELEMENT <Variable> OF …
END
<Array> [<Direction>]
… This syntax browses through all the array elements with

Part 3: Basic WLanguage syntax


END the specified <Key> value. For each iteration, <Variable>
directly refers to the current element in the array. If the
// Declare an value of <Variable> is modified, the current element in
// associative array of integers the array is modified.
// Array indexed on strings This syntax is useful when browsing associative arrays
// and without duplicates with duplicates. In an associative array without duplica-
aaIDPerCust is array … tes, the number of elements browsed can be 0 or 1. In an
associative of int associative array with duplicates, the number of ele-
aaIDPerCust["A"] = 55 ments browsed can be 0 or N.
// Add the ID of customer "A" The array elements are browsed in the order they were
aaIDPerCust["B"] = 321 added (no direction option).
// Add the ID of customer "B" When exiting from the loop (standard exit or via the EXIT
aaIDPerCust["A"] = 56 statement), the value of the last element read is assi-
// modify the ID of customer "A" gned to <Variable> but <Variable> does not directly refer
nIdentifier is int to the array element anymore.
// browse all the identifiers
// 56 Browsing the values of the array’s key elements accor-
// 321 ding to the index key
FOR EACH ELEMENT nIdentifier OF … FOR EACH ELEMENT <Variable> <KeyVariable> OF
aaIDPerCustomer <Array> = <Key> [<Direction>]
Trace(nIdentifier) …
END END
This syntax browses through all the array elements with
the specified <Key> value.
For each iteration, <Variable> directly refers to the cur-
rent element in the array. If the value of <Variable> is For each iteration:
modified, the current element in the array is modified. • <Variable> directly refers to the current element in the
When exiting from the loop (standard exit or via the EXIT array. If the value of <Variable> is modified, the current
statement), the value of the last element read is assi- element in the array is modified.
gned to <Variable> but <Variable> does not directly refer • <KeyVariable> contains the value of the element key.
to the array element anymore. This value is read-only and it cannot be modified.
Tome1_2.book Page 208 Vendredi, 28. mai 2010 5:50 17

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

Part 3: Basic WLanguage syntax


Note: In this case, as soon as an expression is False, WHILE <Condition>
none of the following expressions are evaluated. <Action if condition is True>
END
Composite condition
The AND and OR keywords are used to perform logical Code to run
operations and to build composite conditions. The code to run is located between the WHILE and END
IF Customer.City = "Boston" AND … statements.
Customer.Title = "Mr" THEN Exiting from a WHILE loop
ManBoston ++
// Number of men living
Several statements are available:
// in Boston • RETURN: Exits from the WHILE loop and exits from the
END current process (or procedure).
IF Customer.City = "Boston" OR • RESULT: Returns a status code to the calling process.
Customer.City = "Miami" THEN Exit from the WHILE loop and exist from the current pro-
BostonMiami++ cess (or procedure).
// Number of customers living • BREAK: Exits the WHILE loop and resumes the current
either process.
// Boston, or in Chicago
The Close function lets you exit the WHILE loop and close
END
the current window.
The conditions made of AND and OR are entirely evalua- Caution: RETURN and RESULT cannot be used in the
ted. For example: same process.
A > 10 AND B < 20
Loop without end
Even if the first condition (A > 10) is false, the second During the project’s compilation, a WHILE loop without
condition (B < 20) will still be checked. an obvious end (loop without BREAK, RETURN or RESULT
statement) is signaled by a warning.
To optimize the evaluation of composed conditions, use
the _AND_ and _OR_ keywords. This way, if the first con-
Tome1_2.book Page 210 Vendredi, 28. mai 2010 5:50 17

210

Running the next iteration For example:


To directly run the next iteration without ending the code WHILE Price < 100 AND …
of the current iteration, use the Continue statement: ProductType = "AA&quot
WHILE <Condition> NumProduct ++
… // Number of products whose price
IF <Condition> THEN CONTINUE // is less than
// Return to the WHILE keyword // 100 and whose type is "AA"
… END WHILE Price < 100 OR Price > 500
END NumProduct ++
// Number of products whose price
Composite condition // is found between 100 and 500 €
The AND and OR keywords are used to perform logical END
operations and to build composite conditions.
The conditions made of AND and OR are entirely evalua-
ted. For example:
A > 10 AND B < 20
Even if the first condition (A > 10) is false, the second
condition (B < 20) will still be checked.
To optimize the evaluation of composed conditions, use
the _AND_ and _OR_ keywords. This way, if the first con-
dition (A > 10) is False, the second condition (B < 20) will
not be evaluated.

4.2 Simple statements


Part 3: Basic WLanguage syntax

Here are the various simple statements: …


• CONTINUE: Goes directly to the beginning of the next IF <Condition> THEN CONTINUE
iteration without ending the code of the current itera- …
tion END
• RESULT: Exits the current process (or procedure) and If <Condition> is True:
returns a status code
• The code following the CONTINUE statement is not run.
• RETURN: Exits the statement block and exits the cur-
rent process (or procedure) • The loop is run from the beginning of the FOR state-
ment.
• BREAK: Exits the statement block and resumes the cur-
rent process • The <Control Variable> is incremented.

4.2.1 CONTINUE statement FOR EACH statement


The CONTINUE statement is used to directly go to the FOR EACH <File> ON <Key Item>
beginning of the next iteration without finishing the code …
of the current iteration. The CONTINUE statement can be IF <Condition> THEN CONTINUE
used in the following types of loops: …
•FOR. END
•FOR EACH. If <Condition> is True:
•LOOP. • The code following the CONTINUE statement is not run.
•WHILE. • The loop is run from the beginning of the FOR EACH sta-
tement.
Syntax • The move to the next record is automatically perfor-
FOR statement med.
FOR <Control Variable> = <Initial Value> TO
<Final Value> [STEP <x>]
Tome1_2.book Page 211 Vendredi, 28. mai 2010 5:50 17

211

LOOP statement IF <Condition> THEN RETURN


LOOP …
… END
IF <Condition> THEN CONTINUE
… WHILE statement
WHILE <Condition 1>
END

If <Condition> is True : IF <Condition> THEN RETURN
• The code following the CONTINUE statement is not run. …
• The loop is run from the beginning of the LOOP state- END
ment. The following operations are performed if <Condition> is
WHILE statement True:
WHILE <Condition 1> • Exit from the statement block.
… • Exit from the current process (or procedure).
IF <Condition 2> THEN CONTINUE
… Other statements used to exit from a loop or from a pro-
END cedure
Several statements are available:
If <Condition 2> is True: • RESULT: Returns a status code to the calling process.
• The code following the CONTINUE statement is not run. Exit from the loop and exit from the current process (or
• The loop is run from the beginning of the WHILE state- procedure).
ment. • BREAK: Exits the loop and resumes the current process
(or procedure).
4.2.2 RETURN statement The Close function lets you exit the loop (or procedure)
The RETURN statement is used to exit a statement block and close the current window.

Part 3: Basic WLanguage syntax


and to exit the current process (or procedure). Caution: RETURN and RESULT cannot be used in the
The RETURN statement can be used in: same process.
• a procedure.
• a FOR type loop. 4.2.3 RESULT statement
• a FOR EACH type loop. The RESULT statement is used to exit the current process
(or procedure) and return a status code.
• a LOOP type loop.
The RESULT statement can be used in:
• a WHILE type loop.
• a procedure.
Syntax • a FOR type loop.
Procedure • a FOR EACH type loop.
Procedure <Procedure Name> ([<Parameter>])
• a LOOP type loop.
IF <Condition> THEN RETURN
… • a WHILE type loop.
END Syntax
FOR statement Procedure
FOR <Control Variable> = <Initial Value> TO Procedure <Procedure Name> ([<Parameter>])
<Final Value> [STEP <x>] IF <Condition> THEN
IF <Condition> THEN RETURN RESULT <Value to return>
END ELSE
RESULT <Value to return>
FOR EACH statement END
FOR EACH <File> ON <Key Item>
IF <Condition> THEN RETURN FOR statement
END FOR <Control Variable> = <Initial Value> TO
<Final Value> [STEP <x>]
LOOP statement IF <Condition> THEN RESULT <Value>
LOOP
END

Tome1_2.book Page 212 Vendredi, 28. mai 2010 5:50 17

212

FOR EACH statement Syntax


FOR EACH <File> ON <Key Item> FOR statement
… FOR <Control Variable> = <Initial Value> TO
IF <Condition> THEN RESULT <Value> <Final Value> [STEP <x>]
END …
IF <Condition> THEN BREAK
LOOP statement

LOOP
END

<Rest of the process>
IF <Condition> THEN RESULT <Value to Return>

END FOR EACH statement
FOR EACH <File> ON <Key Item>
WHILE statement …
WHILE <Condition 1> IF <Condition> THEN BREAK
… …
IF <Condition> THEN RESULT <Value> END
… <Rest of the process>
END
LOOP statement
The following operations are performed if <Condition> is LOOP
True : …
• Return a status report to the calling process. IF <Condition> THEN BREAK

• Exit from the statement block.
END
• Exit from the current process (or procedure). <Rest of the process>
Other statements used to exit from a loop or from a pro-
Part 3: Basic WLanguage syntax

cedure WHILE statement


WHILE <Condition>
Several statements are available: …
• RETURN: Exit from the loop and exit from the current IF <Condition> THEN BREAK
process (or procedure). …
• BREAK: Exits the loop and resumes the current process END
(or procedure). <Rest of the process>
The Close function lets you exit the loop (or procedure) The following operations are performed if <Condition> is
and close de current window or page. True:
Caution: RETURN and RESULT cannot be used in the • Exit from the statement block.
same process.
• Runs the rest of the current process.
4.2.4 BREAK statement Other statements used to exit from a loop
The BREAK statement is used to exit from a statement Several statements are available:
block and to run the rest of the current process. • RETURN: Exit from the loop and exit from the current
The BREAK statement can be used in the following types process (or procedure).
of loops: • RESULT: Returns a status code to the calling process.
• FOR. Exit from the loop and exit from the current process (or
• FOR EACH. procedure).
• LOOP. The Close function lets you exit the loop and close de cur-
• WHILE. rent window.
Note: The BREAK statement cannot be used to exit a pro- Caution: RETURN and RESULT cannot be used in the
cedure. Use the RETURN or RESULT keywords. same process.
Tome1_2.book Page 213 Vendredi, 28. mai 2010 5:50 17

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:

Part 3: Basic WLanguage syntax


• declare an external object (see use 2). • WinConst.wl: Windows standard constants.
Use 1: including a text file in an application/site • Limits.wl: Constants corresponding to the limits of the
WinDev/WebDev data types.
Including a text file with EXTERN has the same effect than
copying a text file in the code editor. • ListeDefinitionHF.wl: HyperFileSQL constants used for
log operations.
// include the file named
// "WinConst.wl" • Except.wl: Constants used for managing exceptions
// Standard constants of Windows • KeyConst.wl: Windows standard constants used for
EXTERN "WinConst.wl" keyboard keys.
These constants can be used by KeyPressed, in the
Syntax "Key Down" or "Key Up" optional processes with the
EXTERN <File Name> _EVE.wParam variable.
The file name corresponds to the name of the text file Use 2: declaring an external object
containing some WLanguage code to include in the appli- EXTERN is used to declare a variable that will exist only
cation/site. This is a standard text file, created by any text when the application/site is run.
editor.
For instance, EXTERN can be used to handle a window/
A full path can be specified ("C:\WDPro- page found in an external library (loaded by LoadWDL).
ject\MyConst.wl" for instance). If the path is not speci- EXTERN MyWindow
fied, the file will be sought: LoadWDL("User1.WDL")
• in the directory of the project. Open(MyWindow)
• in the "Personal\Extern" directory of WinDev/Web-
Dev.
Tome1_2.book Page 214 Vendredi, 28. mai 2010 5:50 17

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

Handling the current window dow to which the procedure belongs.


MyWindow is always replaced by the current window. For WLanguage functions and current window
example: To specify the current window in the WLanguage func-
tions that accept a window name in parameter, use:
• an empty string.
• MyWindow directly.

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

WLanguage functions and current page


To specify the current page in the WLanguage functions
that accept a page name in parameter, use:
• an empty string.
• MyPage directly.

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

Part 3: Basic WLanguage syntax


with:
• a report.
• a browsing table.

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&quot: 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

Part 3: Basic WLanguage syntax


Handling the current report report to which the procedure belongs.
MyReport is always replaced by the current report. For

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

// Code of the selection button


MyFile=fSelect(… Handling the current supercontrol
fExtractPath(… MyParent is always replaced by the current supercontrol.
FileName, fDirectory, … For instance, passing a parameter:
fExtractPtah(FileName, …
CallProcedure(MyParent)
fFileName+fExtension), …
"Select a file", … MyParent can only be used in the processes associated
"All files (*.*)"+TAB+… with the current supercontrol (for instance: processes
"*.*", "") associated with a control found in the supercontrol or
// The value of the supercontrol cor- procedures associated with the supercontrol, etc.).
responds Using MyParent in a procedure
// to the selected file
MyParent can be used in a procedure associated with the
MyParent..Value = FileName
current supercontrol. MyParent refers to the current
Syntax supercontrol then.
MyParent

5.11 STOP (calling the debugger)


STOP IF <Condition>
WD, WB s, The STOP keyword can only be used
WDMobile in WinDev, in WebDev server code Start mode of the debugger
and in WinDev Mobile. To start the debugger during a test, you can use:
• STOP in the code editor.
The STOP keyword is used to call the WLanguage debug- • a breakpoint in the code editor ("Edit .. Breakpoint" or
ger when running a test in the editor (see ’Running the [Ctrl] [B] shortcut, mouse click inside the margin).
Part 3: Basic WLanguage syntax

test of an application or site’, page 97, for more details).


• the [Ctrl][Break] key combination when running the
Once this keyword has been called, the current test is run test (except in WebDev).
in the debugger.
// Open window Tracing and debugging a project
Open(InputWindow) To trace a project from the beginning of its execution,
STOP // Start the debugger select "Project .. Test mode .. Trace the project" (or
[Alt][F9]).
Syntax
Starting the debugger Executable
STOP The STOP keyword has no action in the code of an execu-
table.
Starting the debugger with condition
Tome1_2.book Page 219 Vendredi, 28. mai 2010 5:50 17

219

6. PROCEDURE AND FUNCTION


6.1 Overview
A procedure is used to associate an identifier to a block function, may (or may not) return a result.
of statements. Then, the procedure can be called in a The procedures and the functions can have a fixed or
process. variable number of parameters.
A function is used to define a sub-program that performs The declaration syntax is the same for the procedures
several instructions before returning a value to the calling and for the functions. See ’Declaring a procedure/func-
program. tion’, page 234 for more details.
Difference between a procedure and a function: The calling syntax is the same for the procedures and for
• a procedure returns no result. the functions. See ’Calling a procedure/function’, page
235, for more details.
• a function returns a result.
A procedure (or a function) can be global or local. See
In WLanguage, there is no distinction between the proce- the next paragraph for more details.
dures and the functions. The procedures and the func-
tions are managed in the same way. A procedure, like a

6.2 Global and local procedure/function


6.2.1 Definition it is better to declare this procedure as local to the win-

Part 3: Basic WLanguage syntax


Two types of procedures are available: dow/page. The window/page is then "independent".
• Global procedure: can be used in all the processes of Global server and browser procedures
the project. This global procedure is stored in the pro- In WebDev, a project corresponding to a dynamic site
ject. contains at least two sets of procedures (a "server" one
• Local procedure: can be used in all the processes rela- and a "browser" one).
ted to the object (window, page or report) where the During the project creation:
procedure was declared. This local procedure is stored • the set of server procedures is named "Global proce-
in the object. dures of <Project Name>" (".WDG" file)
Important: Do not declare two procedures with the same • the set of browser procedures is named "Global proce-
name (especially a global procedure and a local proce- dures of <Project Name>_Browser" by default
dure). (".WDWN" file)
Reminder: WLanguage does not differentiate between Note: a set of global browser procedures is converted
procedures and functions. The syntaxes for declaring and into a JavaScript set of procedures. This set of Javascript
using the procedures also apply to the functions. procedures is saved in the "<Project Name>_WEB"
directory and it is named "<Project Name>.JS".
6.2.2 Global procedure Limit: the global server procedures cannot call global
Global procedures and sets of procedu- browser procedures and vice versa.
res Create a global procedure
The global procedures are stored in sets of procedures, Several methods can be used to create the global proce-
associated with the project. dures:
The global procedures declared in the project initializa- • From the code editor:
tion process can be called from any process: - using "Insert .. New global procedure" ([Shift] [F4]
• of the project. keyboard shortcut) option,
- in the popup menu (right mouse click), "Create a pro-
• of the windows/pages (processes of the window/page, cedure .. Create an empty global procedure".
of its controls and associated local procedures). Note: if you want to change a section of code already
• of the reports (processes of the report, its associated entered in an global procedure into its own global
controls and associated local procedures). procedure, simply select the corresponding code and
Advice: If a procedure is used by only one window/page, use "Create a procedure .. Create a global procedure
Tome1_2.book Page 220 Vendredi, 28. mai 2010 5:50 17

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

•using "Insert .. New local procedure" (keyboard


test] button). shortcut [F4]),
•Check the return value. •in the popup menu (right mouse click), "Create a
• From the "code" pane, "global procedures" option: procedure .. Create an empty local procedure" .
1. Select the name of the global procedure whose Note: if you want to change an already entered
test must be run. piece of code into a local procedure, simply select
2. Select "Run the procedure test" from the popup the corresponding code and use "Create a proce-
menu. dure .. Create a procedure containing the selected
3. The description window of the test of the proce- code" from the popup menu. You can now specify
dure is displayed. This window is used to: the name of the procedure. The procedure is crea-
•Enter the different parameters of the procedure. ted, the corresponding code is replaced by the call
to the procedure with the necessary parameters.
•Run the test of the procedure ([Run the procedure
test] button). • from the "Code" pane, "Local procedures" option:
open the popup menu (right mouse click) and select
•Check the return value.
"New local procedure".
6.2.3 Local procedure Note: you can display the list of local procedures by
selecting "Display .. Local procedures" ([F8] keyboard
Procedures local to a window /page shortcut) in the code editor.
The local procedures declared in a window/page can be WebDev browser: you can display the list of local browser
called from all the processes: procedure by selecting "Display .. Local browser proce-
• of the window/page. dures" ([Alt] [F8] keyboard shortcut) in the code editor.

6.3 Set of procedures


6.3.1 Definition
A set of procedures is used to:
The global procedures are grouped in sets of procedures. • share global procedures among several developers, for
Each set of procedures is a ".WDG" file. the same project.
Each project contains at least one set of procedures. This • share global procedures among several projects.
set is created by default when creating the project.
Tome1_2.book Page 221 Vendredi, 28. mai 2010 5:50 17

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.

6.4 Declaring a procedure/function


6.4.1 Syntax Return keyword will not be run. For example:
The method for declaring a procedure is the same for a PROCEDURE Calculate(Dividend)
global procedure and for a local procedure. IF Dividend = 0 THEN
Error("Unable to divide by zero")
Important: Do not declare two procedures with the same
Return
name (especially a global procedure and a local proce-
ELSE
dure).

Declaring a procedure with parameters END
PROCEDURE <Procedure Name>([<Parameters>)
<Code of the procedure>
Notes:

Part 3: Basic WLanguage syntax


Declaring a procedure without parameter • If the procedure returns a result, use the Result
PROCEDURE <Procedure Name>() keyword.
<Code of the procedure> • Return and Result cannot be used in the same pro-
cess.
Declaring a procedure with variable parameters
PROCEDURE <Procedure Name>([<Parameters>,]*) 6.4.3 Returning a result
<Code of the procedure> To return the result of a procedure to the calling process,
use the Result keyword. For example:
Note: To make you code more readable, the PROCEDURE
PROCEDURE Find(File,Key,Value)
keyword can be replaced by the FUNCTION keyword.
HReadSeek(File,Key,Value)
6.4.2 Exiting from a procedure IF HFound THEN
Result True
To force the exit from a procedure, use the Return ELSE
keyword. In the procedure, the processes that follow the Result False
END
6.5 Calling a procedure/function
The method for calling a procedure is the same for a glo- can be replaced by FUNCTION.
bal procedure or for a local procedure.
Reminder: WLanguage does not differentiate between // Call the Found procedure, which
procedures and functions. The syntax for declaring and // returns a boolean
using the procedures also apply to the functions. IF Found(Customer,CustNum,Number)
THEN
Syntax Info(&quot:Customer number found")
Calling a procedure ELSE
[<Returned Value> = ] <Procedure Name>([<Para- Info(&quot:Customer number not
meters>]) found")
END
Note: To make your code more readable, PROCEDURE
Tome1_2.book Page 222 Vendredi, 28. mai 2010 5:50 17

222

6.6 Parameter of a procedure/function


Some parameters can be passed to a procedure. This the report.
paragraph presents the following topics: In the following example, the "Subscript" variable is not
• the type of the parameters. a real: an error will occur when compiling the project, the
• passing parameters. window or the report
• the local parameters. Subscript is int = 7
// Call to the MyProc procedure
• the optional parameters.
MyProc(Subscript)
• The variable parameters (procedure with a variable
number of parameters). -- Declaration of MyProc
Reminder: WLanguage does not differentiate between PROCEDURE MyProc(Subscript is real)
procedures and functions. The procedures and the func- …
tions are managed in the same way.
6.6.2 Passing parameters
6.6.1 Type of the parameters When calling a procedure, the parameters can be:
• passed by address
WD, WB s, Parameter typing is only available in
• passed by value.
WDMobile WinDev, in WebDev server code and in
WinDev Mobile.
Passing parameters by address
Default type of the parameters By default, during the call to a procedure, the parameters
The description of the parameter type is optional. By are passed by variable (by address). If the parameter is
default, the type of the variable passed in parameter modified in the procedure, the process calling the proce-
during the call to the procedure is used in the procedure. dure will retrieve the parameter with its modified value.
Part 3: Basic WLanguage syntax

For example: To pass a parameter by variable to a procedure, use the


Subscript is int following syntax:
// Call to the MyProc procedure <Procedure Name>(<Name of Variable
MyProc(Subscript) passed as parameter>)
-- Declaration of MyProc For example:
PROCEDURE MyProc(Counter) Subscript is int = 1
// Counter is an integer // Before the call to the procedure,
Counter += 1 // Subscript is set to 1
Therefore, the same procedure can be used for several AddOne(Subscript)
types of variables. // After the call to the procedure,
// Index is set to 2
Note: typecasting is not possible for an array type para-
meter.
-- Declaration of the procedure
Forcing the type of the parameters PROCEDURE AddOne(Counter)
To force the type of the parameters, use the following Counter += 1
syntax: Passing parameters by value
PROCEDURE <Procedure Name>(…
<Parameter 1> is <Type>,… When calling a procedure, the parameters can be passed
<Parameter 2> is <Type> ,… by value . If the parameter is modified in the procedure,
<Parameter N> is <Type> )
the process calling the procedure will retrieve the para-
meter with its unmodified value.
The type of the variable passed in parameter (during the Solution 1: to pass a parameter by value to a procedure,
call to the procedure) must be identical to the type des- use the following syntax:
cribed in the declaration of the procedure. Otherwise, an <Procedure Name>((<Name of the variable
error occurs when compiling the project, the window or passed as parameter>))
Tome1_2.book Page 223 Vendredi, 28. mai 2010 5:50 17

223

For example: <Required parameters>,…


Subscript is int = 1 <Optional Parameter 1> = <Value>,…
// Before the call to the procedure, <Optional Parameter 2> = <Value>,…)
// Subscript is set to 1 For example:
AddOne((Subscript)) -- Declaration of the procedure
// After the call to the procedure, PROCEDURE Drawing(Row, Column,…
// Subscript is still set to 1 BckgrdColor = Black, LineCol = iLi-
-- Declaration of the procedure ghtYellow)
PROCEDURE AddOne(Counter) …
Counter += 1 -- Calling process of the procedure
Solution 2: Using "local" parameters in the procedure Drawing(10,15)
When declaring a procedure, the variables passed in To keep the default value of an optional parameter, use
parameter can become local to this procedure. To do so, the "*" character when calling the procedure. For exam-
the local parameter must be preceded by the LOCAL ple:
keyword. For example: -- Declaration of the procedure
PROCEDURE MyProc(LOCAL Subscript, PROCEDURE Drawing(Row, Column,…
LOCAL Counter, Number) BckgrdColor = Black, …
If this parameter is modified in the procedure, the pro- LineCol = iLightYellow)
cess calling the procedure will retrieve the parameter …
with its unmodified value. -- Calling process of the procedure
Drawing(10,15, *, iLightGreen)
Passing a control, a window or a report
This object (control, window or report) is handled as any 6.6.4 Procedure with a variable number of
"standard" object. To pass an object as a parameter to a parameters
procedure, use the following syntax: If the procedure uses a variable number of parameters,

Part 3: Basic WLanguage syntax


<Procedure Name>(<Object>)
you must be able to handle the different parameters
For example: passed to the function in the code of the procedure.
// Call to the ControlVisible proce- These operations are performed via the MyParameters
dure keyword.
VisibleControl(ControlAddress) Example: control offset procedure: the controls passed in
parameters are shifted by 10 pixels.
-- Declaration of the procedure
// Procedure used to shift the con-
PROCEDURE VisibleControl(ControlAd-
trols
dress)
PROCEDURE ShiftControl(*)
AddressControl..Visible = False
FOR I = 1 TO MyParameters..Occurrence
Notes: MyParameters[I]..X +=10
END
• Myself enables you to handle the current control.
• MyWindow enables you to handle the current window. The parameters are always indexed from 1 regardless of
the number of mandatory parameters or the number of
• MyPage enables you to handle the current page optional parameters.
• MyReport enables you to handle the current report.
A variable number of parameters can be used with
6.6.3 Optional parameter • the procedures,
Some optional parameters can be passed to a proce- • the methods of classes,
dure. When declaring the procedure, the optional para- • the code for declaring the global variables of the win-
meters must be described in last position (to the right), dows, pages or reports.
with a default value preceded by "=":
PROCEDURE <Procedure Name>(…
Tome1_2.book Page 224 Vendredi, 28. mai 2010 5:50 17

224

6.7 Overloading a WLanguage function


•The same number of parameters as the WLan-
WD, WB s, This feature is only available in Win- guage function to overload. These parameters
WDMobile Dev, in WebDev server code and in must have the same type as the parameters of the
WinDev Mobile. WLanguage function.
2. The custom procedure will be used instead of the
WLanguage function whenever the name of the func-
6.7.1 Definition tion/procedure is used in the project (or in the win-
Overloading a WLanguage function enables you to use a dow/page if the created procedure is a local
custom function with the same name as the WLanguage procedure).
function.
For example, instead of using the standard WLanguage 6.7.3 Differentiating between the WLanguage
function named Info, you can use a custom procedure function and the custom function
named Info. The custom procedure will be run whenever If a WLanguage function was overloaded and if you want
Info is called. to use the initial function, prefix the name of the function
by WL. The following syntax must be used:
6.7.2 How do I proceed? WL.<Function Name>
To overload a WLanguage function:
1. Create a new procedure in your project (local or For example, to overload the Trace function of WLan-
global procedure). This procedure must have the fol- guage, you can use the following code:
lowing characteristics: PROCEDURE Trace(Information1)
•The same name as the WLanguage function to Message("Start a trace")
overload. WL.Trace(Information1)
Part 3: Basic WLanguage syntax
Tome1_2.book Page 225 Vendredi, 28. mai 2010 5:50 17

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

Part 3: Basic WLanguage syntax


file).
an entire object (project, window, page, report, …)
7.1.1 Displaying a custom message • specific exceptions: the exception process is valid only
for a specific section of code.
WD, This feature is only available in Win- • the automated exceptions: the exception manage-
WDMobile Dev and in WinDev Mobile. ment is implemented directly from the WinDev, Web-
Dev and WinDev Mobile interface.
To display a custom message when a programming error
occurs, all you have to do is enter the text of the error
when creating the executable.

7.2 General exception mechanism


7.2.1 Overview or in an procedure local to the window/page. This
A general exception process is available for all the com- exception process is no longer valid when the window/
ponents of the object with which it is associated. This page is closed.
exception process can be used as long as the object is • if the exception process is declared in any process, it is
available. valid for any error that occurs in this process. This
A general exception process can be declared in any pro- exception process will not be valid anymore once the
cess. process is completed. Therefore, an exception process
declared in the click code of a button will only be valid
Some examples: in this process and in all the procedures called from
• if the exception process is declared in the initialization this process.
code of the project, it is valid for any error that occurs in
the project. 7.2.2 Declaration syntax
• If the exception process is declared in a window initiali- Processing the exception on one line
zation code (global declaration code of a page or ope- WHEN EXCEPTION <Exception process on 1 line>
ning code of a report), it is valid for any error that <Rest of code>
occurs in the window/page, in a window/page control
Tome1_2.book Page 226 Vendredi, 28. mai 2010 5:50 17

226

Processing the exception on several lines level exception process.


WHEN EXCEPTION Use the EXCEPTION keyword in the exception process.
<Exception processing code> Example:
END // Initialization code of the project
<Rest of code> WHEN EXCEPTION
// stop the application
7.2.3 Declaring several general exception pro- EndProgram
cesses END
Declaring the general exception processes in the same
process // Global procedure named ControlValue
The second exception process will replace the first excep- // returns the value of the control
tion process from the declaration of the second excep- // returns "" if the control does not
tion process. exist
PROCEDURE Value(sControlName)
Example: In the Example procedure, if an error occurs: WHEN EXCEPTION
• in <Code1>: no exception management is enabled // if it is a code error
except if an exception procedure has been defined in // ControlNotFound, returns ""
the calling code (in the current window or project) IF ExceptionInfo(errCODE) = …
• in <Code 2>: the active exception process is <Excep- ControlNotFound THEN RESULT ""
tion Process 1> // if it is another error,
• in <Code 3> the active exception process is <Exception // cal the project
Process 2> // error manager
PROCEDURE Example() EXCEPTION
<Code 1> END
WHEN EXCEPTION
<Exception Process 1> 7.2.4 General notes
Part 3: Basic WLanguage syntax

END An exception process can only be used once


<Code 2> An exception process can only be used once. If a second
WHEN EXCEPTION exception occurs, the exception process will not be run. If
<Exception Process 2> an exception process of higher level exists, this exception
END process will be run.
<Code 3> To re-enable an exception process once it has been used,
Declaring the exception processes in different processes call ExceptionEnable. Caution, this function should be
used carefully.
If exception processes are declared in embedded objects
(project and window/page, or window/page and control, For instance: a general exception process was declared
for instance), the exception process of the smallest at window level and at project level.
object masks the main exception process during the life- A first programming error occurs in the window/page.
time of this object. This error is processed by the exception process of the
window/page.
Example, if the following two exception processes are
A second error occurs in the window/page. This error is
declared:
processed by the exception process of the project.
• exception process A declared in the initialization code
of a project Quality of WLanguage exception process code
• exception process B declared in the initialization code An exception process cannot be declared inside another
of a window/page exception process. We recommend that you check the
For all the errors that occur in the window/page, the quality of the code in the exception processes because
exception process B will be used and will masks the any error will trigger the display of the standard window/
exception process A. page of the security mechanism of WLanguage.

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.

7.3 Specific exception mechanism


7.3.1 Overview 7.3.2 Declaration syntaxes
A specific exception process enables you to process a Processing the simple exception

Part 3: Basic WLanguage syntax


risky code (which means a code that could trigger an WHEN EXCEPTION IN
exception). The exception will be triggered if a program- <Code that can trigger an exception>
ming error occurs in the specified code. DO
This specific exception process will only be available in <Code used to process the exception>
the process where it was declared. END
<Rest of code>
Notes
• A specific exception process can be declared in any Processing the advanced exception
process. WHEN EXCEPTION IN
• A specific exception process has priority over a general <Code that can trigger an exception>
exception process. DO
<Code used to process the exception>
ELSE
<Code used if the exception is not triggered>
END
<Rest of code>

7.4 Automated exception mechanism


The management of exceptions can be customized by various WLanguage functions.
process. Important: the automatic error and exception manage-
You can choose an automated exception process or ment works only for the process for which it is defined.
choose an advanced exception management thanks to
Tome1_2.book Page 228 Vendredi, 28. mai 2010 5:50 17

228

7.4.1 Implementation This option is recommended to group all the exception


To implement the automatic management of exceptions: processes that may occur.
1. In the code editor, display the process where the
exceptions must be managed: initialization code, 7.4.3 Running an exception process procedure
click code, procedure, … If this option is selected, the specified procedure will be
2. In the code header, click "Exception: manual". automatically run to process the error when an exception
3. The window that comes up lets you specify the occurs in the current process (or in the processes called
type of automatic process to perform: by the current process). This option is recommended if a
•Running the error process ("CASE EXCEPTION:" in procedure used to process the exceptions is already
the code) found in your application. This procedure will be automa-
tically called when an exception occurs. No test to run.
•Running a procedure of exception process.
This procedure can return one of the constants found in
7.4.2 Running the error process ("CASE EXCEP- the table below.
TION:" in the code) Depending on the constant returned, WinDev or WebDev
If this option is selected, a code line is added to the cur- will run the corresponding process.
rent code "CASE EXCEPTION:". The code lines following
this statement will be run when an exception occurs in OpCancel Restarts the exception
the previous code lines (or in a process called by these
code lines). OpEndProcess The function that triggered the
error returns an error and the cur-
For example: rent process stops. Equivalent to
CASE EXCEPTION: ReturnToCapture
// Display an error message
Error("Fatal error detected",… OpEndProgram The function that triggered the
ExceptionInfo() , "", … error returns an error and the pro-
"Stop the procedure.") gram stops. Equivalent to EndPro-
Part 3: Basic WLanguage syntax

// Manage this error gram


… opRelaunchPro- Ends the application and automa-
gram tically restarts the application.

7.5 Functions for managing the exceptions


The following functions let you manage exceptions:
ExceptionEnable Re-enables the current exception process if the exception was fixed.
ExceptionChange- Configures the automatic behavior that will be implemented if an exception occurs in the current
Parameter process. The previous behavior can be restored by using the ExceptionRestoreParameter function.
ExceptionThrow Artificially triggers the security mechanism of WLanguage by triggering an exception. This excep-
tion can then be processed by an exception code written for this purpose.
ExceptionInfo Returns information about the current exception.
ExceptionPropagate Propagates an exception. This function must be run in an exception process and it is used to res-
tart the mechanism of exception process.
ExceptionRestore- Restores the exception process of a process. This exception process was modified in the current
Parameter process by a call to ExceptionChangeParameter.
These functions are detailed in the online help.
Tome1_2.book Page 229 Vendredi, 28. mai 2010 5:50 17

229

8. OBJECT-ORIENTED PROGRAMMING (OOP)


8.1 Overview of OOP (Object Oriented Programming)
OOP and WLanguage
WD, WB s, OOP is available only in WinDev, in WLanguage is object-oriented:
WDMobile WebDev server code and in WinDev
Mobile. •it supports the objects
•the objects have an associated class
Object-oriented programming (called "OOP") is a pro- •classes may inherit attributes from "super classes"
gramming paradigm in which the programs are organized
as sets of objects. Each object represents an instance of Important: the goal of this chapter is not to describe the
a given class, all the classes being members of a class concepts of object oriented programming, but only to
hierarchy unified by inheritance releationships. describe how to declare classes, methods and objects in
WLanguage. This chapter presents the OOP syntax of
Therefore, objects are used by the OOP. WLanguage and how to create an object oriented pro-
•Each object is an instance of a given class. gram in WLanguage.
•The classes are linked between themselves by the We assume that readers are familiar with the concept of
inheritance relationships classes, objects and inheritances, …
If you are not familiar with OOP, we recommend that you
read an OOP guide before you continue with this chapter.

8.2 OOP concepts

Part 3: Basic WLanguage syntax


8.2.1 Class object owns the members described in its class and can
A class contains the description of a data structure be handled through the methods of its class. An object is
(members) and the processes (methods) used to handle known as "an instance of the class".
this structure. A class can be considered as a model that defines the
Therefore, a class defines a data type and its behavior. members and methods common to several objects.
See the ’Class, members and methods’ paragraph, page A member is a parameter of the object. A method ena-
243, for more details. bles you to affect the object, to modify its members for
example.
8.2.2 Object See the ’Object’ paragraph, page 246, for more details.
A class enables you to create objects. Each created
Tome1_2.book Page 230 Vendredi, 28. mai 2010 5:50 17

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

8.3 Class, members and methods


Part 3: Basic WLanguage syntax

A class is made of: Example of class:


• data, called members The "File" class is made of the following members:
• constants Name, Extension, Directory
• procedures, called methods. A method is a procedure The "File" class has the following methods:
specifically written to handle the objects found in the • FileSelection() to select a file and assign the members
class. of the File object with the selected file
To use a class, you must declare one or more objects. All • FileSize() to get the file size of the File object
the objects of a given class have the same attributes and
behavior, but their members contain different data.
8.3.1 Declaration of the class
By default, the members of a class are public, they can <ClassName> is class
be accessed by a method of the class as well as by a pro- <Declaration of members>
cess of the project or by one of its elements (window, END
page, control, etc.)
SystemClass is class
Name is string
END
Tome1_2.book Page 231 Vendredi, 28. mai 2010 5:50 17

231

8.3.2 Declaration of members


CONSTANT
[<Access>] [CONSTANT] [GLOBAL] <Member Name> <Constant Name> = <Constant Value>
is <Member Type> <Constant Name> = <Constant Value>
END
SystemClass is class
Name is string CONSTANT K=5
Private CONSTANT
Size is int K=5
END J=10
END
The important parameters of this syntax are as follows:
The important parameters of this syntax are as follows:
<Access>: Optional
Used to restrict the access to this class member. 3 <Name of the constant>
levels are available: Name of the constant. A constant is public.
•Private: access authorized from the code of the <Value of the constant>
class
Value associated with the constant. This value will
•Protected: access authorized from the code of the not change during the execution of the program.
class or the code of a derived class
•Public (default): access authorized from any code 8.3.4 Declaration of methods
of the class or the project.
Function [<Access>] [Global] [VIRTUAL]
CONSTANT: Optional <Class Name>::<Method Name>
Modifies the access constraints by allowing an ([<Parameter1>, ... [<ParameterN>]])
access in read-only. or
•Protected CONSTANT: the value of the member

Part 3: Basic WLanguage syntax


Procedure [<Access>] [Global] [VIRTUAL]
can be read and modified from the code of the
<Class Name>::<Method Name>
class; it can only be read from the code of a sub-
([<Parameter1>, ... [<ParameterN>]])
class; it cannot be accessed from any other piece
of code of the application. Global procedure …
•Public CONSTANT: the value of the member can be SystemClass::SeeObject(obj)
read and modified from the code of the class or // The Size private member is
subclass; it can only be read from another piece of // accessible from the code of the
code of the application. // class
Info("Name: "+Obj:Name + …
GLOBAL: Optional "Size: "+Obj:Size)
Defines a global member. This member will exist out-
side the objects. It can be used without instantiating Function Global …
an object. If several objects are declared, a global SystemClass::Try(a,b)
member is common to all the objects. Result a+b
The important parameters of this syntax are as follows:
<Name of the member>
Name identifying the member. <Access>: Optional
Used to restrict the access to this method. 3 levels
<Type of Member>
are available:
Type of the member chosen among the available
•Private: the method can be called from a code of
WLanguage types.
the class only
8.3.3 Declaration of constants •Protected: the method can only be called from a
code of the class or from a code of the subclass
CONSTANT <Constant Name> = … •Public (default): the method can be called from
<Value of the constant> any code of the class or the project.
or
Tome1_2.book Page 232 Vendredi, 28. mai 2010 5:50 17

232

Global: Optional <Name of the class>


Defines a global method. This method will not work Name identifying the class.
on a specific object: no class object is required to <Name of the method>
call this method. This class can also be used to han- Name identifying the method.
dle the global members.
Virtual: Optional <Parameter 1 …. Parameter N>
Defines a virtual method. By default, an overridden Optional parameters that must be passed to the
method is virtual. method.

8.4 Constructor and destructor


When creating a class in the code editor, the Constructor
and Destructor methods are automatically created by <Member Name>
default. Name identifying the member of the class.
The Constructor method, if defined by the developer, is <Parameters>
automatically called when instantiating the object. It per-
Optional parameters of the constructor. If these
forms the initialization steps for the object or related to parameters are specified, they must be passed
the object (assigning members, verifications, …) when declaring the object.
The Destructor method, if defined by the developer, is
automatically called when deleting the object (exit the Executing the constructor method of an ancestor class
procedure where the object has been instantiated). It can Each member of the class is set to zero if no constructor
be used to free resources for example… is associated with the ancestor class
The Constructor and Destructor methods cannot contain If a constructor method is associated with the ancestor
Part 3: Basic WLanguage syntax

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.4.2 Destructor method The destructor does not accept parameter.


SystemClass is class
Declaration of the method Name is string
Procedure <ClassName>::Destructor() END

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

Part 3: Basic WLanguage syntax


redefined
<ObjectName> is [object] <ClassName> ([<Parame- <Object Name> : <Class Name> :: <Method Name>
ters>]) ([<Parameters>])
SourceFile is object File
SourceFile is File
4. Calling a general class method
<Class Name>:: <Method Name> ([<Parameter>])
The important parameters of this syntax are as follows:
SFile is File
<ObjectName> FileD is File
Name identifying the instance of the class. ch1,ch2 are string
//call the method for selecting
<Class Name>
// a file
Name identifying the class, defined when the class SFile :FileSelection()
was created in the code editor. DFile :FileSelection()
<Parameters> // call the method for checking
Optional parameters of the constructor. // the available space
If SFile:RemainingSpace(…
8.5.2 The members of an object DFile:Directory[[1]]) then
A member of an object is a data associated with the ch1= SFile:Directory+"\"+…
object. An object necessarily owns all the members des- SFile:Name+"."+SFile
cribed in the class. A member is also called property of :Extension
the object. ch1= DFile:Directory+"\"+…
FileD:Name+"."+FileD:Extension
The members of an object correspond to all the members
fCopyFile(SFile,DFile)
defined for the source class of the object.
else
Reminder: a member is declared in the class. Error("Insufficient space")
End
Tome1_2.book Page 234 Vendredi, 28. mai 2010 5:50 17

234

8.5.4 Lifespan of an object • An object declared as global in the global declaration


The object is created during its declaration. The object is code of a window/page will be destroyed at the end of
local by default. the closing process of the window/page.
The object is automatically destroyed at the end of the • An object declared as global in the initialization code of
process containing its declaration : a project will be destroyed when the project is closed.

8.6 Dynamic instantiation of an object


An object can be dynamically associated with a class, we 8.6.1 Declaring a dynamic object
talk of dynamic instantiation of the object.
<ObjectName> is [object] <ClassName> dynamic
The dynamic instantiation of an object enables you to
create an object at a given time and to free this object The important parameters of this syntax are as follows:
when it is no longer used. <ObjectName>
To instantiate an object, you must:
Name identifying the instance of the class.
1. declare a dynamic object
2. instantiate the object <Class Name>
Note: the object is automatically freed when it is not used Name identifying the class, defined when the class
anymore. However, you can force the destruction of the was created in the code editor.
object (to force the execution of the destructor for ins-
tance). 8.6.2 Instantiating a dynamic object
File is class <ObjectName> = …
Name is String new <Class Name> [<Parameters>])
Extension is String
The important parameters of this syntax are as follows:
Part 3: Basic WLanguage syntax

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>

8.7 Class inheritance


The hierarchical organization in class and sub-class has Base Class.
allowed to create the notion of inheritance. • The new class is called Subclass. The derived class
In other words, an object of the sub-class A (derived incorporates the ancestor class and adds new
class) that has the same characteristics as the class B methods and new members to it.
(ancestor class) as well as its own characteristics inherits
from all the characteristics of class B without having to The purpose of inheritance is to retrieve the methods
duplicate the programs in the object of the sub-class A. developed for another class and to add the characteris-
Therefore, the number of code lines is reduced. tics specific to the new class.
Inheritance is the mechanism by which the class cur- The objects found in a sub-class can access all the
rently being described uses the methods and members methods and all the members of the ancestor classes; it
defined in existing classes. is as if the methods and the members of the ancestor
• The existing class is called Ancestor Class/strong> or classes were part of the sub-class.
Tome1_2.book Page 235 Vendredi, 28. mai 2010 5:50 17

235

Characteristics of an inheritance: The important parameters of this syntax are as follows:


• An inheritance can be multiple. In this case, the deri- <NameDerivedClass>
ved class can derive from several ancestor classes.
Name identifying the derived class that is currently
• An inheritance can be private or public (by default). declared.
If the inheritance is public, you have the ability to
access the methods and the members inherited from PRIVATE
the outside of the class. Optional keyword. Indicates whether the inheritance
If the inheritance is private, only the methods of the is private or not. If this keyword is not specified, the
derived class can access the inherited members and inheritance is public.
methods.
<NameAncestorClass>
8.7.1 Syntax Name of the ancestor class.
<NameDerivedClass> is class <Name Member Derived Class>
[PRIVATE, PROTECTED, PUBLIC] Name of the member of the derived class. This mem-
Object <NameAncestorClass> ber can only be used in an object of the derived
<Derived Class Member Name> class.
<Member type>
… <Member Type>
END Type of the member, chosen among the available
types.
File is Class
Name is String 8.7.2 Redefining the methods
Extension is String In a derived class, a method of the base class can be
Directory is String redefined by creating in the derived class a method with
End the same name as the one of the base class.

Part 3: Basic WLanguage syntax


The redefinition of methods is used to modify the beha-
FileInfo is class vior of the method defined in the base class; the derived
a File object class can eventually redefine the method according to its
FSize is int requirements.
FDate is String
FTime is String
The redefined method is a virtual method by default.
End Note: overloading a method (using two methods with the
same name in the same class) is not supported by WLan-
guage.
Note: the Object keyword lets you access the current
object inside a method.
Tome1_2.book Page 236 Vendredi, 28. mai 2010 5:50 17

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,

Part 4: Managing controls, windows and pages


The handling of controls (move, copy, etc.) is detailed in •Image, •Tab,
the ’Handling controls in the editor’ paragraph, page •Clickable image, •Web Camera control,
255. •Formatted display con- •Java Applet control,
All the controls can of course be handled by program- trol, •Flash control,
ming. •Edit control, •iFrame control,
See the online help for more details. •Check box, •Internal Page control,
•Radio button, •Site map path,
1.1.1 Types of controls available in WinDev •List box, •Site map
The following controls are available in the WinDev window •Combo box, •Supercontrol,
editor: •Table, •Chart,
•Edit control, •HideShow, •Looper, •Calendar,
•Static control, •Web Camera, •Pager, •Control template.
•Button, •Conference control,
•Image, •OLE control, 1.1.3 Types of controls available in WinDev
•Radio button, •ActiveX, Mobile
•Check box, •Shape, The following controls are available in the WinDev Mobile
•List box, •Bar code, window editor:
•Combo box, •HTML control, •Edit control, •Progress bar,
•ListView, •Supercontrol, •Static control, •Scrollbar,
•Table, •Internal window control, •Button, •Slider,
•Treeview table, •Toolbar, •Image, •Spin,
•TreeView, •Splitter, •Radio button, •Tab,
•Progress bar, •Chart, •Check box, •Sidebar,
•Looper, •Carousel, •List box, •Shape,
•Scrollbar, •Cube, •Combo box, •Supercontrol,
•Slider, •Xaml, •ListView, •Splitter,
•Spin, •Calendar, •Table, •Web Camera,
•Tab, •Internal window, •Looper, •Multimedia,
•Sidebar, •Control template. •TreeView, •Control template.
•Calendar,
Tome1_2.book Page 240 Vendredi, 28. mai 2010 5:50 17

240

1.2 Creating a control


1.2.1 Creating a new control - 2nd solution: the "File" settings of the control.
To create a control: - Create the control ("Insert .. Control/Shape/Spe-
1. Select the type of control to create: cial" option or toolbar icon).
- using the "Insert .. Control/Shape/Special" - Select "Display .. Selection description". The des-
option. cription window (7-tab window) of the control
- using the corresponding icon in the "Control" tool- comes up.
box. - Select the "File" tab.
2. The shape of the new control comes up under the - Enter the information about the linked item.
mouse cursor. - 3rd solution: drag and drop from the dictionary.
3. Click the position where the control must be crea- - Drag the control found in the directory and drop it
ted in the window or in the page. The control is auto- at the intended position of the control inside the
matically created. window or page.
You can also create a control from:
Part 4: Managing controls, windows and pages

1.2.3 Copy a control


• a dictionary control. One or more controls can be copied into the same win-
• the clipboard content. dow/page or from one window/page into another one.
• an image file. The description and code of the copied control will be
See the online help for more details. identical to the ones of the original control.
To copy a control into the same window or page:
1.2.2 Creating a control associated with an - 1st method: menu options
item - Select the control to copy.
Except for the following types, all the controls of a page or - Click the "Copy" icon in the main toolbar (or select
a window can be associated with a file item: "Edit .. Copy" or "Copy" from the popup menu).
•button - Click the "Paste" icon in the main toolbar (or
select "Edit .. Paste" or the "Paste" option in the
•shape (window only)
popup menu).
•tab - Position the control with the mouse (the outline of
•toolbar (window only) the control appears in dotted lines and it helps you
•horizontal rule (page only) position the new control).
•Xaml (window only) - 2nd method: Drag and drop
•Carousel (window only) - Select the control to copy.
•Cube (window only) - Left-click the control to copy and keep the mouse
button down.
•HTML control - Move the control with the mouse (the outline of the
•Java Applet control (page only) control appears in dotted lines and it helps you
•Flash control (page only) position the control to paste).
•pager (page only) - Release the mouse button.
•HTML table and cell (page only) - Select the option "Copy here".
A new name is automatically given to the copied con-
•Site map (page only) trol. This name can be modified in the description
•Horizontal rule (page only) window of the copied control ("General" tab).
•Multimedia (Mobile window only)
To copy a control from one window (or page) to another
window (or page):
To create a control associated with an item (or to get an - 1st method: menu options
item): - Select the control to copy.
- 1st solution: drag and drop from the "Analysis" - Click the "Copy" icon in the main toolbar (or select
pane. "Edit .. Copy" or "Copy" from the popup menu).
- In the "Analysis" pane, select the item to display - Display the target window or page.
inside the control. - Click the "Paste" icon in the main toolbar (or
- Drag the item and drop it at the future position of select "Edit .. Paste" or the "Paste" option in the
the linked control. popup menu).
Tome1_2.book Page 241 Vendredi, 28. mai 2010 5:50 17

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.

Part 4: Managing controls, windows and pages


1.3 Modifying a control’s settings
You can display the control description window for any General tab
control in a window/page. This is a window with several The "General" tab is used to specify the name of the
tabs, which group the configurable settings of one or control and all the display settings for the control (cap-
more controls. tion, input mask, etc.).
Note: you can also view and/or modify the settings of one
or more controls in the modifier. See the online help for GUI tab
more details. The "GUI" tab is used to define the settings for the con-
trol’s interface:
1.3.1 Displaying the characteristics •Control’s state when opening the window/page.
To display the description window of a control: •Visibility of the control
• double-click the control. •Control’s size
•select "Description" from the popup menu of the •Alignment, …
control (right mouse click).
Details tab
•select the control and select "Display .. Selection
description". The "Details" tab is used to define various control set-
tings:
•select the control and use the [Alt]+[Enter] keyboard
shortcut. •input settings
•select "Display .. Options .. Modify the options" •Drag and Drop, …
([F12]), select the control and click "Edit". The content of this tab varies a lot based on the current
control’s type.
Notes:
• The description window can be displayed for a set of Link tab
selected controls. Only the characteristics common to This tab lets you select the item to which the control is lin-
the selected controls will be displayed. ked. Depending on the current record, the content of the
• Several description windows can be displayed at the linked item will be displayed in the control.
same time. Each description window displays the cha- The link can be single-file or multi-file.
racteristics of one or more controls.
Content tab
1.3.2 Characteristics by tab This tab is available for the controls found in the windows
This paragraph briefly presents the various categories of and pages.
settings displayed for each tab. The "Content" tab is used to define:
See the popup help of the description windows for more •the initial content of the control (for the edit controls
details about each setting found in the various tabs. only).
•the data source used to fill the control (for the list
boxes, combo boxes and tables only).
Tome1_2.book Page 242 Vendredi, 28. mai 2010 5:50 17

242

Notes tab • the overflow,


The "Note" tab is used to describe the detailed behavior • the image and/or the background color.
of the control. This information will be printed in the pro-
gram documentation (project documentation, window/ Style tab
page documentation, etc.). The "Style" tab is used to define the style of the control’s
In WebDev, this tab is combined with the "Help" tab. elements. This screen is used to:
• modify the control appearance: simply select the con-
Help tab trol element to modify, then its style settings. Only the
The "Help" tab is used to enter and configure all the appearance of the current control is modified.
types of help associated with the control. A control can • Apply an existing style to the control: simply select the
have: style to apply.
• A tooltip displayed when rolling over the control. • Create or modify a style: the created or modified style
• A help message, displayed in the status bar when the is updated for all the project’s controls using this style.
control takes focus.
• A help window with a specific title, displayed when 1.3.3 Dynamic control, static control
Part 4: Managing controls, windows and pages

using the F1 key (WinDev only)


WB Dynamic and static type controls are
In WinDev, a control can also be associated with a speci- only available in WebDev.
fic help page, found in a help file in HLP or CHM format.
This help page will be displayed: For all the types of controls, WebDev offers the following
• as a context-sensitive help (tooltip displayed on options:
demand), if a help file has been defined for the win- • Automatic: the control will adapt automatically to the
dow. type of use.
• as a help page. The WHelp function will need to be • Static: the control cannot be modified by program-
used to display the help page. ming: the properties applied to the control will have no
In WebDev, this tab is combined with the "Notes" tab. effect.
• Dynamic: the control can be modified by program-
Advanced tab (WebDev only) ming: all the properties associated with the control can
The "Advanced" tab is used to enter the HTML code be used.
generated before and after the control. Note: if a control is defined as dynamic, the HTML code of
Border, Bckgrd tab (WebDev only) the page will contain specific code for managing the pro-
The "Border, Bckgrd" tab is used to define: gramming of the control in WLanguage. Therefore, the
HTML file corresponding to the page will be larger than if
• the border displayed around the control, the control is defined as static.
• the control’s alignment,

1.4 Handling the controls in the editor


1.4.1 Controls’ handles - The gray handles show the first selected control in a
When a control has just been created or when it is selec- multiple selection. This control will be the reference
ted, it is displayed with handles. The handles are used to: control.
- view the size of a control,
- resize a control. 1.4.2 Selecting one or more controls
The colors of the handles are used to identify the actions To modify, copy, ... a control, you need to first select it.
that can be performed: The name of the selected control appears in the status
- The black handles let you view and resize a control. bar.
- The white handles are used to view a control. For To select a control, click the control to select: the black
example, when selecting several controls, the white control handles come up (if the control can be modi-
handles indicate that the selected controls cannot fied).
be resized.
This type of handles are also displayed when a win- To select several controls:
dow is read-only for a developer: the controls can- - 1st solution: The CTRL key
not be resized. Click each control to select while keeping the CTRL
key down. "Clicking"an already selected control
clears its selection.
Tome1_2.book Page 243 Vendredi, 28. mai 2010 5:50 17

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):

Part 4: Managing controls, windows and pages


handles. 1. Select the control and keep the left mouse button
• To add/delete a control to/from an existing selection, down.
keep the [Ctrl] key down and click the control that must 2. Slide the control using the mouse: the control’s
be added/deleted to/from the selection. shape appears in a dotted line to help position the
control.
To cancel the selection of several controls: 3. Release the button when the control is positioned
- click a non-selected control. where you want.
- click the window or page background.
- click the title bar of the window or page. The selected controls can also be moved with the arrow
keys.
Special case: overlapping controls To speed up the move, press the [Ctrl] key together with
To select one of the overlapping controls: the arrow key.
- 1st method:
Click the stacked controls successively until you 1.4.5 Using an off-window control
select the requested control. This feature is only available for WinDev and WinDev
Note: the status bar shows which control is selected. Mobile.
- 2nd method: In most cases, the controls belong to a window. There-
- Click the stacked control while keeping the [Shift] fore, these controls appear in edit and at run time. Howe-
key down. A list displays the name of the overlap- ver, you can position a control in the host window of a
ping controls. window: the control is "off-window". This control will be
- Select the control you want from the list. visible in edit and will not be visible at run time.
An "off-window" control enables you to, for instance:
1.4.3 Grouping selected controls
• keep a control in a window without displaying it at run
Several controls can be grouped together. This grouping time. This enables you to use the content of the control
simplifies the action of moving several controls for exam- in programming (like a variable).
ple.
• display new controls in a window when resizing this
Caution: this grouping can only be done in the window or window.
page editor. To access by programming a set of controls
Tome1_2.book Page 244 Vendredi, 28. mai 2010 5:50 17

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.

1.4.6 Modifying the caption of a control


You can modify a control’s caption directly from the win-
dow or page editor.
Part 4: Managing controls, windows and pages

To modify the caption:


- 1st method:
- Double click the control to modify.
- Enter the new caption of the control.
- Press [Enter] to validate the modification.
- 2nd method:
• At run time, once the "Details" button has been clic- - Select the control to modify.
ked, the "login" window is as follows: - Press the [Enter] key.
- Enter the new caption of the control.
- Press [Enter] again to validate the modification.

1.4.7 Tooltip of a control


A tooltip is displayed when the mouse cursor rolls over a
control. This tooltip displays some information about the
control under the mouse cursor:
- its name,
- its position,
- its size,
- the control’s anchor (if the control is anchored),
- its initial state (only if the control is invisible).

1.5 Control alignment


Control alignment lets you build professional-looking and - the positioning table (WebDev only).
eye-pleasing interfaces. To help you build standard inter-
faces, WinDev, WebDev and WinDev Mobile offer the fol- 1.5.1 The rulers
lowing tools: In the window or page editor, you can bring up alignment
- the rulers. rulers.
- the grid. These rulers have snap-on guides: any control that comes
- the real-time interface checker (automatically comes close to a guide is automatically "snapped" by it. This
up when positioning a control). feature enables you to easily position, align or resize the
- the advanced interface checker. controls found in a window or in a page.
- the alignment options.
- the customizable zoom.
Tome1_2.book Page 245 Vendredi, 28. mai 2010 5:50 17

245

For instance, in the case of a window :


Markers

Border
markers

Guides

Part 4: Managing controls, windows and pages


Displaying the rulers To copy the markers and the guides:
To display the rulers, select "Display .. Rulers". Two types 1. Select "Copy the guides" from the popup menu
of guides can be used: of the rulers.
- guides, allowing you to align and lay out controls 2. Open the window or the page where the copy of
inside windows or pages. the markers and guides must be performed.
- border guides, used to define a margin of the same 3. If necessary, display the rulers in this window or
size on each side of the window or page. page ("Display .. Rulers").
4. Select "Paste" from the popup menu of the
Note: To turn the guides on or off for a window or a page, rulers.
select "Guide visible" from the popup menu of the
rulers. Whether they are visible or not, the guides are Special case: border markers
always enabled: any control moved toward a marker is The border markers are used to define a "margin" in the
automatically snapped by it. current window or page. The border markers are located
at the end of the rulers.
Handling the markers
Markers can be easily handled with the mouse in the edi- To move the left or right margin, point to a border marker
tor. When a marker is hovered by the mouse, the cursor on the horizontal ruler. When the pointer turns into a dou-
turns into a double arrow. ble arrow, move the margin.
To create a marker: To move the top or bottom margin, point to a border mar-
- 1st method: ker on the vertical ruler. When the pointer turns into a
Click one of the window or page rulers. The marker is double arrow, move the margin.
created on the nearest mark.
Notes:
- 2nd method:
Select "Add a marker" from the popup menu (right •The border markers cannot be deleted. If the borders
mouse click) of the ruler. The marker is created on the are not needed in a window or page, the border mar-
nearest mark. kers can be reduced to their minimum size.
•The opposite border markers are interdependent:
To move a marker: when one border marker is moved, the opposite bor-
1. Click the marker found in the ruler. The cursor der marker moves accordingly.
turns into a double arrow.
2. Move the cursor to the new marker position. 1.5.2 Snap-on grid
To delete a marker, select "Delete a marker" from the The snap-on grid lets you place vertical and horizontal
popup menu (right mouse click) of a marker. markers in a window or page.
To delete all the markers from a ruler, select "Delete The created controls are attracted to these markers, as if
all" from the popup menu of the ruler. the controls and markers were magnetic. The snap-on
grid lets you align the controls according to the markers.
The snap-on grid can be configured in the "Magnetism"
Tome1_2.book Page 246 Vendredi, 28. mai 2010 5:50 17

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).

1.5.3 Real-time interface checker 1.5.5 Alignment options


When a control is moved in a window or in a page, guides To align several controls:
are displayed automatically by the real-time interface 1. Select the controls to align.
checker. The objects snap to the guides, allowing you to 2. Perform:
align the control you are moving with the other controls - a preset alignment (using the pull-down menu -
found in the window or page. "Control .. Alignment .." or in the control alignment
toolbar).
To turn the real-time interface checker on or off: - a custom alignment ("Control .. Alignment .. Cus-
1. Select "Display .. Options .. Modify the options". tom Alignment").
2.In the "Magnetism" tab, turn the automatic posi- The custom alignment enables you to use specific align-
Part 4: Managing controls, windows and pages

tioning on or off. ment properties.


1.5.4 Advanced interface checker When using the custom alignment, you have the ability to
The advanced interface checker is a tool that enables you define:
to harmonize the positioning of the controls in the diffe- - the horizontal or vertical alignment: the controls can
rent windows of an application or the different pages of a be aligned to the left according to the beginning of
site. the control or according to the beginning of the
The advanced interface checker offers to apply to the cur- input area. They can also be aligned to the right
rent window or to the selected controls, some presenta- according to the end of the control or according to
tion rules from the Windows standard: control alignment, the end of the input area.
standardization of the button size, … - the regular spacing: spacing between controls is
adapted so it is the same between each control
To use the advanced interface checker: (horizontally and vertically).
1. Select the controls whose position, size or align- - the size: the size of the selected controls is adapted
ment need to be revised. automatically to get controls with the same height
2. Start the advanced interface checker: and/or width.
•via "Control .. Alignment .. Interface checker". - the reference control: to align and size the controls,
•click the icon of the interface checker in the control the reference control can be:
- the first selected control (the one with the white
alignment toolbar of the window editor ( ). handles)
3. Once started, the interface checker analyzes the - the last selected control
window, page or control selection. The interface - the largest selected control
checker sets "Control groups", based on their type, - the control located in the top left position of the
position, … selected controls
For each "group of control" the interface checker
proposes to apply the rules that have not been com- 1.5.6 The configurable zoom
plied with. The relevant controls (or groups of con-
trols) are bordered by a colored line. A zoom coefficient can be specified to reduce or enlarge
4. Several choices are available: the display of the current window or page.
- Apply the rule: the proposed changes are made to To specify a zoom factor:
the window or page. The interface checker goes to - 1st method:
the next rule. - Select "Display .. Zoom .." and select the zoom
- Ignore the rule: no change is made. The next rule is coefficient to use.
proposed. - Enter the zoom factor in the status bar of the editor
- Resume: cancels the change made by applying the (bottom right).
previous rule. - 2nd method:
- Close: the proposed rule is not applied. The win- - Press the [Ctrl] key.
dow or page remains intact and the interface - Modify the zoom factor with the mouse wheel while
checker is closed. keeping the [Ctrl] key down.
Tome1_2.book Page 247 Vendredi, 28. mai 2010 5:50 17

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.

1.6 Control editing options in a window or a page


The editing options ("Display .. Options .. Modify 1.6.2 Locking/unlocking a control
options") let you configure: "Control .. Edit options .. Locked" lets you lock/unlock a
- the display options. control.
- the control magnetism.
- the click and double-click operations on controls. A locked control is a control that cannot be selected
- the control selection options. using the lasso. For instance, you may want to lock a tab.
- the position of the window at opening. When several controls displayed in a tab are selected by
the lasso, the tab is not selected automatically.

Part 4: Managing controls, windows and pages


This display options let you customize the handling of All other operations are possible on a locked control.
controls in the window editor.
The information to display in each window in the window 1.6.3 Framing or not a control
editor can also be selected directly using "Display .. "Control .. Edit options .. Frame" lets you frame a control
Options..". or not.
Framing a control lets you easily view all the control found
1.6.1 Making a control visible/invisible in a window (especially for image controls).
"Control .. Edit options .. Visible" lets you make a control
visible/invisible in the window editor.

1.7 Anchoring controls WD WDMobile

The windows of a WinDev application can be resized at


run time. The anchoring mechanism is used to automati-
cally adapt the size and the position of the controls when
the window is resized.

The management of control anchoring includes two para-


meters:
• control anchoring: this parameter lets you define the
changes to apply to the control based on the size chan-
ges of the window. The control can be moved to the left
or to the bottom, its size can be increased in width
and/or in height, ...
• the anchor rate: this parameter is used to manage the
percentage by which the control is moved or stretched.
This parameter enables you to: the size of anchored controls is automatically modified.
- keep a control centered in width in the window
regardless of its size. 1.7.1 Anchoring a control in the editor
- proportionally increase the size of some window
controls. To anchor a control:
1. Select one or more controls to anchor.
These parameters can be configured: 2. Define the anchoring of the control(s):
• in the window editor •in the "Detail" tab of the description window of the
• By programming with the WLanguage properties control ("Display .. Selection description").
•via "Anchor" from the popup menu (right mouse
click) of the control.
Tome1_2.book Page 248 Vendredi, 28. mai 2010 5:50 17

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

1.7.2 Anchoring a control in a tab Larger window:


A control displayed in a tab is anchored in relation to the
tab and not to the window.

1.7.3 Anchoring a control in an area marked


by a separator
A control displayed in an area marked by a separator is
anchored in relation to this area and not to the window.

1.7.4 Anchoring a selection of controls


To anchor a selection of controls, select "Anchor" from
the popup menu (right mouse click) of the selection.

1.7.5 Example for configuring the control


anchors

Part 4: Managing controls, windows and pages


Here is a detailed example, illustrating the anchoring
possibilities for controls in windows. To obtain this result:
Original window: 1. Select the [<<] and [>>] buttons: these controls
must be centered by height and width ( ).

2. Select both lists: these controls must be anchored


to the right, in height and in width (options "to the
right", "in height" and "in width" selected).
3. Select the 3 buttons: these controls must stretch
proportionally to the right ( )

1.7.6 Anchoring a control by programming


Several WLanguage properties allow you to configure the
anchor of the controls by programming.
These properties are as follows:
Anchor Enables you to find out or modify
the current anchor of a control
AnchorRateBottom Enables you to find out or modify
the movement rate toward the
bottom of a control on the verti-
cal axis
AnchorRateRight Enables you to find out or modify
the movement rate toward the
right of a control on the horizon-
tal axis
Tome1_2.book Page 250 Vendredi, 28. mai 2010 5:50 17

250

1.8 General functions for handling the controls


The following functions are used to handle controls. See the online help to find out about the functions speci-
These are general functions that can be used will all the fic to a type of control.
types of controls.
ActiveXEvent Associates a procedure written in WLanguage with an event of an ActiveX control
ScrollBarShow Displays (or not) a scrollbar in a control (edit control or list box)
ShowToolTip Enables or disables the mechanism for displaying the control tooltips
ToolTipColor Modifies the colors of the tooltips (text color and background color) for the current window
ToolTipDelay Enables you to modify the time-out before the tooltips are displayed as well as the display
duration of the tooltips
ControlEnabled Ungrays a control or a group of controls found in a window. During this operation, an ani-
mation can be performed on the controls.
FieldAlias Identifies, modifies or restores the file link of a control or group of controls
Part 4: Managing controls, windows and pages

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

Part 4: Managing controls, windows and pages


automatically via data persistence in controls
TextHeight Calculates the height in pixels of a text displayed in an edit control static control or in a
combo box
TextWidth Calculates the width in pixels of a text displayed in an edit control, a combo box or a static
control
TextToHTML Converts a text into HTML
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile)
Tome1_2.book Page 252 Vendredi, 28. mai 2010 5:50 17

252

2. THE WINDOWS WD WDMobile

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

2. Select the type of window to create:


•blank window, without control. To display the characteristics of the window, select "Des-
cription" from the popup menu of the window.
•RAD type window used to display and enter data.
This type of window can be based on a data file, on

2.2 Main characteristics of a window


A window can accept all the available types of controls. • have a toolbar: this toolbar will display the help messa-
A window can: ges associated with the different controls of the win-
• be resizable: the user can increase of decrease the dow. This status bar also lets you display additional
window’s size. Depending on the anchoring settings information. See the ’Status bar’ paragraph, page 315,
defined for each control, the position of the controls for more details.
inside the window can change when the window is • be multilingual: all the languages defined for the win-
resized (see ’Anchoring controls’, page 260, for more dow will be available for all the window’s controls. A
details). window can be associated with more languages than
• have a background image: this image is displayed in the project (case of windows shared among several
the window and controls are displayed on top of this projects). See the ’Applications and multilingual sites’
image. You can also define settings for resizing win- chapter, page 325, for more details.
dows through the 9-image mode (see next paragraph). • turn gray automatically when it becomes unaccessi-
• be clipped (WinDev only): the window will have a cus- ble. This feature is called DDW, which stands for Dim
tom shape (window in the shape of a circle, computer, Disabled Windows. See the ’Automatic dimmed win-
etc.). See the "Clipped window" paragraph, page 267, dow’ paragraph, page 267, for more details.
for more details. • authorize drag and drop operations (WinDev only).
• have a drop-down menu: this menu will allow users to See the ’Managing drag and drop operations’ chapter,
quickly access the application’s main features. To page 321, for more details about programming drag
create a drop-down menu in a window, use and drop operations.
"Windows .. Main menu .. Add the main menu". The Note: to force an action on a window, simply define an
first option is displayed in the window. The options can "Automatic execution" mode button in this window. See
be handled via the option popup menu. The menu the ’Automatic button execution’ paragraph, page 275,
options can be handled by programming then. for more details.
Tome1_2.book Page 253 Vendredi, 28. mai 2010 5:50 17

253

2.3 Window and image


2.3.1 Overview
Managing multilingual images
To optimize the style of your screens, WinDev allows you A different background image can be displayed accor-
to use:
ding to the runtime language of the program.
• background colors. Several standard colors can be
used. To define a multilingual background image:
• images in your windows. These images are used as 1. Click (to the right of the image’s name).
background image of the window. Your controls are 2. Choose the appropriate image for each language
superimposed over this image. defined in your window.
Attention: the display characteristics entered in this
2.3.2 Background colors window will apply to image files of each language.
To select the background color of a window: 3. Validate. The "Multilingual value" caption
1. Display the description window. appears in the definition control of the background
2. In the "Style" tab, open the "Background color" images.

Part 4: Managing controls, windows and pages


list. A list of available colors is displayed.
3. Select the requested background color. Display mode
4. Validate the description window. An image can be displayed in a window according to
Note: in WinDev, in the background color selection win- several display modes. These display modes produce dif-
dow, several gradient background colors are offered by ferent effects:
default. The "Other gradients" option lets you display the • 100%: the image is displayed 100% from the left cor-
settings of the gradient color. In this window, you can: ner of the image control.
• Select a gradient color offered by default. • Centered: the image is displayed 100% and is cente-
• Modify one of the gradient colors offered by default: red in the image control.
you can configure the colors, the number of colors • Stretched: the image is deformed so it occupies the
used in the gradient, and the angle of the gradient. Just entire space of the image control.
use your creativity. • Tiled: the image is displayed 100% and repeated so it
occupies the entire space of the control.
2.3.3 Background image • Homothetic: the image is proportionally enlarged so it
The image formats that can be displayed are as follows: fills the entire image control.
•WinDev: PCX, BMP, ICO (Windows icons), ICW (Win- • Homothetic extended: the image is proportionally
dows Hyper Screen icons), WMF (Windows Meta enlarged so that its smallest side is entirely displayed
File), JPEG, TIFF, GIF or ION. in the image control.
•WinDev Mobile: BMP, ICO, JPEG or GIF. • Homothetic centered: the image is homothetic and is
centered in the image control.
Note: to customize your windows, you can also use a skin
template or a window template. • Homothetic centered extended: the image is stretched
and centered in the image control.
2.3.4 Configuring the background image • Homothetic without increasing size: if the image can
The configuration is performed in the "Image" tab of the be entirely displayed in the window, it is displayed
window description. 100%. If the image is larger than the window, it is auto-
matically reduced proportionally in order to be dis-
You can select the background image with the radio but- played in full.
ton or select an image from the catalog.
• Homothetic centered without increasing size: the
You can also drag the image file found in the explorer and image is centered and homothetic without size
drop it into the WinDev or WinDev Mobile window . increase.
The options available for the image are: In homothetic mode, "High-Quality Display" enables you
•Managing multilingual images to improve the quality of the image when this one is redu-
•Display mode ced from its initial size.
•Position Position
•Transparency This parameter enables you to define the position of the
•Symmetry top left corner of the image in relation to the window sur-
•9-image mode face.
•Window clipping based on the background image These options will be stored even if the image is modified
Tome1_2.book Page 254 Vendredi, 28. mai 2010 5:50 17

254

by programming (Image property). 9-image mode


If this option is checked, the 9-image mode will be used
Transparency for the background image of the window.
The transparency options for the background image are The 9-image mode consists in dividing the background
as follows: image into 9 areas.
• Transparent magenta: the magenta color found in the For each area, you can define whether the section of the
image will be transparent when the image is displayed image corresponding to the area must be displayed or
in the editor or at run time. not (check the name of the area to display it). If the
Transparency: none Transparent magenta image section is not displayed, it will be replaced by the
background color of the window.
The margins allow you to define the size of each area.

• 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

These options will be stored even if the image is modified


by programming (Image property).
Symmetry
The symmetry options are used to change the orientation
of the image found in the image file. These options will be
stored even if the image is modified by programming
(Image property).
Initial image:

When resizing the window, only the areas 2, 4, 6, 8 and 5


The options are as follows: are resized to occupy the entire space:

Symmetry Symmetry Symmetry


vertical horizontal horizontal
and vertical

The 9-image mode enables you to manage the operating


mode of each area when the window is resized.
For each area:
• by repeating the image that makes up the area,
• by stretching the image that makes up the area.
Tome1_2.book Page 255 Vendredi, 28. mai 2010 5:50 17

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"

Part 4: Managing controls, windows and pages


…). combo box).
The shape of the window is defined by an image. In this 5. Validate the window’s description.

2.4 Use the Windows XP look and theme WD

WinDev enables you to customize: cription window).


• the windows and the controls found in these window by • If a background image is used, this image is kept.
using the theme of Windows XP. Otherwise, the corresponding XP theme (background
• the menus (main or popup menus) of the windows that color of the window) is applied.
use the XP style (feature available even if the current To force the use of the Windows XP theme on a window
computer is not running Windows XP). control:
1. Force the use of the Windows XP theme on the
2.4.1 Using the theme of Windows XP window to which the control belong (see paragraph
The theme of Windows XP corresponds to the characte- above).
ristics of the interface on a computer running Windows 2. Select the control you want.
XP. This theme is defined in the configuration panel of 3. Display the "Style" tab of this control’s descrip-
Windows. tion window ("Description" option of the popup
WinDev enables you to force the use of the Windows XP menu).
theme in the windows and in the controls found in these 4. If needed select the "Modify the control look"
windows. In this case, as soon as the application is ope- and confirm the dissociation between the control
ned on a computer running Windows XP, the theme of and the style sheet.
Windows XP defined on this computer will be applied. 5. Select "XP theme" in the "Element" combo box.
6. Check "Use the active theme in Windows XP/
Note: if the application is opened on a computer that is Vista".
using another operating system, the style settings (defi-
ned in the "Style" tab of the description window) will be XP theme: style characteristics kept
applied automatically. See the online help for more details about the style set-
tings that are kept.
To force the use of the Windows XP theme:
1. Open the window you want ("File .. Open") in 2.4.2 Using the XP style
WinDev. WinDev enables you to use the XP style on the menus
2. Display the "Style" tab of the current window’s (main and/or popup menus) found in the windows. To
description window ("Description" option of the view the menus in XP style, the current computer does
popup menu). not necessarily have to run Windows XP.
3. Select "Force the active theme in Windows XP/
Vista". In order for the main menu of a window to have the XP
look:
Notes: 1. Open the window you want ("File .. Open") in
• Windows that use the Windows XP theme keep their WinDev.
style settings (defined in the "Style" tab of the des-
Tome1_2.book Page 256 Vendredi, 28. mai 2010 5:50 17

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 The different types of windows WD


Part 4: Managing controls, windows and pages

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).

2.6 Modal management of a window


2.6.1 Overview 2.6.3 Minimizing a window
The window that opens another window is called parent
WD This feature is only available in Win-
window; the window opened by the parent window is cal-

Part 4: Managing controls, windows and pages


Dev.
led child window. In modal opening, a parent window can
only have a single child window.
If the window is minimized, the entire project is minimi-
This opening mode does not allow you to manage the zed. The icon used is the icon of the current window (or
multi-windowing. the icon of the project if the window has no icon).
With modal windows: A window can be minimized:
• The parent window and the child window cannot be in •using the Iconize function,
edit at the same time. The child window is the only win- •using the WinSize function.
dow that can be in edit.
• To edit in the parent window, the child window must be A window can be restored :
closed. •using the Restore function,
• The parent window cannot be closed as long as the •using the WinSize function.
child window is open.
• Once the child window is closed, the parent window 2.6.4 Current window
becomes the current window. The current window is the window that has focus, that is
• If the child window is minimized, the entire project is the window whose title bar is active and whose focus gain
minimized with the icon of the current window (or with code has been run.
the icon of the project if the window has no icon). The current window is always the last window opened.
You can only perform input in the current window.
2.6.2 Opening a window
Open opens a window in modal mode. 2.6.5 Closing a window
The last window opened is in edit. The other windows Windows are closed by the Close function. This function
cannot be in edit as long as the last window remains ope- used without specifying the name of the window to close
ned. will close the last window that was opened.
The child window is always displayed on top of the parent
window.

2.7 Non-modal management of a window


2.7.1 Overview When opening a non-modal child window:
The window that opens another window is called parent • The child window can be in edit at the same time as the
window; the windows opened by the parent window are parent window that opened it.
called child windows. All the child windows opened by • When a child window is closed, another child window
the same parent window are called sibling windows. becomes the current window. If there are no more child
This opening mode allows you to manage the multi-win- windows, the parent window becomes the current win-
dowing. dow.
Tome1_2.book Page 258 Vendredi, 28. mai 2010 5:50 17

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

• If the sibling window is minimized, the other windows


are not minimized. The icon of the window is the one of Opening a sibling window
the window (or the one of the project if the window has A sibling window is opened from a child window. These
no icon). child windows can have the following types:
• "MDI Child"
2.7.2 Opening a window • "Free"
Opening a parent window The opening mode of the window depends on the type of
the window.
A parent window is opened with the Open function.
"MDI child" type window (WinDev only)
Opening a child window
The MDIOpen function lets you open a "MDI child" type
A child window is opened from a MDI parent window. window in non-modal mode from a "MDI parent" window
These child windows can have the following types: or a "MDI child" window. The different child windows are
• "MDI Child" sibling windows.
• "Free" "Free" window opened as a sibling window.
The opening mode of the window depends on the type of OpenSister opens "Free" type windows in non-modal
the window. mode from a child window.
"MDI child" type window (WinDev only) When calling OpenSister, the following processes are
The MDIOpen function lets you open a "MDI child" type run:
window in non-modal mode from a "MDI parent" win- •Run the code for "declaring the global variables" of
dow. the sibling window.
When calling OpenChild, the following processes are run: •Running the initialization codes of the controls (the
•"declaration code of the global variables" of the win- order is undefined).
dow. •Run the processes following the call to OpenSister of
•Running the initialization codes of the controls (the the calling window.
order is undefined). •Displaying the sibling window.
•Displaying the window (this window is always a child Note: The MDI sibling windows are always opened in
window of the MDI parent window). the parent window (they cannot be displayed outside
Note: MDI child windows are always opened in the the parent window). The MDIWindowMenu function
parent window (they cannot be displayed outside of lets you arrange the display of the MDI child windows
the parent window). The MDIWindowMenu function opened in the MDI parent window (tiled or mosaic
lets you arrange the display of the MDI child windows display).
opened in the MDI parent window (tiled or mosaic ReturnToCapture is used to force input in the sibling win-
display). dow.
ReturnToCapture lets you force input in the child window. Important: a window can only be opened with OpenSis-
ter if the window requesting the opening has been ope-
"Free" window opened as a child window ned with OpenChild or OpenSister.
OpenChild lets you open "Free" type non-modal win-
Tome1_2.book Page 259 Vendredi, 28. mai 2010 5:50 17

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:

Part 4: Managing controls, windows and pages


OpenSister("CUSTOMER1=CUSTFILE") •using the Restore function,
// Load window and input •using the WinSize function.
// in the CUSTNAME control
ReturnToCapture("CUSTOMER1.CUSTNAME") 2.7.5 Current window
// Handle a control with alias Once a window is opened, the current window is not
WindowName is string modified.
WindowName = PreviousWindow() • CurrentWin returns the name of the window (or alias)
If WindowName.CustName = "" THEN where data is being entered.
// Customer name not entered
Error("No name has been entered")
• PreviousWin returns the name of the window (or alias)
ReturnToCapture(WindowName + …
where data was previously being entered.
".CUSTNAME") To change the window currently in edit:
END •either the user clicks another window,
•by programming, use ReturnToCapture to force input
2.7.3 Overlaying windows in the window whose name is passed as a parameter
After its opening, a child window is displayed "on top" of (the window must have a least one edit control).
the parent window and a sibling window is displayed "on The MDIActive function returns the name of the child MDI
top" of the window before the last sibling window. window that is in the foreground.
To specify that the open window is displayed: 2.7.6 Closing a child window or a sibling win-
• On top of all the windows (even inactive ones), even dow
the ones from other current Windows applications, you
need to use the AboveAll parameter (OpenChild, Child windows and sibling windows are closed by Close.
OpenSister or WinStatus functions). After closing a child window, one of its siblings becomes
• On top pf all its siblings (even inactive ones), you need active. If there is no sibling window, the parent window
to use the Above parameter (OpenChild, OpenSister or becomes active.
WinStatus functions). After closing a sibling window, another sibling windows
becomes the current window.
2.7.4 Minimizing a window If the parent window is closed, its child windows are
WD This feature is only available in Win- closed. If a child window refuses to close, the closing
Dev. action is stopped: the sibling windows following the child
window are not closed, nor the parent window; the child
"Free" window opened with OpenChild or OpenSister windows that were closed remain closed.
If the window is minimized, the other windows are not To prevent a (non MDI) child window from closing, you
minimized. The icon used is the one of the window (or the need to add the following line in the child window’s clo-
one of the project if the window has no associated icon). sing code:
// ControlName:child window control
When minimized, a (non-MDI) child window goes into the
ReturnToCapture(ControlName)
Windows 95 taskbar. The window icon "floats".
MDI parent window
Tome1_2.book Page 260 Vendredi, 28. mai 2010 5:50 17

260

or combination and enter this button’s code:


// WindowName: child window name ReturnToCapture()
ReturnToCapture(WindowName) MDIWindowMenu lets you close all the open MDI child
To prevent an MDI child window from closing, you need windows.
to create a button associated with the [ALT] + [F4] key

2.8 Maximized and non-maximized window WD Mobile

Two types of windows can be created in WinDev Mobile: ton" process.


• Maximized window: Window taking up the entire screen • execution of the code of the "Validate" button found in
on the Pocket PC the window (if this button exists). If the window con-
• Non-maximized window: A non-maximized window can tains no "Validate" button, the window is closed.
be resized by the user and occupy part of the screen Note: if the "Before closing with OK/Close button" pro-
only. cess calls ReturnToCapture, the window will not be
Part 4: Managing controls, windows and pages

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":

• in the "Style" tab of the window description


2. Top bar
The top bar created by the wizard corresponds to a Shape
control. This control can be deleted from the window at
any time. This bar is used to display information (title,
current directory, and so on), buttons, ….

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,

Part 4: Managing controls, windows and pages


…. Operating mode of the OK button:
WinDev Mobile allows you to configure all these elements • execution of the "Before closing with OK/Close but-
in your windows for Pocket PC. ton" process.
The display of the title bar and the display of the toolbar • execution of the "Validation" type button found in the
are configured in the "Details" tab of the window des- window (if there is such a button). If the window con-
cription. tains no "Validate" button, the window is closed.
Note: if the "Before closing with OK/Close button" pro-
cess calls ReturnToCapture, the window will not be
closed.
The type of the button can be changed at any time in the
editor:
• via the popup menu of the button:

This size is defined:


• by the size options (display of the toolbar, …)
• According to the chosen runtime platform.
Note: this size is shown by a dotted line in the window
editor. • in the "Style" tab of the window description
The display of the status bar is configured in the "Style" • by programming (WinSystemButton)
tab of the window description (or via "Window .. Status
bar .. With status bar". 3. Type of border
In a non-maximized window, the type of window border is
visible. You can choose a simple border, a double border
2.8.2 Non-maximized window or no border.
A non-maximized window can be resized by the user and These parameters can be modified at any time in the
it may occupy part of the screen only. Different options "Style" tab of the window description.
can be configured in the window creation wizard ("File ..
New .. Window .. Wizard for creating blank windows"). Note: if no frame is selected, the window will not have any
title bar, nor OK/Close button. It will not be resizable.
Characteristics 4. Move by the background
1. Title bar If this option is selected, the user will be able to move the
window by clicking the window and by keeping the mouse
The status bar is used to display the title of the window as button (or the stylus) down during the move.
well as the Close and OK buttons for instance.
If the title bar is not visible, the window must contain the 5. Size at opening
buttons required to close the window. This parameter corresponds to the size of the window
The presence of the title bar can be configured at any when it is displayed.
Tome1_2.book Page 262 Vendredi, 28. mai 2010 5:50 17

262

The size of the window (as well as its position) can be


modified at any time in the "Details" tab of the window Buttons of a non-maximized window
description. When a non-maximized window is created (wizard), you
have the ability to choose the buttons that will be inser-
6. Resizable ted into this window.
A non-maximized window can be resized. To do so, a dou- In this case, the selected buttons (and their code) are
ble border must be used (otherwise, the window cannot automatically added to the window. Depending on the
be resized). type of the requested button, the button’s click code
You can configure whether a window can be resized in the returns a boolean (Yes for the "OK" button, No for the
"Style" tab of the window description. You also have the "Cancel" or "Abort" button). This return value can be
ability to define the maximum width and the minimum processed by Open.
width of the window.

2.9 Automatic execution of a button


Part 4: Managing controls, windows and pages

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.

2.10 Opening a "popup" window


2.10.1 Overview For example:
WinDev and WinDev Mobile allow you to create "popup"
type windows.
A popup window is a small-size window that opens on top
of the current window. Usually this window allows the end
user to make a selection. This window returns to the main
window the value selected by the end user. This window is
automatically closed as soon as a left click is performed Note: here are the characteristics of a popup window:
(inside the popup window or not). •opened by default under the control that called it (if
there is not enough space under the control, can
open to the left or above of the control).
The opening position can be changed from your pro-
gram.
•automatically closes as soon as the window loses
focus or the Close function is called.
Tome1_2.book Page 263 Vendredi, 28. mai 2010 5:50 17

263

•only the closing icon appears in the window’s title bar


(if defined in the style). --Click code of button
--"SelectColor"
2.10.2 Programming a popup window // The "Color" variable corresponds to
The following example opens the "PopupWin" popup // the color selected by
window when clicking the "SelectColor" button. This win- // the user
dow allows the user to select the font color to use in the Color is int = 0
"TextInfo" control. // Open the "PopupWin" window
// and retrieve the color
// selected
Color = OpenPopup(PopupWin)
// Selected color ?
IF Color > 0 THEN
// Change the font
// color
InfoText..Color = Color

Part 4: Managing controls, windows and pages


END
Note: the MyPopupControl keyword lets you handle the
control that opened a popup window. See ’MyPoppup-
Control’, page 229, for more details.

2.11 Dim the disabled windows WD

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:

A window asks you to confirm or cancel


these modifications. The main window (in the bac-
kground)
has become disabled. They are dimmed
automatically. You immediately know which window must
be used.

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

(excluding the windows whose corresponding option is


unchecked). If a problem occurs, ask the end users to update the dri-
ver of their video card.
2.11.3 DDW on a specific window Note: to work, the end-user computer must:
By default, the DDW feature is enabled for all the applica- • have a display mode greater than 256 colors.
tion windows. • be in 32-bit mode.
To enable the DDW feature for a specific window: • be running Windows 2000 or later.
1. Open the window for which the DDW feature must • use the maximum level of "Hardware Acceleration" for
be enabled. the video card (advanced display properties of the
2. Display the "GUI" tab of the window description computer).
("Description" from the popup menu).
3. Select "Gray the window when it is disabled" and

2.12 Internal window WD WM

2.12.1 Overview communicate with the window in which it is included


Internal windows are used to dynamically share some for instance.
part of the interface within one or more applications. • Retrieving the ..Value property:
The interface piece to reuse is created in an "Internal This process allows you to retrieve a value passed to
window" type window. the internal window. This process allows the internal
window to communicate with the window in which it is
This interface is used in the different windows of your included for instance.
application through the "Internal window" type control.
Note: the window to merge can come from a component. 2.12.3 Creating an internal window
To create an internal window:
2.12.2 Characteristics of an internal window 1. Select "File .. New .. Window".
Internal windows have no title bar and nor status bar. 2. Click the "Internal Window" tab. Select "Blank"
However, they can manage a HyperFileSQL context that is as well as the skin template used and validate.
independent from the host window’s one ("Details" tab 3. The internal window is automatically created. You
of the description window). can create the controls you need in this window.
Furthermore, the skin template of the host window can To create an internal window control:
also be applied to the internal window ("GUI" tab of the 1. Select "Insert .. Special .. Internal window".
description window). 2. Move the control to the position you want.
Internal windows also have two specific processes: 3. In the "General" tab of the control description,
• Assigning the ..Value property: specify the internal window to use (you can also
This process enables you to give a value to the internal directly create an internal window).
window. This process allows the internal window to
Tome1_2.book Page 265 Vendredi, 28. mai 2010 5:50 17

265

2.13 Window templates WD WM

2.13.1 Overview the window template.


WinDev and WinDev Mobile allow you to create window 3. Keep the code of the processes required by the
templates. These templates contain all the graphic ele- template. These processes will be automatically
ments and the code common to all the windows of your imported into the windows that use the template.
application. 4. Give a name to your window ("General" tab of the
description window).
The modifications performed in a window template are 5. Select "File .. Save as template". The window
automatically applied to all the windows that use this becomes a template:
template.
•its name is preceded by "Template".
A window template enables you to comply with the style
book defined for an application. •a green border appears around the window in the
window editor.
Using window templates in your applications enables you
to: •the window template is displayed in the "Project"
pane ("Window templates").

Part 4: Managing controls, windows and pages


• simplify the creation of the application windows.
•The window template corresponds to a file with a
• simplify the layout of the application windows. ".WDT" extension.
• simplify the update of the style book defined for the
application. 2.13.3 Applying a window template
To create a new window based on a window template:
2.13.2 Creating a window template 1. Create a new window ("File .. New .. Window").
To create a window template: 2. In the wizard, select the "Based on a template"
1. Create a new window template ("File .. New .. pane.
Window template"). 3. Choose your template from the list of available
If your project already uses a skin template, the win- templates.
dow template can be created from the skin template 4. Validate. The new window is displayed in the edi-
of the project. tor. A yellow square is used to identify the elements
The window editor displays a new window inside a belonging to the window template. These elements
green border named "Window template". can be modified:
2. Create all the necessary controls. These controls •in the window template: the modification will apply to
will be included in all the windows that use the tem- all the windows using this template.
plate.
3. Enter (if necessary): •in the window, with the "control overload" mecha-
nism: the modification will only apply to the window.
•the processes associated with the window.
•the processes associated with the controls found To apply a template to an existing window:
in the template. 1. Display the window in the window editor.
These processes will be automatically imported 2. Select "Insert .. A window template".
into the windows that use the template. 3. Select the window template to apply.
4. Give a name to your template ("General" tab of 4. Validate.
the description window). 5. Specify whether you want to update the proper-
5. Select "File .. Save". The window template cor- ties of the window from the template. If you answer
responds to a file with a ".WDT" extension. Yes, all the characteristics of the window (size, posi-
tion, border, and so on) will be automatically linked
To create a window template from an existing window: to the template.
1. Open the window chosen as template. See the online help for more details.
2. Keep the controls required by the template. These
controls will be included in all the windows that use

2.14 User Macro-Code: UMC WD

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 Managing the HyperFileSQL contexts in windows


Part 4: Managing controls, windows and pages

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

The "Independent HyperFileSQL Context" option is nor • Do:


currently supported in WinDev for the following databa- If SQLExec("Query1") THEN
ses: SQLFirst("Query1")
• Informix Open(Result_Win)
• DB2 END
• MySQL
2.15.3 HyperFileSQL contexts and windows
• Progress
To manage (or not) the independent HyperFileSQL con-
• xBase text of a window:
• Any database via OLE DB 1. Display the window description.
Transactions and independent HyperFileSQL context. 2. Display the "Details" tab.
3. Check (or not) the "Independent Hyper File Con-
When copying a context, if a transaction is in progress on text&quot option.
the first context, the new context is not in transaction.
HTransactionStart must be called to start a transaction If the HyperFileSQL contexts are not independent for
in the new context. each window (option not checked)

Part 4: Managing controls, windows and pages


Whenever a window is opened, the HyperFileSQL context
Limitations: RPC and independent HyperFileSQL context
is updated according to the operations performed in the
The access to a HyperFileSQL file via RPC is not allowed window.
from a window or from a report with an independent con-
text. All the windows work with the same HyperFileSQL con-
text.
You must disable "Independent HyperFileSQL context"
If the same window is opened several times in parallel in
To disable this option in a window: clear the "Indepen- the application, the HyperFileSQL contexts may overlap
dent HyperFileSQL Contexts" option in the "Details" tab and the data used may not be the expected data.
of the description window.
In an application that uses remote access, if indepen- If the HyperFileSQL contexts are independent for each
dent contexts must be used, they must be programmed window (option checked)
with HSavePosition and HRestorePosition. The current HyperFileSQL context is entirely copied whe-
Limitation: independent HyperFileSQL context and use never a new window is opened. This allows you to perform
of an ODBC driver: different operations (filters, sorts, searches) on the same
Caution: the query will be duplicated only if the context file, in windows opened in parallel. Each window has its
copy (opening of the window or report) is performed own context. There is no risk of mixing up data.
AFTER having initialized the reading of the result with the Each HyperFileSQL context is independent, you can
SQLFirst function. manage records locking in each context. Closing a win-
dow that has an independent context will automatically
• Not to do;
unlock the records locked by this window and will close
If SQLExec("Query1") THEN the corresponding context.
Open(Result_Win)
END
Furthermore, the use of a HyperFileSQL function in one
context will only affect this context. This way, if memo
management is enabled when the independent contexts
are opened, you can disable this feature in a window: the
Tome1_2.book Page 268 Vendredi, 28. mai 2010 5:50 17

268

2.16 Processes associated with the windows


2.16.1 Processes managed by default
WinDev manages the following processes by default (in
the order in which they appear in the code editor):
Process Runtime conditions
Declaring the global Declaring the variables global to the window
variables
Initialization Run when the window is opened, before focus is set. The initialization process of the win-
dow’s controls is executed after this code.
Closing Run when the window is closed. Note: resuming input in one of the window’s controls in this
code prevents the window from closing.
Part 4: Managing controls, windows and pages

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

Resizing Run in the following cases:


- minimizing the window,
- enlarging or resizing the window,
- restoring the window once it was minimized.
Whenever modified Run when one of the window controls is modified (input performed by the user for instance)
Assigning the ..Value Run when using the Value property to assign a value to an Internal window control.
property (internal win-
dow only)
Retrieving the ..Value Run when using the Value property to read a value from an Internal window control.
property (internal win-
dow only)

2.16.2 Optional processes You have the ability to manage:

Part 4: Managing controls, windows and pages


Several optional processes can be managed. •the rollover of the control by the mouse,
To manage an optional process, all you have to do is •pressing, releasing or double-clicking the left mouse
select it in the icon bar of the code window. button,
•the right mouse button down, up, with a double click,
•the mouse wheel, …

2.17 Properties associated with windows


The following properties are associated with windows: MouseCursor Enables you to find out and modify
DisplayEnabled Enables you to find out whether the rollover cursor defined for a
the refresh of the display is ena- window
bled for a control or window and to MoveableByBac- Enables you to find out whether a
enable or disable the refresh of the kground window can be moved by its bac-
control or window kground and to make the window
Alias Enables you to find out and modify movable (or not) by its background
the alias of a window State Enables you to find out and modify
StatusBar Enables you to find out whether a the display status of a window
window status bar is visible and to InitialState Enables you to find out the initial
make the status bar of a window status of a window
visible/invisible Height Enables you to find out and modify
RightClick Enables you to find out and modify the height of a window
the name of the button that will be InitialHeight Enables you to find out the initial
run when a right click is performed height of a window
on an object
MaxHeight Enables you to find out and modify
CompactToolbar Enables you to find out whether the maximum height of a window
the toolbars of the window are
compacted and to compact (or MinHeight Enables you to find out and modify
not) the toolbars. the minimum height of a window
Color Enables you to find out and modify Image Enables you to find out and modify
the color of the icon bar for an MDI image of the toolbar of a "MDI
parent window Parent" type window
BrushColor Enables you to find out and modify BackgroundImage Enables you to find out and modify
the background color of the client the background image associated
area of the window (the window is with a window
not a "MDI parent" window)
Tome1_2.book Page 270 Vendredi, 28. mai 2010 5:50 17

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

area Value Enables you to find out and modify


MDIRight Enables you to find out and modify the value of a window
the distance between the right bor-
ReturnedValue Enables you to find out and modify
der of the MDI parent window and
the value returned by a window
the border border of the MDI area
Visible Enables you to find out whether a
MDILeft Enables you to find out and modify window is visible and to make the it
the distance between the left bor-
visible/invisible
der of the MDI parent window and
the left border of the MDI area InitialVisible Enables you to find out whether a
window was visible when created
MDITop Enables you to find out and modify
the distance between the top bor- X Enables you to find out and modify
der of the MDI parent window and the x-coordinate of a window
the top border of the MDI area XInitial Enables you to find out and modify
PopupMenu Enables you to find out and modify the initial X coordinate of a window
the popup menu associated with a Y Enables you to find out and modify
window the Y coordinate of a window
Modified Enables you to find out whether a YInitial Enables you to find out and modify
window control was modified by the initial Y coordinate of a window
the user (with the keyboard or with
the mouse) See the online help for more details.
Name Enables you to find out the name See the online help to check the availability of these pro-
of a window perties in the different products (WinDev, WinDev
Note Enables you to find out and modify Mobile).
the notes associated with a win-
dow
Opacity Enables you to find out and modify
the opacity level of a window
Tome1_2.book Page 271 Vendredi, 28. mai 2010 5:50 17

271

2.18 Functions for managing the windows


Functions used to manage windows are as follows:
Abandon Closes the window and possibly runs the code of the "ABORT" button
AddVoiceCommand Adds a voice command to the current window
ChangeSourceWindow Dynamically changes the window displayed in an Internal Window control
ChangeSkinTemplate Changes the skin template of a window.
DelayBeforeClosing Limits the display time of a window (when the specified amount time has passed, the code
of one of the window’s buttons is executed)
DisableAAF Disables an Automatic Application Feature (AAF) for a control, for a window or for the current
application.
EnumElement Lists the windows of a project
EnumMenu Returns the name of the Nth menu option of a window or the name of a sub-menu of the
main menu of a window

Part 4: Managing controls, windows and pages


EnumSubElement Listss the groups or the menus of a window.
ExecuteAAF Runs an Automatic Application Feature (AAF) on a control or on a window.
WinActivateDDW Enables or disables the DDW feature
WinAdaptSize Adapts the size of the window according to the content of the controls. The window is resized
in order for the controls to be displayed in the best possible way (no empty row and no scroll-
bar)
WinAnimationClosing Modifies the type and duration of the animation used when closing the application windows
WinAnimationOpening Modifies the type and duration of the animation used when opening the application windows
WinAnimationNext Modifies the type and duration of the next window animation
WinChangeAlias Modifies the alias of a window
WinDisableEffect Disables the visual effects of the graphic engine of WinDev. This function allows an applica-
tion to be run on a computer with limited graphic capabilities or to be run in TSE mode if the
bandwidth is limited.
CurrentWin Identifies the window currently in edit
WinInput Identifies the window containing the WLanguage code currently running
WinStatus Identifies or modifies the status of a window
WinOutHeight Returns the full height of a window
WinOutWidth Returns the full width of a window
WinOutXPos Returns the horizontal position of a window in relation to the top left corner of the screen
WinOutYPos Returns the vertical position of a window in relation to the top left corner of the screen
WinInactiveEffect Enables or disables the DDW feature
WinIconBarHeight Returns or modifies the current height of the "Icon Bar" area in the current MDI parent win-
dow
WinBackgroundImage Modifies the background image of a window and specifies the display mode of this image
WinInHeight Returns the internal height of a window
WinInWidth Returns the internal width of a window
WinInXPos Returns the horizontal position of the inside area of a window in relation to the top left corner
of the screen
WinInYPos Returns the vertical position of the inside area of a window in relation to the top left corner of
the screen
PreviousWin Identifies the window that was in edit before the window that is currently in edit
WinScreenRectangle Returns the coordinates of the screen that contains a window.
WinRedraw Immediately redraws the window controls that must be graphically refreshed
WinSize Returns or modifies the display mode (maximized, minimized and normal) of a window,
modifies the height and/or the width of a window, moves a window and modifies its height
and/or width
Tome1_2.book Page 272 Vendredi, 28. mai 2010 5:50 17

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

OpenPopup Opens a popup window


OpenPopupPosition Opens a popup window at the specified location
OpenSister Opens a non-modal sibling window
RESET Re-initializes the controls of the current window.
Restore Displays a WinDev window in its initial size
DrawingStyle Enables you to find out and modify the display mode of the grayed buttons in your applica-
tion’s windows as well as the display mode of the transparent frame around your applica-
tion’s windows.
DeleteVoiceCommand Deletes a voice command previously added by AddVoiceCommand.
CurrentTitle Modifies the title and the title bar of the current window (returned by CurrentWin)
NextTitle Modifies the title of the next window to open
Use Opens a WinDev window and closes all the other windows that were previously opened
For more details about these functions, and to find out the availability of these functions in the different products (Win-
Dev, WinDev Mobile), see the online help.

2.19 MDI functions


The functions used to manage MDI windows are as follows:
MDIActive Identifies or activates an MDI child window in the foreground
MDIEnumChild Returns the alias of the specified MDI child window
MDIWindowMenu Modifies the layout of the MDI child windows
MDIMother Identifies the name of the MDI parent window
MDIOpen Opens an MDI child window
See the online help for more details about these functions.
These functions are only available in WinDev.
Tome1_2.book Page 273 Vendredi, 28. mai 2010 5:50 17

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, …

Part 4: Managing controls, windows and pages


To create a page: To display the characteristics of the page, select "Des-
1. Select "File .. New .. Page". The wizard for page cription" from the popup menu of the page.
creation starts.

3.2 Main characteristics of a page


A page can accept any available control type. ’Handling the menu options by programming’, page
A page can: 312, for more details.
• have a background image: this image is displayed in • have a toolbar: this toolbar will display the help messa-
the page and controls are displayed on top of this ges associated with the different controls of the page.
image. See the online help for more details.
• have a drop-down menu: this menu will allow users to • be multilingual: all the languages defined for the page
quickly access the site’s main features. To create a will be available for all the page’s controls. A page can
drop-down menu in a page use "Insert .. Menu". The be associated with more languages than the project
first two options are displayed in the page. The options (case of pages shared among several projects for ins-
can be handled via the option popup menu. The menu tance). See the ’Applications and multilingual sites’
options can be handled by programming then. See chapter, page 325, for more details.

3.3 The different types of pages


When creating a page, WebDev offers several types of
pages:
• static pages
• semi-dynamic pages
• dynamic pages
• PHP pages

3.3.1 Static pages


A static page is used to display text and images but the
Web user cannot "interact" with them. If you want to dis-
play information about several products, this information
must be entered directly in the static pages.
In most cases, this type of page is used to present a com-
pany and to propose "standard" information that will not
change over time.
Tome1_2.book Page 274 Vendredi, 28. mai 2010 5:50 17

274

This type of page can be used for a Web site or a site on a •…


CD ROM.
WebDev enables you to build the HTML page’s structure.
3.3.2 Semi-dynamic pages This structure will be installed on the server computer
and will be dynamically filled according to the informa-
Semi-dynamic pages let you generate static pages from tion found in the database.
an existing database on the development computer.
For instance, to display information about several pro-
These "static" pages are created automatically by Web- ducts, a single dynamic page is all you need: when a pro-
Dev. duct is selected, the page will display the product details.
Part 4: Managing controls, windows and pages

WebDev lets you build on the development computer the


structure of the HTML pages, then generate the needed
static HTML pages according to the database’s content
(1). The generated pages are installed then on the site
(2) and displayed according to the web users’ needs (3 When the web user requests a page (1), the WebDev
and 4). engine queries the database (2) and dynamically builds
Note: these pages can be installed on a web server as an HTML page (3) using the data and the page’s struc-
well as on a CD ROM. This way you can create a CD ROM ture. The dynamic page is displayed in the user’s browser
for a product catalog without providing the corresponding then (4).
database.
3.3.4 PHP pages
3.3.3 Dynamic pages PHP pages are pages that can be used in a PHP site.
A dynamic page allows you to: These pages require a PHP engine to be executed.
• display data found in a database installed on the ser- See the online help for more details.
ver,
• display images and interactive text,

3.4 The page templates


3.4.1 Overview will be included in all the pages that use the page
WebDev allows you to create page templates. These tem- template.
plates contain all the graphic elements common to all 3. Enter (if necessary) the processes associated
the pages of your site. with the page controls.
4. Give a name to your page ("General" tab of the
The modifications performed in a page template are page description window).
automatically applied to all the pages that use this tem- 5. Select "File .. Save as template". The current
plate. page becomes a template:
A page template enables you to comply with the style •its name is preceded by "Template".
book defined for a site.
•a yellow border appears around the page in the
3.4.2 Creating a page template page editor.
To create a page template: The page template is displayed in the "Project" pane
1. Create a new page. ("Templates").
2. Create all the necessary controls. These controls
Tome1_2.book Page 275 Vendredi, 28. mai 2010 5:50 17

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.

Part 4: Managing controls, windows and pages


A yellow square is used to identify the elements • from the template, with "Page .. Refresh the associa-
ted pages".
belonging to the page template. These elements can
be modified only in the page template. • from any page that use the template, via "Page ..
Refresh from the templates".
See the online help (keyword:"Page template") for more
details.

3.5 Page with parameters


3.5.1 Passing parameters to a page when it is // It contains the value of
opened // sSelDate
To pass parameters to a page when it is opened: DateControl = sSelDate
1. Declare a procedure at the beginning of the
"Declarations of global variables" process of the 2. Pass the parameter expected by the page when it
page. The name of this procedure and the name of is opened (PageDisplay, PageUse, …).
the page must be identical. The parameters of this For example, the CALENDARSEL button lets you open
procedure correspond to the parameters that must the CALENDARPAGE page. When this page is ope-
be passed to the page. ned, today’s date is passed in parameter.
For example, the CALENDARPAGE page is used to -- Click code of button
manage the selection of a date in a calendar. This -- CALENDARSEL --
page expects a parameter indicating the date to // Open the CalendarPAGE page
select: // Pass today’s date as
-- Global declarations of // parameter
-- CALENDARPAGE PageDisplay(CalendarPAGE, …
PROCEDURE CalendarPage (sSelDate) Today())
// - sSelDate: date specifying the
// date to select. 3.5.2 Parameters passed by value
This parameter can be handled from any process of If the parameters passed to a page are modified in this
the page (button, local procedures, …). page, these modifications will be taken into account in
For example, in the "Initialization" process of the this page only. The value of these parameters is not modi-
CALENDARPAGE page: fied in the calling process.
For example:
-- Initialization of CALENDARPAGE 1. The MyDate variable is declared in the code of the
// DateControl is an CALENDARSEL button. This variable contains today’s
// edit control date (for example: MyDate = Today()).
Tome1_2.book Page 276 Vendredi, 28. mai 2010 5:50 17

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

3.6 Refreshing a dynamic page


3.6.1 Overview 3.6.2 Implementation
Refreshing a page consists in re-displaying a page To refresh a page, use PageRefresh.
already open in the browser. This action is identical to the
use of the "Refresh" button in the browser. When refreshing a page, the following operations are per-
formed automatically:
When refreshing a page, the dynamic data found in the 1. Check the existence of the page’s context on the
page are updates based on the page’s context found on server.
the server. Only the modified data is redisplayed. 2. Redisplay the page using its context on the server.
For example, when entering an order in a sales applica-
tion, for each new item ordered the page containing the Using PageDisplay to refresh a page is not recommended
order summary (aka basket) is refreshed. because it takes longer to load the page.

3.7 The contexts of pages


3.7.1 Overview 3.7.2 Operating mode
In a Windows application, the information about a win-
dow is kept with the window. Automatic management
In a dynamic WebDev site, a context page exists on the By default, WebDev automatically manages the contexts
server for each page displayed in the browser of the Web of dynamic pages:
user. • A page context is opened when the dynamic page is
The page context groups the information relative to the displayed in the browser.
page: • The context of a page is updated according to the infor-
• content of the controls, mation entered by the Web user in the browser. This
• local variables, update is performed during the validation of the page
• global variables, (via a "Submit" button or with the PageSubmit func-
tion).
• WLanguage "server" code, …
• The existing page contexts are closed when using
PageUse or FramesetUse. The page contexts corres-
ponding to the pages to display are opened then.
Tome1_2.book Page 277 Vendredi, 28. mai 2010 5:50 17

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.

3.8 Open a page in a WebDev site

Part 4: Managing controls, windows and pages


3.8.1 Overview • PageRefresh
Opening a new page in a WebDev site can be accom- Refreshes the page displayed in relation to its context.
plished in several ways: • PageDisplay
• from the description of the control that must open the Opens and displays a new page in the browser of the
page (button, link, menu, clickable image, …) Web user.
• by programming in WLanguage • PageUse
Closes all the current pages and their context, and
3.8.2 Opening a page from a control descrip- opens a new page.
tion When opening the page, you have the ability to pass
When describing a button, a link, a clickable image, ... parameters to the page. See ’Page with parameters’,
you have the ability to define the action performed as page 288, for more details.
well as the destination of this action. Note: by default, when opening a page by programming,
To open a page "xxx" directly from a button, link, image, the chosen destination is:
…: • the destination defined in the description of the object
1. Display the description of the element ("Descrip- that starts the opening of the page (button, link, …).
tion" from the popup menu of the element). • the destination defined for the current page.
2. Select the action to perform: "Display page xxx".
3. Select the destination of the action: current page, 3.8.4 Case of the dynamic pages
current browser, … (specific frame in the case of a When displaying a dynamic page, the following actions
frameset). The action that was previously selected are performed:
will be performed in this frame. 1. Check the existence of the page’s context on the
4. Validate. server.
2. If the context exists, it is closed.
3.8.3 Opening a page by programming 3. Open the page’s context. All the variables, con-
Several WLanguage functions can be used to open a trols, ... linked to the page are re-initialized.
page. 4. Display the requested page in the browser.

3.9 Validate a page from a control with no action


3.9.1 Overview 3.9.2 Principle
By default, the page validation must be performed via a PageSubmitlets you validate a page through a button
"Send Control Values to Server" type button. (visible or not) whose server click code only is run. When
To validate a page when selecting an element from a list using PageSubmit, the following processes are run:
box, a combo box, a check box or a radio button, use • Sending the data to the server.
PageSubmit. • Server click code of the button.
Tome1_2.book Page 278 Vendredi, 28. mai 2010 5:50 17

278

3.9.3 Implementation The code of the list is as follows:


To validate a page from a control without any action (list, -- Initialization of the CONTINENT
combo box, check box, etc.): list
1. Create a new button in the page: this dynamic ListAdd("CONTINENT",…
button can be of any type, visible or not. This button "Africa"+CR+…
is used to start the validation of the page. Only the "America"+CR+"Asia"+CR+…
server click code of this button will be run. "Europe"+CR+"Antartica")
2. In the modification code of the control with no
action, use PageSubmit, and specify: -- Modification and exit (onchange)
•the page to validate if necessary. -- from the CONTINENT list
•the name of the button used for the validation PageSubmit("","Button1")
(created in step 1). The code of the button is as follows:
•the frame containing the result of the button action
-- Click on the BUTTON1 button
(for a frameset for instance).
-- (server code)
Part 4: Managing controls, windows and pages

3.9.4 Example info("Selection: "+…


continent[continent])
The selection of an element in the CONTINENT list dis-
plays the selected element in a dialog box.

3.10 Processes associated with the pages


3.10.1 Processes managed by default
WebDev manages the following processes by default (in Synchronizing the Server code used to manage the synchroni-
the order in which they appear in the code editor): page (Server zation of the page when using the browser
code) "BACK" key. See ’Managing the "Back"
Process Runtime conditions button’, page 285, for more details.
Declaring the glo- Declaring the variables global to the page. Closing the page Run when the page is closed.
bal variables This code is the first code run when the (Server code)
(Server code) page is opened.

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

3.11 Properties associated with pages


The following properties are associated with pages: Title Enables you to find out and modify
Alias Enables you to find out the internal the title of a page
HTML/JavaScript name of a page NoteTitle Enables you to find out and
BrushColor Enables you to find out and modify modify the title of the notes used
the background color of the page in the program documentation of
Description Enables you to find out and modify a page
the description associated with a Type Enables you to find out the type of
page. an object
BrowsedFile Enables you to find out and modify Value Enables you to find out and
the file or query associated with modify the title of a page
the page (semi-dynamic page) InitialValue Enables you to find out the initial
Caption Enables you to find out and modify title of a page

Part 4: Managing controls, windows and pages


the title of a page
Visible Enables you to find out whether a
Name Enables you to find out the name
page is visible and to make it visi-
of a page ble/invisible
Note Enables you to find out and modify See the online help for more details.
the notes associated with a page
(used in the program documenta- See the online help to check the availability of these pro-
tion) perties for the different types of code (server code, brow-
ser code).
BrowsedItem Enables you to find out and modify
the search item associated with a
page (semi-dynamic page)

3.12 Functions for managing the pages


The following functions are used to manage pages:
CancelAWPContext Deletes from the AWP context a variable added by DeclareAWPContext.
CellDisplayDialog Displays a cell in a page with a DDW effect (Dim Disabled Windows). This function is
used to easily simulate a dialog box in browser code.
CellCloseDialog Masks a cell displayed in the page via CellDisplayDialog.
ChangeAction Enables you to specify the action to perform when the HTML page displayed in the brow-
ser becomes out-of-sync with the page context on the server
ChangeTarget Changes by programming the target frame of the current page after the execution of a
button click
ConfigureAWPContext Defines the operating mode of the AWP contexts.
ContextExist Enables you to find out whether a page context exists on server (that is whether the
page has been opened)
ContextClose Closes a page context
ContextOpen Opens a new page context without returning the information to the browser
DeclareAWPContext Enables you to declare a list of variables whose value will be persistent between the
successive displays of AWP pages.
Enumcontrol Enumerates the controls in a page.
EnumSubElement Enumerates the sub-elements of a page
FramesetRefresh Refreshes a frameset displayed in the browser of the Web user from the context found
on the server
Tome1_2.book Page 280 Vendredi, 28. mai 2010 5:50 17

280

FramesetDisplay Displays a frameset in the browser of the Web user


FramesetUse Displays a WebDev frameset in the browser of the Web user and closes all the current
page contexts and frameset contexts
IdentifierAWPContext Returns the identifier of the AWP context. This identifier can be used to build an URL for
instance.
PageActivateDDW Enables or disables the DDW (Dim Disabled Window) when displaying a modal page
(the pages used to communicate with the user for instance).
PageRefresh Refreshes a page displayed in the browser of the Web user from the context found on
the server
PageAddress Enables you to find out the Internet address of a WebDev page
PageDisplay Displays a page in the browser of the Web user
Displays a static page (created by WebDev) in the browser of the Web user from a dyna-
mic or static WebDev page
PageDisplayDialog Displays a page in a modal mode. This function allows you to create a dialog with the
user. The page is displayed in the foreground while the opening page is displayed in the
Part 4: Managing controls, windows and pages

background, grayed by the DDW mechanism.


CurrentPage Returns the name of the page containing the WLanguage code currently running.
PageExist Checks whether the specified page is currently displayed in the browser of the Web user
PageCloseDialog Closes the current page. This page was opened by PageDisplayDialog. A return value
can be sent back to the calling page.
PageInitialization Resets (or not) the controls found in the current page and runs the initialization proces-
ses of the controls
PageParameter Returns the value of a parameter passed to the current page
PagePosition Scrolls a page up to position a control in the visible part of the page (top) in the browser
PreviousPage Returns the name of the previous page
SemiDynamicPageDisplay Displays a semi-dynamic page in the browser of the Web user from a dynamic or static
WebDev page
PageRateDDW Defines and returns the rate of gray used by the DDW.
PageUse Displays a WebDev page in the browser of the Web user and closes all the current page
contexts
PageSubmit Validates the specified page and starts the execution of a button
PageToASP Sends the data found in a page currently displayed in the browser to an ASP server
PageToEmail Emails the data found in a page currently displayed in the browser
PageToJSP Sends the data found in a page currently displayed in the browser to a JSP server
PageToPHP Sends the data found in a page currently displayed in the browser to a PHP server
SiteAddress Returns the Internet address for connecting to a dynamic WebDev site found on the
same server
DynamicSiteDisplay Displays a dynamic site (created by WebDev) in the browser of the Web user from a
dynamic or static WebDev page
See the online help for more details about these functions.
See the online help to check the availability of these functions in the different types of code (server code and browser
code).
Tome1_2.book Page 281 Vendredi, 28. mai 2010 5:50 17

281

4. MANAGING THE "BACK" BUTTON WB

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.

Part 4: Managing controls, windows and pages


browser and its context on the server can become "out- When opening the page, the table displays the first 6
of-synch" if the browser "Back" button is used. records of the file (from ’A’ to ’F’). Sequence of actions
performed by the user:
4.1.1 There are two ways you can manage the 1. click the "Next" link
browser "Back" button Result: the server points to the next 6 records of ITEM
To avoid any out-of-sync problems between the pages and returns their contents to the browser. The brow-
displayed on the browser and the corresponding contexts ser displays the next page of the table with the 6 new
found on the server, WebDev offers two modes for mana- contents (’G’ to ’L’).
ging the browser "Back" button: 2. in the browser, click "Back"
• Solution 1: preventing the return to this page with the Result: the browser displays the page before the first
browser "Back" button. action. The table displayed contains the letters ’A’ to
If the browser "Back" button is used to display the pre- ’F’. The server has not been contacted, therefore it is
vious page, this action will have no effect. still pointing to the records ’G’ to ’L’.
3. click "Next"
• Solution 2: managing the synchronization (default
Result: the server points to the next 6 records of ITEM
solution)
(from ’M’ to ’R’ therefore). The browser synchronizes
For each action performed in a page from the browser,
a synchronization test is automatically performed with the server and displays the same elements: the
between the HTML page and its context. web user has the feeling that some information is not
Two modes are available for managing the synchroniza- displayed.
tion: This behavior can lead to unexpected consequences
•default synchronization (mode used by default when modifying a file record (modification of a record
when creating a new page). other than the one viewed by the Web user for instance).
•programmed synchronization. Reminder: each action in the browser must lead to an
action on the server: the server then sends an answer to
the browser. However, the click of the "Back" button is a
browser action independent of your WebDev site, there-
fore the second condition may not be performed.
Tome1_2.book Page 282 Vendredi, 28. mai 2010 5:50 17

282

4.2 Disabling the "Back" button


If the browser "Back" button is used to display the pre- 4.2.2 Implementation
vious page, this action will have no effect. To disable the "Back" key for a specific page:
1. Display the "Details" tab of the description win-
4.2.1 Operating mode dow of the page ("Description" option of the page’s
Disabling the "Previous Page" feature of the browser popup menu).
causes the following JavaScript code to be inserted in the 2. Select "Forbid using the browser "Back" button
generated HTML page: to return to this page".
<SCRIPT LANGUAGE="JavaScript"> 3.Validate.
history.forward()
</SCRIPT> To disable the "Back" button for a frameset:
1. Display the "Details" tab of the frameset’s des-
When viewing this page in a browser window, it will not be cription window ("Description" option of the frame’s
possible to go back to this page when pressing the popup menu).
"Back" button of the browser. 2. Select "Forbid using the browser "Back" button
Part 4: Managing controls, windows and pages

Notes: to return to this frameset".


3. Validate.
• Using the browser "Back" button can make the page
flicker. To disable the "Back" key for all the pages of the pro-
• This mechanism can fail if the [STOP] button of the ject:
browser is clicked before the forward() instruction is 1. Display the project description ("Project .. Project
run by the browser. description").
2. Click the "Options" tab.
3. Select "Forbid using the browser "Back" button
to return to this page".
4. Validate. This option will be automatically taken
into account for all the new pages of the site.

4.3 Managing the synchronization


4.3.1 Overview
If a desynchronization occurs, a warning message
For each action performed in a page, the mechanism for informs the Web user that the requested action has not
page synchronization automatically checks the synchro- been performed. The page corresponding to the context
nization. This test is designed to check whether the page found on the server is redisplayed. The site can continue
displayed in the browser corresponds to the page context to operate.
found on the server.
Two modes are available for managing the synchroniza- To implement the management of the synchronization in
tion: a page:
1. Managing the default synchronization. 1. In the "Details" tab of the window description
2. Managing the synchronization by programming, in ("Description" option of the popup menu), check
the synchronization code of the page. "Use the page synchronization mechanism".
2. Validate. This page will be automatically included
4.3.2 Default synchronization in the browser page history: you will be able to go
back to this page using the "Back" button of the
The synchronization mechanism is triggered only if "Use
browser.
the mechanism for page synchronization" is selected for
the page. To implement synchronization management in all the
project’s pages:
1. In the project description ("Project .. Project des-
cription", "Options" tab), select the "Use the page
synchronization mechanism" option.
Tome1_2.book Page 283 Vendredi, 28. mai 2010 5:50 17

283

Notes: check "Disable the page synchronization mechanism


• This management mode requires no specific WLan- for this control" in the "Advanced" tab of the control
guage code. description window.
• The synchronization mechanism can be disabled for • The warning message can be customized (see next
the page controls that do not require synchronization paragraph).
management ("Close" button for instance): to do so,

4.4 Synchronization by programming


To manage the synchronization by programming: Notes:
1. In the "Details" tab of the window description • The ChangeAction function is initialized with the "Do
("Description" option of the popup menu), check nothing" action if a WLanguage function that displays
"Use the page synchronization mechanism". or refreshes a page is used in the page synchronization
2. Configure (if necessary) the page controls for code.
which the synchronization must not be managed.

Part 4: Managing controls, windows and pages


• To customize the desynchronization message, all you
For each control that triggers an action on the server, have to do is enter in the synchronization code of the
you can specify whether the page synchronization page:
must be managed (default option) or ignored during 1. the custom message.
this action. 2. the code for refreshing the current page on the
To ignore synchronization management, check server (using the PageRefresh function for example).
"Disable the page synchronization mechanism for
this control" in the "Advanced" tab of the control’s • To perform a synchronization from the information
description window. found on the Web user’s computer, we recommend that
3. Enter the code required for custom management you:
of the synchronization in the page’s synchronization 1. Use a hidden control to store the identifier for the
process. Use the ChangeAction function in the record displayed and selected.
page’s synchronization code. This function is used to 2. Seek the current record in the browser in the syn-
define the action that will be performed in case of chronization code. This search is performed using
page desynchronization. the identifier found in the hidden control.
3. Refresh the page.
Tome1_2.book Page 284 Vendredi, 28. mai 2010 5:50 17

284

5. COMMUNICATING WITH THE USER


5.1 Overview
WinDev, WebDev and WinDev Mobile enable you to com- that:
municate with users through dialog boxes. • display a specific text in the buttons, for better unders-
You can use standard dialog boxes (made of images, text tanding.
and one or more OK, Cancel, Yes/No buttons). • allow the user to enter something.
WinDev also enables you to use advanced dialog boxes

5.2 The standard dialog boxes


Part 4: Managing controls, windows and pages

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 The advanced dialog boxes WD

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.

5.3.3 Immediate input


When developing an application, you may not want to
spend a lot of time creating an edit window with two but-
tons ("OK" and "Cancel").

Part 4: Managing controls, windows and pages


The Input function simplifies this task. This function ena-
bles you to create a window used to enter data (edit con-
trol or check box) and to validate or cancel the input.
• the immediate input: the user enters the requested
value in the dialog box. 5.3.4 Message database
WinDev proposes a list of messages. These messages
cannot be deleted.
All the new messages are automatically added to the
message database. By default, the message database is
found in the "Personal\Messages" directory of WinDev.
This directory can be modified in the options of the pro-
duct used ("Tools .. WinDev options", "Directory" tab).
5.3.2 Directive questioning To delete a message from the message database:
1. Display the code editor.
The security of the application data depends on the 2. Select "Code .. Multilingual messages .. Directive
answers given by the end users to the questions asked in questioning".
messages. In most cases, these questions are more or 3. Select the message to delete and click the "-"
less clear. For example, "Do you want to cancel the cur- icon.
rent deletion? " with "Yes" or "No" buttons.

5.4 Customizing the dialog boxes WD

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

windows from the project directory.


The "WinDevDialogBox" window replaces the win-
dow displayed by the Dialog function. 5.4.3 Multilingual dialog boxes
Tips To display multilingual dialog boxes:
• Do not modify the code of the "WinDevMessageBox" 1. Customize the system information windows (see
and "WinDevDialogBox" windows, nor the code of the previous paragraph).
their controls. 2. Enter the multilingual captions of the various but-
• Do not delete controls. tons ("Display .. Selection description").
• If controls are added to the "WinDevMessageBox" and 3. Select the multilingual images of the various
"WinDevDialogBox" windows, no code must be asso- image controls ("Display .. Selection description").
ciated with these controls. 4. Use multilingual character strings ([Ctrl]+[T])
• Limit the style modifications applied to these windows shortcut in the syntax of the Info, YesNo, Confirm,
and their controls, and test all these modifications. Error functions, …

5.5 Automatically close the dialog boxes WD WDMobile

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 Advanced communication with the user WB

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

Part 4: Managing controls, windows and pages


dard dialog box that offers CellDisplayDialog function and specify the name of
"Yes" and "No" and returns the cell to use.
the user’s choice.
PageDisplayDialog Displays a page in a modal 5.6.4 Managing a dialog with pages
mode. This function allows you Let’s see an example that is used to manage a dialog via
to create a dialog with the a site page. This solution is recommended if several
user. The page is displayed in pages of the site must propose a dialog with the Web
the foreground while the ope- user. The dialog page can be opened from any page of
ning page is displayed in the the site.
background, grayed by the To manage a dialog with a page, you must:
DDW mechanism. 1. Create a page (named PAGE_Info for example).
PageCloseDialog Closes the current page. This This page will be used to communicate with the user.
page was opened by PageDis- This page contains at least:
playDialog. A return value can
be sent back to the calling •a cell that defines the dialog box.
page. •a static control used to display the text. This static
control is contained in the cell.
•a button used to validate the dialog box. This but-
All these functions are used to communicate with the ton is contained in the cell.
user and take into account the DDW parameters defined You have the ability to add controls to the cell if
by the following functions: necessary (images, …).
We recommend that you center the page in the brow-
PageActiva- Enables or disables the DDW (Dim Disa- ser.
teDDW bled Window) when displaying a modal 2. The code of the dialog box’s closing button found
page (the pages used to communicate in the page contains the following:
with the user for instance). PageCloseDialog()
PageRateDDW Defines and returns the rate of gray
used by the DDW. The PageCloseDialog function lets you send a value
back to the page that opened the dialog box.
5.6.3 Managing a dialog with cells 3. To call a dialog page from another page, simply
use the PageDisplayDialog function, specifying the
Let’s see an example that is used to manage a dialog via name of the page to open, and if needed the para-
a cell found in a page. This solution is recommended if a meters to pass to it. These parameters can be used
single page of the site must propose a dialog with the to dynamically fill the text displayed in the static for
Web user. instance.
To manage a dialog with a cell, you must:
1. Create a cell in the page that needs to display the
Tome1_2.book Page 288 Vendredi, 28. mai 2010 5:50 17

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.

5.7 Functions for managing the dialog boxes


The following functions are used to manage messages and dialog boxes:
Warning Displays a custom message in a system warning window
Part 4: Managing controls, windows and pages

ShowToolTip Enables (or not) the display of tooltips


Confirm Displays a message in a window that offers the "Yes", "No" or "Cancel" answers and
returns the user’s choice
DelayBeforeClosing Limits the amount of time an information, question or confirmation type dialog box is dis-
played
Dialog Displays a message box and returns the value of the button clicked
Error Displays a custom error message in a system error window
Info Displays a custom message in a system information window
Gauge Displays a progress bar in the status bar of the current window
Message Displays (or erases) a message in the status bar of the current window
MessageAddCell Adds a new cell to the status bar of the current window
MessageDeleteCell Deletes a cell from the status bar of the current window
OKCancel Displays a message in a standard dialog box that proposes "OK" and "Cancel" and returns
the user’s choice
YesNo Displays a message in a standard dialog box that proposes "Yes" and "No" and returns the
user’s choice
Input Displays a message allowing the user to enter some information
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 289 Vendredi, 28. mai 2010 5:50 17

289

6. THE POPUP MENUS WD WDMobile

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

Part 4: Managing controls, windows and pages


menus are created in the window editor and they can

6.1 Window for editing the popup menus


WinDev enables you to create and modify custom popup management of the custom popup menus, let’s take a
menus in a specific edit window. To better understand the look at the vocabulary linked to this edit window:

6.2 Handling a custom popup menu


6.2.1 Creating a custom popup menu popup menu of the option of the home window (right
To create a custom popup menu: mouse click) and select "Description of popup
1. Select "Insert .. New popup menu". The window menu".
for editing the new custom popup menu is opened. 3. Add menu options to the new popup menu. See
2. To modify the description of the popup menu the ’Adding a menu option’ paragraph, page 311, for
(name of the popup menu, and so on), display the more details.
Tome1_2.book Page 290 Vendredi, 28. mai 2010 5:50 17

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

- Select the popup menu to edit in the "Popup


To associate an existing custom popup menu with one or Menu" combo box.
more elements (window or controls): - Click the arrow found to the right of the "Popup
1. Select the element(s) to associate with an exis- Menu" combo box.
ting popup menu. • from the "Management of popup menus" window
2. Display the "Details" tab of the description win- ("Windows .. Popup menu .. Edit"):
dow of the current element(s) ("Display .. Selection - Select the popup menu to edit.
description"). - Click the "Edit" button.
3. Select the popup menu to associate from the
"Popup Menu" combo box. Notes:
• See the ’Handling menu options in the editor’ para-
Notes: graph, page 311, for more details about the modifica-
• To edit the selected popup menu, click the arrow found tions of a custom popup menu.
to the right of the "Popup Menu" combo box. • To access the different popup menus currently edited
• To associate a window or a control with an existing cus- for a window:
tom popup menu by programming, use the Popup- 1. Click the button corresponding to the requested
Menu property. window in the bar of opened documents.
2. Select the element (window or popup menu) to
Special case: Popup menu in a table: display.
Tome1_2.book Page 291 Vendredi, 28. mai 2010 5:50 17

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.

Part 4: Managing controls, windows and pages


6.2.5 Deleting a custom popup menu
To delete a custom popup menu:
1. Select "Windows .. Popup menu .. Edit".
Notes: 2. Select the custom popup menu to delete.
3. Click the "Delete" button. The window and/or the
• This description window is used to:
controls associated with the deleted popup menu
- modify the name of the custom popup menu.
will no longer be associated with a custom popup
menu. For the controls that have a default system
popup menu, this system popup menu will replace
the deleted custom popup menu.

6.3 Handling a custom popup menu by programming


WinDev enables you to handle the custom popup menus by programming:
PopupMenu property Enables you to find out and change the custom popup menu associated with a
control or with a window. Also enables you to:
• associate or not a control with a popup menu.
• display or not the default system popup menu.
PopupField function Identifies the control onto which a custom popup menu was opened (to be used
in the code of the custom popup menu).
OpenPopupMenu function Enables you to automatically open the popup menu of a control or window. You
have the ability to choose the popup menu to open as well as its position.
Note: WinDev also enables you to handle the menu options by programming. See ’Handling menu options by program-
ming’, page 312, for more details.
Tome1_2.book Page 292 Vendredi, 28. mai 2010 5:50 17

292

6.4 Default system popup menu


The following types of controls have a default system associated with the control):
popup menu (displayed if no custom popup menu is
• an edit control: • an ActiveX control:
See the online help for more details about this menu’s Note: the system popup menu displayed depends on the
translation. ActiveX associated with the control.
• a table: • an HTML control:
See the online help for more details about this menu’s Note: the displayed system popup menu is the one
translation. from Internet Explorer. It depends on the object selec-
ted in the page (image, text, link, …).
control description window, "Details" tab).
To disable this system popup menu:
• by programming: use PopupMenu.
Part 4: Managing controls, windows and pages

• from the window editor: select the "Disabled" ele-


ment from the "Menu Ctx." combo box (window or
Tome1_2.book Page 293 Vendredi, 28. mai 2010 5:50 17

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

Part 4: Managing controls, windows and pages


Euro is displayed.
4. Check "Currency modifiable via popup menu".
Tome1_2.book Page 294 Vendredi, 28. mai 2010 5:50 17

294

7. THE MAIN MENUS


7.1 Overview
7.1.1 Main menu in WinDev and WinDev 7.1.2 Main menus in WebDev
Mobile WebDev enables you to create a drop-down menu in your
A main menu is necessarily associated with a window. HTML pages. This menu can be horizontal or vertical.
This menu is displayed below the title bar of the window From the different options of this menu, you can:
in WinDev and at the bottom of the screen in WinDev •display pages,
Mobile. In most cases, the applications contain a menu •run the code of the buttons found in the page,
window. This window only contains a main menu and it is
used to access the other windows of the application. •…
Part 4: Managing controls, windows and pages

7.2 Vocabulary associated with the main menus


To easily handle a main menu, you must be familiar with
the following vocabulary:

7.3 Handling a window’s main menu


7.3.1 Creating a main menu 7.3.2 Editing a main menu
To create a main menu: To edit a main menu:
1. In the window editor, open the window where a 1. Open a window containing a main menu ("File ..
main menu must be added. Open").
2. Select "Windows .. Main menu .. Add the main 2. Select one of the menu options. The options and
menu". The first menu option is displayed in the the sub-options are automatically displayed.
menu bar. By default, the name of the main menu is
"_Menu" and the caption of this first option is 7.3.3 Deleting a main menu
"Menu". To delete a main menu:
3. To modify the name of the main menu, display the 1. In the window editor, open the window where the
window description ("Description" from the popup main menu must be deleted.
menu of the window) and enter the new name of the 2. Select "Windows .. Main menu .. Delete the main
main menu in "Name of main menu". menu". All the menu options and the code associa-
4. Add the menu options to the window currently in ted with this main menu are deleted.
edit. See the ’Adding a menu option’ paragraph,
page 311, for more details.
Tome1_2.book Page 295 Vendredi, 28. mai 2010 5:50 17

295

7.3.4 About menu in your application ("Windows .. Main menu .. Add the
WinDev enables you to automatically insert a "?" menu menu?").

7.4 Handling a page’s main menu


7.4.1 Creating a main menu frame comes up. The popup menu of the menu
To create a menu: options enables you to directly add the options into
1. In the page editor, select the "Insert .. Menu". the page in edit. See ’Handling the menu options in
2. The menu creation wizard starts automatically. the editor’, page 311, for more details.
Select the menu style you want (you can also define Note: to leave the menu editing, use the [Esc] key (the
your own style). yellow frame will go away).
3. Give a name to the menu and validate.
4. The menu automatically appears in the page with 7.4.2 Editing a main menu
two options: To edit a main menu:

Part 4: Managing controls, windows and pages


1. Open a window containing a main menu ("File ..
Open").
2. Click the menu twice: a yellow frame comes up.

7.4.3 Deleting a main menu


5. To display the menu’s description, click the menu
To delete a menu:
options once. Display the popup menu of the menu
1. Select the menu (the yellow frame should not
and select "Description". Then you can configure :
come up).
- the orientation of the menu,
2. Press the [Del] key to delete the options.
- the images used in the options’ background, …
6. To add options, click the menu twice: a yellow

7.5 Handling a main menu by programming


A main menu cannot be handled directly by program- menu options by programming’, page 312, for more
ming. However, WinDev enables you to handle the details.
options of a main menu by programming. See ’Handling
Tome1_2.book Page 296 Vendredi, 28. mai 2010 5:50 17

296

8. THE MENU OPTIONS


A menu (main menu or popup menu) includes one or - open the relevant window in WinDev ("File .. Open").
more options and sub-options. Each option is used to run - select one of the menu options. The options and the
a WLanguage code. sub-options are automatically displayed.
In the editor, the operations performed on the menu • the main menu of a page:
options are the same for a main menu and for a custom - open the relevant page in WebDev ("File .. Open").
popup menu. To handle the menu options, all you have to - click the menu twice: a yellow frame comes up.
do is edit the relevant menu. • a window custom popup menu, select "Windows ..
To edit (or display in the editor): Popup menu .. <PopupMenuName>".
• the main menu of a window: See the online help for more details.
Part 4: Managing controls, windows and pages

8.1 Characteristics of the menu options


8.1.1 Caption of a menu option
Each menu option can be preceded (or not) by the check-
The caption of a menu option can be modified directly in
the window/page being edited: mark . This checkmark is used to view the active featu-
1. Select a menu option. res for instance.
2. Press the [Space] key in WinDev and [Enter] in
WebDev.
3. Modify the caption in the input area.
4. Press [Enter] to validate the input.

8.1.2 Translating the menu options


To translate the caption of the menu options in the editor: To check a menu option in the editor:
1. Display the window/page in the translation lan- 1. Select the menu option to check.
guage ("Display .. Language displayed…"). The cap- 2. Display the "Details" tab of the description win-
tions of the controls and menu options are displayed dow of the menu option ("Display .. Selection des-
in the selected language. cription").
2. Directly enter the text of the options in the chosen 3. Check "Checkmark". The checkmark will be in
language ([Space] key in WinDev and [Enter] in front of the current menu option when displaying the
WebDev on the menu options). menu.
Reminder: the caption entered when creating a menu Notes:
option is applied to all the languages supported by the • At run time, to display and/or hide the checkmark, use
current window/page. MenuMark and MenuUnmark.
8.1.3 Marking/Unmarking a menu option • In most cases, a menu option cannot be preceded by
both a checkmark and an image.
WD, This feature is only available in WinDev
WDMobile and in WinDev Mobile.
Tome1_2.book Page 297 Vendredi, 28. mai 2010 5:50 17

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

Part 4: Managing controls, windows and pages


Notes: caption:
• WinDev Mobile: The authorized image formats are as
follows: ".BMP", ".JPEG", ".GIF", ".ICO". 8.1.6 Code of a menu option
• WinDev: The authorized image formats are as follows: To display the source code of a menu option:
".BMP", ".JPEG", ".GIF", ".PCD", ".PSD", ".TGA", 1. Select the menu option whose source code must
".TIF", ".PNG", ".ICO", ".EMF", ".WMF", ".CUR", be displayed.
".OS2", ".PCX" ou ".ICW". 2. Display the popup menu of the current menu
• To find out and/or modify the image associated with a option (right mouse click).
menu option, use Image. 3. Select "Code". The code window of the current
• In most cases, a menu option cannot be preceded by menu option is displayed.
both a checkmark and an image. Notes:
8.1.5 Keyboard shortcut associated with a • The code of a menu option can also be displayed from
menu option its description window. To do so, click the "Code" icon.
This code corresponds to the code run when the menu
WD, This feature is only available in WinDev option is selected by the user. You have the ability to
WDMobile and in WinDev Mobile. add optional processes (WinDev and WinDev Mobile
only) via the icon bar displayed at the bottom of the
code window.
Each menu option can be associated (or not) with a key-
board shortcut. • Only the menu options with no sub-menu can start a
WLanguage process.
Reminder: a keyboard shortcut corresponds to an alpha-
numeric character, a keyboard key or a combination of
Tome1_2.book Page 298 Vendredi, 28. mai 2010 5:50 17

298

8.2 Handling the menu options in the editor


8.2.1 Adding a menu option Note: you can also add a separator before the selected
To add a menu option: menu option by pressing the [Pause] key (WinDev and
1. To add a menu option: WinDev Mobile only).
•after the selected menu option, you can: 8.2.3 Add a sub-menu
- display the popup menu of the current menu
option (right mouse click) and select "Add after". To add a sub-menu:
- press the [Enter] key (WinDev and WinDev Mobile 1. Select the menu option to which a sub-option
only). must be added.
2. Display the popup menu of the current menu
•before the selected menu option, you can: option (right mouse click).
- display the popup menu of the current menu 3. Select "Insert a sub-menu".
option (right mouse click) and select "Insert an 4. Enter the caption of the first option of the created
option". sub-menu.
- press the [Ins] key (WinDev and WinDev Mobile
Part 4: Managing controls, windows and pages

5. Press the [Enter] key to validate the addition.


only).
2. Enter the caption of the new menu option. Notes:
3. Press the [Enter] key to validate the addition. • The method for adding sub-options to a sub-menu is
Notes: the same as the method for adding options to a menu.
• The [Esc] key enables you to cancel the addition of a • You can also add a submenu to the selected menu
menu option (WinDev and WinDev Mobile only). option by pressing the [TAB] key (WinDev and WinDev
Mobile only).
• To go from a menu option to the next one, use the arrow
keys (up and down) (WinDev and WinDev Mobile only). 8.2.4 Deleting a menu option
8.2.2 Add a separator To delete a menu option:
1. Select the menu option to delete.
To add a separator: 2. Display the popup menu of the current menu
1. Select the menu option in front of which the sepa- option (right mouse click).
rator must be added. 3. Select "Delete".
2. Display the popup menu of the current menu
option (right mouse click). Note: you can also delete the current menu option by
3. Select "Insert a separator". pressing the [Del] key.

8.3 Handling the menu options by programming


In the editor, menu options are the same regardless window/page.
whether the menu is a popup menu or a main menu. • "<WindowName>.<MenuName>.<OptionName>" if
To handle a menu option by programming, use the nota- the option is handled from another window/page.
tion:
• "<OptionName>" if the option is handled from the
Tome1_2.book Page 299 Vendredi, 28. mai 2010 5:50 17

299

8.3.1 WLanguage functions


WinDev and WinDev Mobile offer several WLanguage
functions specific to menu options:
PopupField Identifies the control on which the popup menu was opened
EnumMenu Returns the name of the nth menu option
EnumSubElement In a loop, this function is used to enumerate the drop-down menus or the popup menus of a win-
dow or control.
grMenu Enables or disables the popup menu of a chart.
MenuAdd Adds a popup menu to a menu
MenuAddMenu Adds a new menu to a window. This menu can contain other menus, menu options, separators,

MenuAddOption Adds a new menu option at the end of a menu. This menu option runs a procedure passed in

Part 4: Managing controls, windows and pages


parameter.
MenuAddURLOp- Adds a new menu option at the end of a menu found in a page. This menu option runs an URL
tion passed in parameter and displays the corresponding page.
MenuAddSepara- Adds a new separator to a menu.
tor
MenuClone Clones a menu or a menu option as well as the associated code.
MenuUnMark Removes the checkmark in front of the menu option
MenuState Identifies the state of a menu option: enabled, disabled or hidden
MenuInsertMenu Inserts a menu before another menu in a window. The inserted menu may contain other menus,
menu options, separators, …
MenuInsertOption Inserts a new option at a specific position. This menu option runs a procedure passed in para-
meter.
MenuInsertSepa- Inserts a separator into a menu.
rator
MenuInvisible Makes a menu option invisible
MenuLabel Identifies or modifies the caption of a menu option
MenuIsMarked Enables you to find out whether a checkmark is displayed in front of the menu option
MenuMark Positions the checkmark in front of the menu option
MenuSelectMinus Disables (grays) a menu option
MenuSelectPlus Enables a menu option
MenuDelete Deletes a menu or a menu option
OpenPopupMenu Automatically opens a popup menu for the current control or window
EmulateMenu Emulates the next menu that will be opened and automatically runs the menu option passed in
parameter.

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

8.3.2 WLanguage properties


WinDev, WebDev and WinDev Mobile offer several WLan-
guage properties specific to menu options:
Checked Enables you to manage a checkmark in front of the menu option
State Enables you to find out and modify the display status (active, inactive or grayed) of a menu option
Group Enables you to find out whether the menu option belongs (or not) to a group of controls
Image Enables you to find out and modify the image of a menu option
Caption Enables you to find out and modify the caption of a menu option
Message Enables you to find out and modify the help message of a menu option
Name Enables you to find out the name of a menu option
FullName Enables you to find out the full name of a control.
Part 4: Managing controls, windows and pages

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

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 301 Vendredi, 28. mai 2010 5:50 17

301

9. THE STATUS BAR WD WDMobile

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).

Part 4: Managing controls, windows and pages


•a progress bar. This progress bar is displayed by pro-
gramming with the Gauge function.

9.2 Description window of a status bar WD

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

9.3 Programming a status bar


WinDev lets you use a status bar and a status bar’s cell
directly by programming. To do so, use the variable of the -- Initialization code of the window
status bar or the variable of the cell in the code. // Add the "MyCell" cell in
The variable of a status bar corresponds to the name of // window status bar
the status bar. The variable of a cell found in a status bar // current
corresponds to the name of the cell. MessageAddCell("MyCell", 100,…
iLightRed)
// Modify the bold attribute of the
information
9.3.1 Adding a cell to the status bar // displayed in the "MyCell" cell
To add a cell by programming to a status bar, use Messa- // Indirection operators are
geAddCell. // required for a cell created
Then, this cell can be handled by several properties. // by MessageAddCell
Caution: the name of a cell created with the MessageAd- {"MyCell"}..FontBold = True
Part 4: Managing controls, windows and pages

dCell function must be surrounded by indirection opera-


tors ([ }) in order to be handled by WLanguage -- Optional rollover code for
properties. -- the mouse
// Display the coordinates of the
The following example is used to add a cell to the status // mouse cursor in "MyCell"
bar of the current window. This cell displays the coordina- Message("MyCell",…
tes of the mouse cursor. The background of this cell is MouseXPos()+" , "+MouseYPos())
red. The font used in this cell is bold.

9.4 Properties associated with the cells of the status bars


The following properties are associated with status bar Caption Enables you to find out and
cells: modify the text displayed in a
HorizontalAlignment Enables you to find out and cell
modify the horizontal alignment Name Enables you to find out the name
of the text displayed in a cell of a cell
Color Enables you to find out and Fullname Enables you to find out the full
modify the color of the text dis- name of a cell.
played in a cell HelpNumber Enables you to find out and
BrushColor Enables you to find out and modify the help number associa-
modify the background color of a ted with a cell.
cell Font Enables you to find out and
Image Enables you to find out and modify the identifier of the font
modify the image displayed in a used in a cell
cell FontCharset Enables you to find out and
Width Enables you to find out and modify the character set of the
modify the width of a cell (in font used in a cell
pixels) FontStrikeOut Enables you to find out whether
InitialWidth Enables you to find out and the text displayed in a cell is
modify the initial width of a cell struck out and to strike out (or
(in pixels) not) the text displayed in a cell
Tome1_2.book Page 303 Vendredi, 28. mai 2010 5:50 17

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

Part 4: Managing controls, windows and pages


of the text displayed in a cell a cell is visible and to make it
FontItalic Enables you to find out whether visible/invisible
the text displayed in a cell is in InitialVisible Enables you to find out whether
italics and to modify the italic a cell was visible when the win-
attribute of the text displayed in dow was opened
a cell
FontLarge Enables you to find out whether See the online help for more details.
the characters of the text dis- See the online help to check the availability of these
played in a cell are enlarged and properties in the different products (WinDev, WinDev
to enlarge or not the characters Mobile).
of the text displayed in a cell
FontName Enables you to find out and Note: the StatusBar property lets you:
modify the font used in a cell •find out whether the status bar of the current window
FontUnderline Enables you to find out whether is enabled.
the text displayed in a cell is •enable the status bar of the current window.
underlined and to underline or
not the text displayed in a cell Reminder: the Message property enables you to find out
and modify the help message associated with a window
control.
Tome1_2.book Page 304 Vendredi, 28. mai 2010 5:50 17

304

9.5 Functions associated with status bars


The functions associated with status bars are as follows:
Gauge Displays a progress bar:
in the status bar of the current window.
in a cell of the status bar of the current window
Message Displays (or erases) a message:
in the status bar of the current window.
in a cell of the status bar of the current window
MessageAddCell Adds a new cell to the status bar of the current window
MessageDeleteCell Deletes the specified cell from the status bar of the current
window
Part 4: Managing controls, windows and pages

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).

Note: the name of a cell created with the MessageAdd-


Cell function must be surrounded by indirection opera-
tors in order to be handled by WLanguage properties.
Tome1_2.book Page 305 Vendredi, 28. mai 2010 5:50 17

305

10. TODAY SCREEN WM

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

Part 4: Managing controls, windows and pages


10.2 Create a today screen
To create a today screen: 5. The wizard for creating a "Today Screen" starts.
1. In a WinDev Mobile project, create: Specify:
•the window used for the "Today Screen" (and if •The main window used for the "Today Screen".
necessary the windows displayed by the "Today •The window for the "Today Screen" options (if it
Screen"). exists).
•the window for configuring the "Today Screen" (if •The elements to include in the library.
necessary). •The project languages to include in the library.
2. Select "Workshop .. Today Screen .. Generation of
Today Screen". •The components used.
3. WinDev Mobile proposes to create a new project •The version information (company, description,
configuration. We advise you to accept. Indeed, the etc.)
project configurations are used to group and find the •If necessary, the tasks and incidents correspon-
elements used by a specific mode of generation. ding to this version of "Today Screen".
4. When creating the project configuration, specify: •The mode for using the PC SOFT framework.
•The name and description of the "Today Screen" •Whether a backup must be performed (recommen-
configuration. ded).
•The elements to include (notably the windows spe- 6. The Today Screen is automatically created.
cific to the "Today Screen").

10.3 Installing a today screen


To install a today screen: •The setup format: format pour ActiveSync, or CAB
1. Open the WinDev Mobile project containing the format for an installation directly om the Pocket
Today Screen if needed. PC.
2. Select "Workshop .. Today Screen .. Create the •The setup directory.
setup procedure of a Today Screen". •The files to install and the framework. The files cor-
3. WinDev Mobile proposes to create the Today responding to the Today Screen are selected by
Screen. If the files corresponding to the Today default.
Screen have already been generated, click "2
Setup" in the wizard (to the left of the screen). •The additional modules to install.
4. When creating the setup, specify: •The directory for generating the setup.
•The provider and the name of the application. 5. Validate. The setup is created.
Tome1_2.book Page 306 Vendredi, 28. mai 2010 5:50 17

306

10.4 Activating a Today Screen


To enable a today screen: Note: several Today Screens created with WinDev Mobile
1. Select "Start .. Parameters .. Today .. Elements". can be installed and used simultaneously on the same
2. Select the "Pocket TodayScreen" option. Pocket PC.
3. Validate.

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

11. DRAG AND DROP MANAGEMENT WD

11.1 What is "Drag and Drop"?


The "Drag and Drop" is used to transfer data between • Keep the left mouse button down while moving
several controls via the mouse. This data can be moved toward the target.
between several controls found in the same application •Release the mouse button to drop the data.
or in different applications.
You must distinguish between: WinDev supports several types of drag and drop opera-
tions in your applications:
•The source, object containing the data to copy or to
cut. •Automatic drag and drop for edit controls, list boxes,
listviews, treeviews and treeview tables.
•The target, object into which the data must be
•Programmed drag and drop for a large number of

Part 4: Managing controls, windows and pages


copied.
controls.
The "Drag and Drop" consists in: •Programmed drag and drop between Windows
• Selecting the data in the source with the mouse. explorer and a WinDev application.

11.2 Automatic drag and drop


For edit controls, list box controls, listview controls and •…
treeview controls, WinDev can automatically manage all
the operations performed by drag and drop. No additio- Note: for other types of controls, drag and drop opera-
nal programming is required. To do so, specify in the tions must be programmed (see "Programmed drag and
control description that "Drag and Drop" must be mana- drop").
ged.
11.2.1 Configuring the default drag and drop
Special case: the tables and the treeview tables: For edit controls, list box controls, listview controls and
An automatic "Drag and Drop" can also be performed treeview controls, you can configure the default "drag &
between tables of identical structure (columns with the drop" in the "Details" tab of the control’s description.
same name, with the same characteristics). This "Drag "Is source" is used to define the
and Drop" can be performed between: control as "Source" for "Drag
• A browsing table and a memory table, and Drop". The user will be able
• Two memory tables. to select the content of the con-
trol and to move it toward ano-
For instance, the user will be able to perform a drag and ther control for instance.
drop:
•from an edit control to another edit control or to a list "Is target" is used to define the control as "Target" for
box (in the same window or in another window of the "Drag and Drop". This control will be able to receive any
application), object "dropped" by the user.
•from a list box to an edit control or to a list box (in the The two options can be selected at the same time.
same window or in another window of the applica-
tion),
•from an edit control to another application (and con-
versely),
•from a listview to another application (and conver-
sely),
Tome1_2.book Page 308 Vendredi, 28. mai 2010 5:50 17

308

11.2.2 Default behavior of Drag and Drop


The control’s behavior depends on whether the control is source or target:
Type of control The control is source The control is target
Edit control By default, the selected text is deleted (cut/paste) after The text is inserted at cursor position
the Drag/Drop operation. after the Drag/Drop
To avoid deleting the selected text, press the [CTRL] key
during Drag/Drop.
List 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 list
To delete the selected elements (cut/paste) after the box after the Drag/Drop
drag and drop operation, you need to program the drag
and drop.
ListView The selected element(s) are not deleted (copy/paste) The selected elements are inserted at
Part 4: Managing controls, windows and pages

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.

11.3 Programmed "Drag and Drop"


The programmed "Drag and Drop" enables you to enti- event).
rely manage the "Drag/Drop" between the different 2. In the initialization code of the target control:
types of controls. Depending on its type, the control can •Define that a programmed "Drag and Drop" will be
be source or target of "Drag and Drop": performed (DndTarget).
• Source of Drag and Drop: •Define the procedure run when the control is hovered
Only the following controls: edit control, list box, lis- (DndEvent for the dndDragOver event).
tview, treeview, table, image and bar codes.
•Define the procedure run when the "Drop" action is
• Target of Drag and Drop: performed on the control (DnDEvent for the dndDrop
Any type of control except: progress bar, ActiveX, OLE, event).
shape, toolbar, HTML, Web camera and conference
control. 3. In each of the WLanguage procedures called, defined
the action to perform using the WLanguage "Drag and
11.3.1 Principle Drop" functions.
To perform a programmed "Drag and Drop" between 11.3.2 Programming
several controls of a WinDev application, you must per-
form the following operations: Several examples of programmed "Drag and Drop" are
supplied with WinDev:
1. In the initialization code of the source control:
•WD Puzzle: Programmed drag and drop between ima-
•Define that a programmed "Drag and Drop" will be ges.
performed (DnDSource).
•Single drag and drop example: programed drag and
•Define the procedure run at the beginning of the drop between list boxes, tables and treeviews.
"Drag" action (DnDEvent for the dndBeginDrag
Tome1_2.book Page 309 Vendredi, 28. mai 2010 5:50 17

309

11.4 "Drag and Drop" from the explorer


The "Drag and Drop" from the explorer consists in selec- •ExplorerAccept: enables or disables the ability to
ting one or more files in the Windows explorer and in perform drag and drop operations from Windows
transferring them into a control in a WinDev window. explorer into a WinDev window.
For example, the "WD Drag and Drop" example enables •ExplorerRetrieve: retrieves the number of files drop-
you to display the image files "dropped" from the explo- ped and their name.
rer.
11.4.3 Programming
Enabling the management of "Drag and Drop" from the
explorer to the window
To enable the ability to perform "Drag and Drop" from
the explorer to a window, you must declare in the initiali-
zation code of the window:
•The implementation of "Drag and Drop".

Part 4: Managing controls, windows and pages


•The event used to link a specific WLanguage proce-
dure (GetFiles in our example) to the drop action
(Windows event 563). This procedure is a procedure
local to the window.
ExplorerAccept(True, "")
Event("GetFiles", "*.", 563)

Processing the "dropped" files


In the procedure called whenever files are "dropped" in
the window, you have the ability to get information and to
process the relevant files.
11.4.1 Principle In our example, ExplorerRetrieve enables you to:
To enable "Drag and Drop" from the explorer to a Win- •find out the number of files "dropped" from the
Dev application, the following steps must be performed explorer,
are as follows: •retrieve the name and the path of each file and dis-
1. Enable the ability to perform "Drag and Drop" play them in a new window.
from explorer (ExplorerAccept).
// Number of files dropped into
2. To process the action performed by the user,
// the application by drag and drop
associate a WLangage procedure with the drop of
NbFile is int =…
the file in the window (Event).
ExplorerRetrieve(_EVE.wparam)
3. In the procedure called whenever a file is dropped
sFileName is string
in the window, retrieve the characteristics of the
// Retrieve all the files
"dropped" files via ExplorerRetrieve.
i is int
11.4.2 Functions specific to "Drag and Drop" FOR i = 1 to NbFile
sFileName = ExplorerRetrieve(…
from the explorer
_EVE.wparam, i)
The following functions are used to manage drag and OpenImage(sFileName)
drop operations from Windows explorer to a window in a END
WinDev application:
Tome1_2.book Page 310 Vendredi, 28. mai 2010 5:50 17

310

11.5 Functions for managing Drag and Drop


The following functions are used to manage drag and drop operations:
DnDAccept Indicates the action accepted by the target of Drag/Drop and manages the mouse cursor
during Drag/Drop
DnDCursor Manages the mouse cursor during a Drag and Drop
DnDCacheData Indicates the type of data and the data to copy/move during Drag/Drop
DnDIsDataAvailable Checks whether a specific type of data is available during Drag/Drop
DnDEvent Indicates the procedure to run during an event of Drag/Drop
DnDGetData Retrieves a specific type of data during Drag/Drop
ExplorerAccept Enables or disables the ability to perform "Drag and Drop" from the Windows explorer to a
WinDev window
ExplorerRetrieve Retrieves the number and the name of "dropped" files
Part 4: Managing controls, windows and pages

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. MULTILINGUAL APPLICATIONS AND SITES


12.1 Overview
A multilingual application or site can be distributed in Notes:
several languages. The different languages of the appli- • If the operating system supports several languages
cation or site will be taken into account during the diffe- (Hebrew, Arabic, Greek, and so on), the corresponding
rent development steps. character set is automatically used when the transla-
The main steps for developing a multilingual application tions are entered in these languages.
or site are as follows: • If your application is a multilingual application, you
1. Choosing the languages supported by the project need to manage this feature also in the windows/
and the analysis. pages of the user groupware and the windows/pages
2. Enter the different project elements (window, of the automatic HyperFileSQL error management. See

Part 4: Managing controls, windows and pages


code, …) in the different languages of the project. the online help for more details.
3. Defining the project language by programming. • Unicode management is available in the HyperFileSQL
4. Managing the specific character sets in the data files, the controls of the windows and pages.
files.
5. Creating the executable and the setup program.

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.

12.3 Translating the interface into several languages


Once the different languages supported by the applica- 12.3.1 Selected translation mode
tion have been selected, the information displayed by the WinDev proposes several translation modes:
application must be translated into these different lan-
guages. • Automatic translation of the interfaces via a specific
translation tool, found on the development computer.
To translate the interface into several languages, some This translation is performed in the WinDev editor
elements must be taken into account: directly.
• The selected translation mode. • Check out all the messages to translate using WDMSG
• The supported languages (languages that use a spe- and check them back in after translation.
cial character set or not)
• The use of specific windows or pages (user groupware,
automatic management of HyperFileSQL errors, print
preview)
• The messages displayed by programming.
Tome1_2.book Page 313 Vendredi, 28. mai 2010 5:50 17

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

Part 4: Managing controls, windows and pages


2. If a translation tool is specified, a "Translate" project. The windows and pages are provided (with
button will be displayed in each element containing their WLanguage code) as example:
information to translate. This button enables you to •in the \Programs\Data\Preset Windows\HyperFi-
translate the selected text via the specified transla- leSQL - Automatic Help Windows directory.
tion tool.
•in the \Programs\Data\Preset Pages\HyperFi-
3. To perform the translation, simply select the text leSQL - Automatic Help Pages directory.
to translate and click the "Translate" button. 2. Customize the error management to use the
Checking out and checking in the infor- HyperFileSQL windows or pages for error manage-
mation to translate ment (HOnError).
3. Translate the messages (see the previous para-
The WDMSG tool, available separately, lets you extract all graph).
the messages of a project (control captions, etc.) and
check them back in after they’ve been translated. Automatic error management (WinDev
Contact PC SOFT Sales Department for more details only)
about the conditions for using this product. By default, the windows for automatic management of
errors are supplied in English and in French. To translate
12.3.2 Languages that use a specific character them into another language, you must:
set 1. Including the default error windows in your appli-
If your application supports languages that use specific cation. These windows are supplied (along with their
character sets (Greek, Russian, etc.), you must enter the WLanguage code) as examples in \Pro-
translation of the different messages using these specific grams\Data\Preset windows\Assertion - Error -
character sets. Exception.
WinDev, WebDev and WinDev Mobile allow you to auto- 2.Translate the messages (see the previous para-
matically manage special character sets in the editor. graph).
Indeed, as soon as the edit cursor of the mouse is loca- User groupware
ted in an input area of a language that uses a specific By default, the user groupware is supplied in English and
character set, the corresponding input language (charac- in French.
ter set used by the keyboard) is automatically displayed. To translate an application that uses user groupware, you
Therefore, if a caption is entered in the Russian section of must choose the "Custom" mode when including user
the caption’s description, the keyboard will automatically groupware in your application ("Workshop .. Configure
switch to the Russian character set. the user groupware").
Reminder: to use special character sets, you need to ins- The different windows/pages of the user groupware will
tall the files corresponding to the character sets you want be included in your application.
in the regional options of Windows (control panel). Then, all you have to do is translate these windows/
pages.
Note: if needed, clear the "automatic launch" option,
this way you will be able to display a language selection
window/page before the login window/page.
Tome1_2.book Page 314 Vendredi, 28. mai 2010 5:50 17

314

Print preview guages of your application or site.


By default, the preview window is available in English and To translate a character string entered in the code editor :
in French. 1. Select the character string to translate.
To translate the preview window, the windows correspon- 2. Select "Translate" from the popup menu of the
ding to the print preview must be included in your appli- selection. The window for translating messages is
cation. These windows are supplied (along with their displayed.
WLanguage code) in \Programs\Data\Preset win- 3. Enter the translation and validate. The code line is
dows\Preview. See the online help for more details. displayed in the code editor.
Then, all you have to do is translate these windows. The flag indicates that translations exist for this character
string. Click this flag to display the translation window.
System menu The number (2 in our example) indicates the number of
A default popup menu is available for the edit controls translations entered for this character string.
and for the Table controls. This menu allows the user to Notes: to enter a string’s translation, you can also use:
easily perform several operations.
• the CTRL T key combination.
To translate these menus, you must own WDINT.
• the MessTranslate function (compatibility with pre-
Part 4: Managing controls, windows and pages

12.3.4 Translating the messages found in the vious versions).


WLanguage code Note: to convert all the messages in your code into multi-
In your code, several WLanguage functions allow you to lingual messages, select "Code .. Multilingual messages
communicate with users via character strings. These .. Convert simple strings into multilingual messages".
messages must also be translated into the different lan-

12.4 Choosing the language by programming


A multilingual application is an application that can be guage will be taken into account by the first function
distributed in several languages. The user will be able to called after Nation and by the windows and reports
choose the runtime language of the application. You can that will be opened thereafter.
for example: 2. Call the LoadError function to load the file contai-
• ask for the runtime language during the first startup of ning the component error messages (WD*.DLL files)
the application in the chosen language.
• have an option (menu option for instance or button) Note: by default the component error messages are
allowing the user to change the current language for in English. They can be translated with WDINT.EXE.
the application This tool creates a specific file (.WDM extension).
WDINT is an additional tool. Contact PC SOFT Sales
Department for more details about the conditions for
using this product.
12.4.1 Defining the application language by 3. If your application supports languages that use
programming specific character sets (Greek, Korean, and so on),
When running the project, the default language is the one you can change by programming:
selected in the project description window ("Project .. - the character set used by all the screen fonts
Project description .. Language"). The change of lan- (ChangeCharset). This character set can also be
guage is performed by programming. used for the data saved in the HyperFileSQL files.
See Managing specific character sets in data files for
To change the language by programming, you must: more details.
1. Call the Nation function of WLanguage with the
- the language of the keyboard handled by the users
chosen language as parameter, identified by its
of the application (ChangeKeyboard).
number (this number is found next to the language
chosen in the project’s options). The selected lan-
Tome1_2.book Page 315 Vendredi, 28. mai 2010 5:50 17

315

Example of initialization process of the project: CASE 3: // Spanish


French is int = 5 Nation(Spanish)
English is int = 3 IF LoadError("…
Spanish is int = 7 SPANISH.WDM") > 0 THEN
// the language is chosen with the Error("Message file"+…
// LangChoice radio button "not found. ",…
SWITCH LangChoice "The messages will be "+…
CASE 1: // French "displayed in French.")
Nation(French) END
CASE 2: //English END
Nation(English)
IF LoadError(… Tip
"ENGLISH.WDM") > 0 THEN
Several methods can be used to choose the project lan-
Error("Message file"+…
guage:
" not found. ",…
"The messages will be "+… • Stored in a parameter file. In this case, the change of

Part 4: Managing controls, windows and pages


"displayed in French.") language can be performed in the initialization process
END of the project and will apply with the first window of the
project.
• Chosen by a menu option. In this case, the menu will
be displayed in the default language and the change of
language will be performed when the next window is
opened.

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

12.6 Functions for managing the multilingual feature


The following functions are used to manage the multilingual features:
ChangeCharset Changes the character set used by all the screen fonts
ChangeKeyboard Retrieves and modifies the language associated with the keyboard
ChangeSeparator Changes the value of the separators (decimal separator or thousand separator) used in the
numeric masks for internationalization
LoadError Loads in memory the file containing the error messages in the requested language
LanguageToCharset Returns the character set corresponding to a language
LanguageToNation Returns the nation corresponding to a language
LanguageToName Returns the name of a language
MessTranslate Retrieves a message found in the code of a program in the current language
Nation Defines (or identifies) the display language (captions, messages, and so on) used for the win-
dows and controls
NationToLanguage Returns the language corresponding to a nation
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 317 Vendredi, 28. mai 2010 5:50 17

317

13. WINDOW, PAGE AND CONTROL PROPERTIES


The following properties are used to manage windows, pages and their controls:
Address Enables you to connect the stream with a recipient and to find out the address of the last
request for connection
Display Enables you to find out and modify the video currently displayed by the Conference control
DisplayEnabled Enables you to find out whether the refresh of the display is enabled for a control or window
and to enable or disable the refresh of the control or window
Alias WinDev: Enables you to find out and modify the alias of a window
WebDev: Returns the internal HTML/JavaScript name of a control or page
ZOrder Enables you to find out and modify the z-order position of a control
Anchor Enables you to find out the current anchor of a control and to modify the characteristics

Part 4: Managing controls, windows and pages


of the anchor for a control
ObserverOrientation Enables you to find out and modify the secondary angle of a carousel control. Enables you
to "rotate" the control.
Animation Enables you to find out the current status of the animated image and to start or stop
the animation of an image or an animated caption
InitialAnimation Enables you to find out the initial status of the animation in an image control or in a sta-
tic control
ScrollValue Enables you to find out and modify the scroll value of a scrollbar
XAxisMax Enables you to find out the upper bound on the X axis for a chart control.
XAxisMin Enables you to find out the lower bound on the X axis for a chart control.
YAxisMax Enables you to find out the upper bound on the Y axis for a chart control.
YAxisMin Enables you to find out the lower bound on the Y axis for a chart control.
BarVisible Enables you to find out whether the selection bar is visible on a column found in a table (or
in a treeview table) and enables you to make the selection bar visible or invisible on a table
column.
StatusBar Enables you to find out whether a window status bar is visible and to make the status bar of
a window visible/invisible
MaxValue Enables you to find out and modify the upper bound of a control
MinValue Enables you to find out and modify the lower bound of a control
Tooltip Enables you to find out and modify the text displayed in the tooltip associated with a
control
TooltipTitle Enables you to find out and modify the text displayed in the tooltip associated with the title
of a table column
HorizontalAlignment Enables you to find out and modify the horizontal alignment of a control
VerticalAlignment Enables you to find out and modify the vertical alignment of a control
Checked Enables you to find out whether a menu option has a checkmark ( ) or not and to display or
not this checkmark in front of a menu option
RightClick Enables you to find out and modify the name of the button that will be run when a right
click is performed on an object
CompactToolbar Enables you to find out whether the toolbars of the window are compacted and to com-
pact (or not) the toolbars.
InitialContent Enables you to find out the initial content of a memory list box or combo box
Color Enables you to find out and modify the color of the text displayed in a control
BrushColor Enables you to find out and modify the background color of a control
ProgressBarColor Enables you to find out the color of the bar (which means the color of the area that
moves) in a Progress Bar control, a Progress bar column or a Progress Bar cell
Cursor Enables you to find out and modify the position of the mouse cursor in a control
Tome1_2.book Page 318 Vendredi, 28. mai 2010 5:50 17

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

a column of "Currency + Euro" type by programming


DndTarget Enables you to find out and modify the behavior of the target control during "Drag and
Drop"
DndSource Enables you to find out and modify the behavior of the source control during "Drag and
Drop"
DoubleClick Enables you to find out and modify the name of the button that will be run when a dou-
ble click is performed on an object
RightToLeft Enables you to find out the text direction currently used in a control or in a column found in a
window.
Driver Enables you to find out the properties of the driver for video capture associated with a
Web Camera control
Timeout Enables you to find out and modify the time-out after which the connection is considered
"having failed"
AutomaticErase Enables you to manage the "Automatic erase" mode of an edit control.
Ellipse Enables you to find out and modify the management mode of the ellipse in a static control,
in a list box or in a Static table column
OutgoingData Enables you to find out and modify the type of data emitted by the stream
Pushed Enables you to find out and modify the status of an on/off button (pressed or not)
Collapsed Enables you to define the status (collapsed or expanded) that will be used when adding new
rows to the treeview table.
State Enables you to find out and modify the display status of a control, group of controls or
window
InitialState Enables you to find out the initial state of a control or a window
BrowsedFile Enables you to find out and modify the file or query used to display records in browsing
loopers, browsing tables, browsing lists or browsing combo boxes
Filter Enables you to find out and modify the filter used to display records in browsing loo-
pers, browsing files, browsing lists or browsing combo boxes
CursorEnd Enables you to find out/modify the position of the end selection of the mouse cursor
MemoryFormat Enables you to find out and modify the format of the value returned for the Date or
Time type edit controls or columns
Merge Enables you to find out whether the table cells (or the column titles) are merged, and to
merge the table cells (or the column titles).
Group Enables you to find out whether the control belongs (or not) to a group of controls
Height Enables you to find out and modify the height of a control, a window, a table row or list
row
ImageHeight Enables you to find out and modify the height of the image section that is displayed in
the image control
Tome1_2.book Page 319 Vendredi, 28. mai 2010 5:50 17

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

Part 4: Managing controls, windows and pages


ExpandedImage Enables you to find out/modify the default image for an expanded row in a treeview table.
CollapsedImage Enables you to find out/modify the default image for a collapsed row in a treeview table.
ImageState Enables you to find out and modify the number of drawings found in the image associa-
ted with a button or in the image associated with the cursor in a slider
BackgroundImage Enables you to find out and modify the background image of a window, the image asso-
ciated with a button border, the background image of a progress bar or slider
BackgroundImageState Enables you to find out and modify the number of drawings found in the image associa-
ted with the border of a button
ImageMode Enables you to find out and modify the display mode of an image in an image control
TitleImage Enables you to find out and modify the image displayed beside the title of a column
found in a table or in a treeview table.
Hint Enables you to find out and modify the help text displayed in an edit control. This text will
disappear as soon as a character is typed.
InterpretAmpersand Enables you to find out and modify the interpretation of the ’& character’
Width Enables you to find out and modify the width of a control, a window or a tale column
ColumnWidth Enables you to find out and modify the width of each column found in a multi-column looper
ImageWidth Enables you to find out and modify the width of the image section that is displayed in
the image control
InitialWidth Enables you to find out the initial width of a window or control and to modify the base
width used to anchor controls "in width"
MaxWidth Enables you to find out and modify the maximum width of a control or window
MinWidth Enables you to find out and modify the minimum width of a control or window
FileLink Enables you to find out and modify the link between a control and a file item
Caption Enables you to find out and modify the caption of a control, the title of a window or
page
AutomaticLink Enables you to find out the mode for automatic detection of links in the multi-line edit con-
trols and to enable or disable this mode.
InputMask Enables you to find out and modify the input mask
MDIBottom Enables you to find out and modify the distance between the bottom border of the MDI
parent window and the bottom border of the MDI area
MDIRight Enables you to find out and modify the distance between the right border of the MDI parent
window and the border border of the MDI area
MDILeft Enables you to find out and modify the distance between the left border of the MDI parent
window and the left border of the MDI area
MDITop Enables you to find out and modify the distance between the top border of the MDI parent
window and the top border of the MDI area
Tome1_2.book Page 320 Vendredi, 28. mai 2010 5:50 17

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

Part 4: Managing controls, windows and pages


BrowsedItem Enables you to find out and modify the item used to automatically browse tables, loo-
per controls, list boxes or combo boxes
HandwrittenInput Enables you to find out and modify the handwritten input mode in the RTF edit controls.
Selected Enables you to find out whether a row found in a list box or in a table is selected and to
select a row in a list box or in a table
TextDirection Enables you to find out and modify the writing direction used in a window or in a control
(useful for managing the languages such as Arabic or Hebrew).
SubCaption Enables you to find out and modify the secondary caption of an option found in a radio but-
ton.
BrushStyle Enables you to modify the display style of the background for the cells found in the tables
and/or in the treeview tables.
Size Enables you to find out and modify the maximum number of characters found in a con-
trol of a window or page
AnchorRateBottom Enables you to find out and modify the anchor rate when a control moves on the verti-
cal axis
AnchorRateRight Enables you to find out and modify the anchor rate when a control moves on the hori-
zontal axis
AnchorRateHeight Enables you to find out and modify the anchor rate in height of a control
AnchorRateWidth Enables you to find out and modify the anchor rate when a control stretches on the ver-
tical axis
SelectedText Enables you to find out and modify the text selected in an edit control, in an editable
combo box or in an editable table column.
Title Enables you to find out and modify the title of a table column, the title of a window or a
page
NoteTitle Enables you to find out and modify the caption used in the program documentation of a
control, a window or a page
TotalsEnabled Enables you to find out the operating mode of automatic calculations performed in a table
and to forbid (or force) the automatic calculations in a table
Sortable Enables you to find out whether a column can be chosen by the user as sort criterion
for the table and to allow/forbid the user from choosing a column as sort criterion for
the table
Sorted Enables you to find out whether a memory list box or combo box is sorted and to make
a memory list box or combo box sortable
TriState Enables you to find out and modify the management mode for an option of a check box
Type Enables you to find out the type of an object
InputType Enables you to find out the type of an edit control or table column
Unicode Enables you to find out whether a control has a Unicode value and to indicate whether a
control has a Unicode value
Tome1_2.book Page 322 Vendredi, 28. mai 2010 5:50 17

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. HANDLING NUMERIC VALUES


1.1 Overview
A large number of programming functions enable you to: • handle binary values,
• manage numeric values, • use matrices,
• perform trigonometric calculations, • perform financial and statistical calculations.

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.

1.2.1 Definition 1.2.2 Handling matrices


A matrix is an organized set of "n p" numbers, displayed Several WLanguage functions enable you to manage
in an array of n rows and p columns. matrices. These functions start with "MAT". These func-
The numbers found in the matrix are the matrix elements. tions enable you to:
Each element is identified by its row and by its column. A •handle matrices (creation, copy, inversion, compres-
value is associated with each element. sion, deletion),

Part 5: Standard Functions


•initialize the elements of the matrices,
•read the value of the elements found in the matrices,
•perform various calculations on the matrices (addi-
tion, multiplication, transposition, determinant, etc.),
•get various information about the matrices (number
of rows, number of columns, etc.)
Example
In this matrix, n = 2 rows and p = 4 columns. The value of To perform financial calculations, your program creates
the element (row 2, column 3) is 7. several matrices. The matrix elements can be initialized.
Several calculations are possible on these matrices.
The dimension (or size) of the matrix corresponds to the

1.3 The statistics


A large number of WLanguage functions let you compute 4, 5 and 6.
statistics.
The statistics are calculated from matrices. The values
taken into account for calculating the statistics are the
values of the elements of a matrix. The series of values
correspond to a row (or a column) of the matrix.
For example, the values of row 1 for this matrix are 3, 2,
Tome1_2.book Page 326 Vendredi, 28. mai 2010 5:50 17

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.

1.4 Financial calculations


A large number of WLanguage functions let you perform The functions used to perform financial calculations start
various financial calculations. These calculations are per- with "Fin". These functions enable you to:
formed using matrices. The values taken into account for • calculate the amortization of a good using different
these calculations are the values of the elements of a methods,
matrix. The series of values correspond to a row (or a • calculate the standard deviation, etc.
column) of the matrix.

1.5 Functions for managing numeric values


1.5.1 Miscellaneous functions
The following functions are used to manage numeric values:
Abs Calculates the absolute value of a numeric expression (integer or real)
ArcCos Calculates the arc cosine of a numeric value (integer or real)
ArcSin Calculates the arc sine of a numeric value (integer or real)
ArcTan Calculates the arc tangent of a numeric value (integer or real)
Round Calculates the rounded value of a numeric value according to the specified number of deci-
mals
Cos Calculates the cosine of an angle
CoTan Calculates the cotangent of an angle
IsOdd Identifies an odd number
IsEven Identifies an even number
Part 5: Standard Functions

Exp Calculates the exponential of a numeric value


Random Returns a random number
InitRandom Initializes the generator of random numbers
Ln Calculates the Napierian logarithm of a numeric value
Log Calculates the logarithm of a numeric value
Max Returns the greatest of the values passed in parameter
Min Returns the smallest of the values passed in parameter
NumToString Returns a character string corresponding to the number passed as a parameter based on a
described format
DecimalPart Returns the decimal part of a number
IntegerPart Returns the integer part of a number
Power Raises a number to a power
Root Calculates the root of a number
Sin Calculates the sine of an angle
Tangent Calculates the tangent of an angle
See the online help for more details about the availability of these functions in the various products (WinDev, WebDev,
WinDev Mobile).
Tome1_2.book Page 327 Vendredi, 28. mai 2010 5:50 17

327

1.5.2 Binary functions


The following functions are used to manage binary values:
BinaryAND Returns the result of a logical AND (bit by bit) between two values
BinaryNOT Returns the result of a logical NOT (bit by bit) performed on a value
BinaryOR Returns the result of a logical OR (bit by bit) between two values
BinaryXOR Returns the result of a logical exclusive OR (bit by bit) between two values
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).

1.5.3 Matrix functions


The following functions are used to manage the matrices:
MatAdd Adds two matrices of the same dimension
MatStack Compresses the memory footprint occupied by a matrix
MatCopy Creates the copy of a matrix
MatCreate Creates a matrix
MatDeterminant Calculates the determinant of a square matrix
MatWrite Writes an element into a matrix
MatError Identifies the type of the last error caused by a function for matrix management
MatExist Checks the existence of a matrix in memory
MatInvert Inverts a square matrix
MatRead Reads the value of a matrix element
MatReadColumn Reads the value of all the elements found in a matrix column
MatReadLine Reads the value of all elements found in a matrix row
MatMultiply Multiplies two matrices

Part 5: Standard Functions


MatNbColumn Returns the number of columns found in a matrix
MatNbLine Returns the number of rows found in a matrix
MatFloatAdd Adds a value to each matrix element
MatFloatMultiply Multiplies each matrix element by a value
MatFill Initializes all the elements found in a matrix of a given size
MatDelete Deletes an existing matrix
MatTranspose Calculates the transposed matrix
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 328 Vendredi, 28. mai 2010 5:50 17

328

1.5.4 Financial functions


The financial functions are as follows:
FinRedemption Creates an amortization matrix for a fixed-rate loan over a defined period of time
FinDecreasingRedemption Calculates the amortization value of a good over a specific period of time, via the
formula for fixed-rate decreasing amortization
FinLinearRedemption Calculates the value of linear amortization of a good over a specific period of time
FinError Returns the number of the last error caused by a financial function
FinPeriodInterest Calculates for a given period the amount of interests due for a loan paid off by fixed
periodic payments with a fixed interest rate
FinPaymentNb Returns the number of payments required to pay off a capital according to a given
rate
FinInterestRate Calculates the interest rate for a loan over a given period of time with fixed pay-
ments
FinCurrentVal Returns the current value of an investment
FinNetCurrentVal Returns the net current value of an investment according to variable financial flows
FinFutureVal Returns the future value of an investment (regular fixed payments with fixed interest
rate)
FinRepayVal Returns the amount of each regular payment of an investment with fixed interest
rate and fixed payment
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).

1.5.5 Statistical functions


The statistical functions are as follows:
StatCorrelation Calculates the coefficient of correlation between two series of values
Part 5: Standard Functions

StatCovariance Calculates the covariance between two series of values


StatAverageDeviation Calculates the average deviation of values in relation to their arithmetic mean
StatStandardDevia- Calculates the standard deviation for a series of values
tion
StatStandardDevia- Calculates the standard deviation for a full series of values
tionP
StatError Returns the number for the last error caused by a statistical function
StatMax Calculates the maximum value for a series of values
StatMin Calculates the minimum value for a series of values
StatAverage Calculates the arithmetic, geometric or harmonic mean for a series
StatSum Calculates the sum for a series of values
StatVariance Calculates the variance for a series of values
StatVarianceP Calculates the variance for a full series of values
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 329 Vendredi, 28. mai 2010 5:50 17

329

2. HANDLING THE CHARACTER STRINGS


WLanguage functions enable you to perform several
types of operations on character strings. You can:
• handle the content of the string,
• perform conversions and encryptions.

2.1 Handling the content of a string


The WLanguage functions allow you to extract part of a •convert a string into ANSI or UNICODE format (Ansi-
character string (Left, Right or Middle for instance) as ToUnicode and UnicodeToAnsi),
well as perform searches in a string (Position or Replace •encrypt of decrypt a character string (Crypt and
for instance). Uncrypt),
Some features offered by the WLanguage functions can •convert a character string into phonetics (Phone-
also be performed using the WLanguage string opera- tics).
tors.
Several WLanguage functions enable you to easily con- Note: for all the types of string/date or string/time con-
vert and encrypt character strings. versions, see the ’Handling dates and times’ chapter,
page 346.
You can for instance:
•convert a string into ANSI or OEM format (AnsiToOem See ’Character string operators’, page 207, for more
or OemToAnsi), details.

2.2 WinDev and the Unicode format

Part 5: Standard Functions


2.2.1 What is the UNICODE format UnicodeToAnsi Converts a character string in Uni-
The Unicode format is an encoding system that assigns a code format into a character string in
unique number to each character. This encoding is per- ANSI format (Windows).
formed on 16 bits. This number can be read regardless of • the use of functions for handling character strings
the platform, software or language used. (Right, Left, Middle, Length, VarType, …).
The UNICODE format can support all the writing systems • Adds a constant to find out whether the a string is an
of the planet. ANSI string or a Unicode string
• the use of operators for handling the character strings
2.2.2 WinDev and Unicode - the concatenation operator (+)
To manage the UNICODE format, WinDev proposes: - comparison operator (=)
• the UNICODE string - the extraction operator ([[ ]])
• two conversion functions: - comparison operator (<>)
AnsiToUnicode Converts a character string in ANSI • the use of functions for handling text files (fWrite, fWri-
teLine, fRead, fReadLine, fOpen).
format (Windows) into a character
string in UNICODE format.
Tome1_2.book Page 330 Vendredi, 28. mai 2010 5:50 17

330

2.3 Handling character strings in Pocket PC


The default format of the character strings on PC differs supports the different formats of character strings in a
from the default format of the character strings on Pocket way that is completely transparent for the developer and
PC. for the user.
Usually on PCs, Windows applications handle character Text files
strings in ANSI format. While on Pocket PCs, Windows
applications for Pocket PC handle character strings in In pocket PC, when using text files containing character
UNICODE format by default. string in ANSI format, WinDev automatically converts
these character strings into the UNICODE format. This
Character string conversion is performed even if the opening of this file in
In most cases, the character strings are handled the ANSI format is explicitly requested. This conversion is
same way by the WLanguage functions in WinDev Mobile completely transparent.
and in standard WinDev. WinDev Mobile automatically

2.4 Functions for managing the character strings


The following functions are used to manage character strings:
AnsiToOem Transforms a character string in ANSI format (Windows) into a character string in OEM for-
mat (DOS)
AnsiToUnicode Converts a character string in ANSI format (Windows) into a character string in UNICODE for-
mat
Asc Calculates the ASCII code of the specified character (the ASCII code used corresponds to
the ANSI standard used by Windows)
Charact Returns the character corresponding to the specified ASCII code (the ASCII code used cor-
responds to the ANSI standard used by Windows)
StringCompare Compares two character strings
Part 5: Standard Functions

StringBuild Builds a character string according to a format and to parameters


StringFormat Formats a character string according to the selected options
StringCount Calculates the number of occurrences of a specific character string inside another character
string
StringRetrieve Retrieves a character string in a format external (C, etc.)
StringToDate Transforms a date in character string format into a date in YYYYMMDD format
StringToArray Fills a one or two dimensional array with the content of a string.
StringToUTF8 Converts a string in ANSI or UNICODE format into a string in UTF8 format
Complete Returns a character string of a given length (this string may be truncated or filled with spaces
- or another character - to reach the requested length)
CompleteDir Adds (if necessary) the "\" character at the end of a character string
Compress Compresses a string or a memory block (buffer) in binary format
Crypt Encrypts a character string in binary format or in ASCII format
UncompleteDir Removes (if necessary) the "/" or "\" character found at the end of a string
Uncompress Decompresses a character string or a memory block (buffer) previously compressed by
Compress
Uncrypt Decrypts a character string previously encrypted by Crypt
Deserialize Converts a string or buffer to a structure, class or array (with their sub-elements)
Right Extracts the right part of a character string (which means the last characters)
ExtractString Extracts a sub-string from a character string, according to a given string separator
Left Extracts the left part of a character string (which means the first characters)
HTMLToRTF Transforms a character string or a buffer in HTML format into a text in RTF format.
HTMLToText Converts a character string or a buffer in HTML format into a text.
Tome1_2.book Page 331 Vendredi, 28. mai 2010 5:50 17

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)

Part 5: Standard Functions


UTF8ToString Converts a string in UTF8 format into a string in ANSI or UNICODE format
URLDecode Decodes an encoded URL (I.e. an URL with %xx characters)
URLEncode Encodes a URL with a sub-set of ASCII characters
Val Returns the numeric value of a character string (useful to perform numeric calculations on
character strings)
MatchRegularExpres- Checks whether a character string matches a specific format and retrieves the
sion different sub-strings that constitute the format
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 332 Vendredi, 28. mai 2010 5:50 17

332

3. HANDLING THE DATES AND TIMES


3.1 Overview
There are many ways you can handle dates and times in • The Date, Time, DateTime and Duration variables,
your applications: • The properties associated with Date, Time, DateTime
• The Date or Time edit controls, and Duration variables,
• The Date or Time file items, • The WLanguage functions for managing the dates and
times.

3.2 Different methods for handling the dates and times


Depending on the type of operation performed on the • to get information about the dates and times (validity
dates and times, it may be more efficient to use the varia- of the date or time, spell out the day, etc.)
bles or the functions of WLanguage. The use of variables is recommended:
The WLanguage functions are recommended: • all the calculations performed on dates and times
• to format the dates and times as well as to perform (interval, duration calculation, and so on),
conversion operations (convert a date into an integer, • extracting part of a date or time (day, month, year).
etc.),

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

3.4 Functions for managing the dates and times


The following functions are used to manage the dates and times:
Age Returns the age according to the date of birth
StringToDate Transforms a date in character string format into a date in YYYYMMDD format
StringToDuration Transforms a duration in character string format into a duration that can be used by
a Duration variable
ChronoStart Starts a stopwatch to find out the duration of a process (in milliseconds) and
resets an existing stopwatch
ChronoEnd Stops a stopwatch and returns the time passed (in milliseconds) since the start of
timing (call ChronoStart).
ChronoValue Returns the time passed since the call to ChronoStart
DateDifference Calculates the number of days between two dates
Today Returns or modifies the system date
DateTimeDifference Calculates the difference between two dates and times
DateTimeLocalToUTC Converts a date and a time expressed in local time (time zone, daylight savings)
into a date and time expressed in universal time (UTC)
DateTimeByDefault Enables you to define the default value of the Date, Time and DateTime variables
Tome1_2.book Page 333 Vendredi, 28. mai 2010 5:50 17

333

DateSys Returns or modifies the system date


DateValid Checks the validity of a date found between January 01 0001 and December 31
9999
DateToString Formats the specified date into the specified format
DateToInteger Converts a date into an integer
DateToDay Returns the day corresponding to a given date
DateToDayInAlpha Returns and spells out the day of the week corresponding to the specified date
DateToMonthInAlpha Returns and spells out the month corresponding to the specified date
DateToWeekNumber Returns the number of the week corresponding to the specified date
DurationToString Formats the specified duration into the specified format
IntegerToDate Transforms an integer into a date in "YYYYMMDD" format
IntegerToTime Transforms an integer into a time in "HHMMSSCC" format
IntegerToDay Returns the day of the week corresponding to the specified date
IntegerToDayInAlpha Spells out the day of the week corresponding to the specified date
IntegerToMonthInAlpha Returns and spells out the month corresponding to the specified date
IntegerToWeekNumber Returns the week number in the year corresponding to the date
TimeDifference Calculates the difference between two times in hundredths of second
TimeSys Returns or modifies the system time
TimeValid Checks the validity of a time
TimeToString Formats the time passed as parameter according to the "HH:MM:SS:CC" format
TimeToInteger Transforms a time into an integer
BankHoliday Specifies whether a day is a bank holiday or not.
BankHolidayAdd Indicates that a day (or a list of days) is a bank holiday.
BankHolidayDeleteAll Clears the list of all the bank holidays.
Now Returns or modifies the system time
WeekNumber Returns the week number in the year corresponding to the date

Part 5: Standard Functions


Easter Returns the date for Easter of a given year
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 334 Vendredi, 28. mai 2010 5:50 17

334

4. HANDLING THE CHARTS WD WM WebDev

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.

4.2 The different types of charts


The different types of charts are as follows: 1. Start angle. 2. Title of the chart. 3. Legend. 4. Section
•pie chart, Label. 5. Section color. 6. Raised. 7. Caption of section.
•bar chart,
4.2.2 The "Bar" charts
•line chart,
The data points are interpreted as "bars" whose height
•scatter chart, is proportional to the value of the data point.
•stock chart, The bar charts are used to represent the data trend over a
•3d chart. given time period. They are also used to perform compa-
risons between elements.
4.2.1 The "Pie" charts The categories are organized horizontally and the values
A pie chart represents a circle divided into sections. The are organized vertically in order to highlight their variation
size of each section is proportional to the data found in over time.
the series.
Part 5: Standard Functions

A pie chart displays a single series of data. It is used to


highlight a particularly important element.

1. Caption of data. 2. Title of the vertical axis. 3. Mark. 4.


Title of the chart. 5. Legend. 6. Series label. 7. Color of
series. 8. Caption of category. 9 Spacing. 10. Raised. 11.
Gridlines.
Tome1_2.book Page 335 Vendredi, 28. mai 2010 5:50 17

335

4.2.3 The "Line" charts 4.2.5 The "Stock" charts


In the Line charts, the data is interpreted as series of The Stock charts are used to represent the variations in
points. Then, the dots found in each series are linked by a the values of shares. Three types of stock charts are
line. available:
• Candlestick

1. Title of the chart. 2. Title of the vertical axis. 3. Mark. 4. • Barcharts


Legend. 5. Series label. 6. Color of series. 7. Caption of
category. 8. Title of horizontal axis. 9. Gridlines.
The line charts are mainly used to represent the data
trend.

4.2.4 The "Scatter" charts


A scatter chart (XY) represents the relationship between
two numeric values in two series of data. The odd series
are used to identify the x-coordinate of the points while
the even series are used to identify the y-coordinate of
the same points. The scatter charts highlight regular
intervals and they are also used to group the data. • Minmax

Part 5: Standard Functions


The "scatter" charts are often used to represent scienti-
fic data.

4.2.6 3D charts
All types of charts can be displayed in 3D.

1. Title of the vertical axis. 2. Y value. 3. Mark. 4. Title of


the chart. 5. Legend. 6. Series label. 7. Color of series. 8.
X value. 9. Title of horizontal axis.
Tome1_2.book Page 336 Vendredi, 28. mai 2010 5:50 17

336

4.3 How do I create charts?


4.3.1 Creating charts in the editors troyed at the end of this thread. The chart exists in the
A chart control is available in the window editor, page thread that contains the call to grCreate.
editor and report editor. When creating this control, the
wizards ask you questions to define the type of chart to 4.3.4 Default values of a chart
create. The default values for a chart are as follows:
The description window of the control enables you to • WinDev popup menu enabled (can be configured by
modify these options at any time. grMenu and grMenuOption).
The WLanguage functions can also be used to modify the • Automatic marks on the axes (can be configured by
charts displayed in the Chart controls. To do so, specify grGraduate).
the name of the Chart control in the different functions. • The colors are selected according to a preset order
among a set of 13 colors (can be configured by grSe-
4.3.2 Creating charts by programming riesColor).
There are about fifty functions available for managing • Gradient colors (can be configured by grGradient).
charts. These functions enable you to create charts, • WinDev file size (can be configured by grWndSize).
modify them, change the display options, etc.
• WinDev window size (can be configured by grWnd-
Size).
The operations to perform are as follows: • WebDev image size (can be configured by grImage-
1. Create the chart using grCreate. Size).
2. Initialize the chart’s data with the following functions: • No label for the series (can be configured by grSeries-
•grAddData, for line and pie charts, … Label).
•grScatterAddDataXY for the scatter charts, • No caption for the elements (can be configured by
•grStockAddData for stock charts. grCategoryLabel and grLabel).
3. Choose the destination of the chart with: • No legend (can be configured by grLegend).
•grDestinationControl to display the chart in an • No title for the chart (can be configured by grTitle).
image control, • No title for the axes (can be configured by grAxisTitle).
Part 5: Standard Functions

•grDestinationWnd to display the chart in an inde- • No gridlines (can be configured by grGridLines).


pendent WinDev window, • No data (elements can be added by grAddData).
•grDestinationBmp, grDestinationEmf or grDestina- • No destination (can be configured by grDestination-
tionWMF to save the chart directly in files in BMP, Control, grDestinationWnd and grDestinationWMF).
EMF or WMF format respectively. • No display of the chart (the chart can be drawn by
4. Draw the chart with grDraw. grDraw).
Several functions enable you to configure and modify the • No raised effect (can be configured by grRaised).
chart appearance. You have the ability to display a • For the pie charts, the start angle is equal to 0 (can be
legend, the title of the axes, etc. configured by grPieStartAngle).
4.3.3 Charts and threads • For the bar charts and the MinMax charts, the spacing
between two categories is equal to 10 pixels (can be
A single chart can be handled in a thread. configured by grColumnSpacing).
Consequences: • For scatter charts, the points are linked and their size is
•Two threads cannot handle the same chart. equal to 1 (can be configured by grScatterLinkPoint
•A chart created in a thread is automatically des- and grScatterPointSize).

4.4 Examples supplied with WinDev


WinDev is supplied with several examples for managing •WD Smoothing lines: this example smooths out a line
charts: chart.
•WD Stock chart: this example draws the different
types of charts (stock charts and others).
Tome1_2.book Page 337 Vendredi, 28. mai 2010 5:50 17

337

4.5 Functions for managing charts


The following functions are used to manage charts:
grAddData Adds data to a chart
grStockAddData Adds data to a stock chart
grTooltip Displays and formats the tooltip associated with a chart
grLoadParameter Restores the parameters used to draw a chart.
grColor Returns and initializes the color of the different chart elements.
grSeriesColor Initializes the color of a series or the color of a pie section
grCreate Creates a specific type of chart
grCreateFont Creates a font for the charts
grGradient Displays the colors in gradient mode or not
grDraw Draws a chart according to the specified parameters
grDestinationBMP Defines a file in BMP format as destination of the chart
grDestinationControl Defines an image control as destination of the chart
grDestinationEMF Defines a file in EMF format as destination of the chart
grDestinationWnd Defines a window as destination of a chart
grDestinationWMF Defines a meta file as destination of the chart
grDonutHolePercentage Modifies the percentage corresponding to the radius of the hole in a donut chart.
grClearPict Erases the drawing of a chart
grLineThickness Changes the value of the line thickness in a line chart
grCategoryLabel Initializes the label of a data category (or section) in a chart
grSeriesLabel Initializes the label of a data series in a chart
grExist Checks the existence of a chart in memory
grWndSize Defines the size of the window containing the chart
grGraduate Indicates the frequency of the marks on the vertical/horizontal axis of a chart

Part 5: Standard Functions


grColumnSpacing Indicates the spacing between each data category in a bar chart
grPrint Prints a chart
grIncreaseData Adds a value to a data in a chart
grInfoPoint Returns the screen coordinates of a point or the coordinates of a value found in a
chart.
grInfoXY Returns information about the series found at a specific point of the chart
grLegend Indicates the presence and position of the legend in a chart
grLabel Indicates various parameters of additional legend in a chart
grSmoothing Smoothes a chart with the "cubic splines" algorithm
grAutoRefreshCategoryLa- Identifies or defines whether the category labels are updated whenever the chart is
bel drawn
grAutoRefreshSeries Defines whether a series is refreshed whenever the chart is drawn
grMask Defines a display mask for the value of the additional legend
grMenu Enables or disables the popup menu of a chart
grScatterAddDataXY Adds data to a "Scatter" chart
grScatterSeriesColor Initializes the color of a series in a "Scatter" chart
grScatterSeriesLabel Initializes the label of a data series in a "Scatter" chart
grScatterLinkPoint Links (or not) the points found in a "Scatter" chart
grScatterPointSize Defines the size of the points found in a "Scatter" chart
grMenuOption Modifies the text of an option in the popup menu of a chart
grOrientation Modifies the orientation of the chart axes
grOrigin Modifies the start and end marks on the horizontal or vertical axis of a chart
gr3DSParameter Retrieves or modifies a parameter for drawing a chart in 3D spatial mode
Tome1_2.book Page 338 Vendredi, 28. mai 2010 5:50 17

338

grParameter Retrieves or modifies a chart parameter.


grLabelFont Modifies the font used for the labels of a chart
grLegendFont Modifies the font used for the legend of a chart
grTitleFont Modifies the font used for the title of a chart
grAxisTitleFont Modifies the font used for the titles of the chart axes
grGridlines Displays or hides the gridlines of a chart
grRaised Indicates the depth of the raised sections for the 3D charts
grSaveBMP Saves a chart that was drawn beforehand in BMP format
grSaveEMF Saves a chart that was drawn beforehand in EMF vectorial format
grSaveParameter Saves the parameters of a chart as a compressed string
grSaveWMF Saves a chart that was drawn beforehand in EMF vectorial format
grPieStartAngle Indicates the start angle of the first section in a pie chart
grPiePullOut Pulls out a section in a pie chart
grSourceCategoryLabel Defines the source of the category labels
grSourceSeries Defines the source of a series
grOverlayChart Enables you to display two different types of charts in the same chart
grDeleteSeries Deletes a data series from a chart
grDeleteAll Erases a chart and deletes this chart
grImageSize Modifies the size of the image containing the chart
grTitle Modifies the text and/or the position of a chart title
grAxisTitle Defines the title for one of the chart axes
grType Modifies or returns the type of a chart
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 5: Standard Functions
Tome1_2.book Page 339 Vendredi, 28. mai 2010 5:50 17

339

5. MANAGEMENT OF THE EURO


Since January 1 2002, the Euro becomes the only cur- pean currencies do no longer exist.
rency in most European countries. A large number of features enable you to take this new
Since February 28 2002, the Franc and the other Euro- currency into account in your applications and sites.

5.1 Managing the Euro in an application or a site


5.1.1 The tools available to the user 5.1.2 The solutions for the developer
Some examples of Euro management in a WinDev appli- A large number of tools are available to simplify the
cation: management of the Euro currency in your applications
• The user can easily choose a currency via a popup and sites.
menu displaying the value entered in all the currencies • A special type of control: the "Currency + Euro" type.
associated with the Euro. This type of control can be used in windows and pages
• Via the dual display, the value entered by the user is (edit controls, table columns) as well as in reports
automatically converted and displayed in a "Tracker" (item controls, calculated controls). This type of control
control. Therefore, an amount entered in Francs is enables you to manage tooltips, dual display and
automatically converted into Euro in a second edit con- popup menus.
trol. • Several WLanguage properties associated with the
• A tooltip automatically displays the conversion in "Currency + Euro" controls
Francs of the value entered in Euro. • Several WLangage functions allowing you to manage
the different currencies and the conversions.

5.2 Currency + Euro type

Part 5: Standard Functions


The Euro must be supported in all the controls used to mal places.
enter or display currency values: The results can be displayed in any currency chosen via
•edit controls, the "Input/Display currency". The conversion will be
•table columns (memory or browsing table), automatically performed.
•calculated controls or item controls in a report. The stored currency associated with a control can be
All these controls can be defined as "Currency + Euro" modified by programming by using MemoryCurrency.
controls. Caution: to prevent errors, you should use the same num-
The characteristics specific to this type of control are as ber of decimal places:
follows: •in the display mask and in the input mask of the con-
•stored currency, trol,
•input/display currency, •in the rounding of the stored currency.
•WinDev tooltip, Configuring the stored currency
•WinDev dual display. The stored currency is chosen in the window editor, page
editor or report editor from a list displaying the different
5.2.1 Stored currency currencies. This list contains:
The stored currency corresponds to the currency of the •the number identifying the currency,
value returned to the program or transferred into an item. •the abbreviation of the currency according to the ISO
The stored currency is used for all the calculations that standard,
will be performed in the application or site. •the name of the country corresponding to this cur-
You have the ability to specify the number of decimal pla- rency.
ces taken into account by this stored currency (5 by
default). The value found in the stored currency will be
automatically rounded according to the number of deci-
Tome1_2.book Page 340 Vendredi, 28. mai 2010 5:50 17

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.

Part 5: Standard Functions


Operating mode of dual display for a strong>table
Configuring the dual display
column
The tracker control is selected in the window editor or in
Most of the time, the column used for dual display corres-
the report editor in the characteristics of the control. Win-
ponds to a calculated column: its operating mode is simi-
lar to the one of the calculated columns. Dev automatically proposes the list of "Currency + Euro"
controls found in the current window or report.
For a browsing table, the column used for dual display
must be initialized in the display code of a table row. The
Tome1_2.book Page 342 Vendredi, 28. mai 2010 5:50 17

342

5.3 Creating an application or a site that manages the Euro


5.3.1 The different steps - specify the stored currency.
The creation of an application or a site supporting the 5. Initialize the exchange rate of the currencies not used
Euro is as simple as creating a regular application or site. in the program with eInitCurrency: use an exchange rate
The operations to perform are as follows: of 0.
1. Create your project. 6. Test your application or your site.
2. Create the associated analysis. The items used to 7. Create the WinDev/WebDev library, then the executa-
store currencies must be "Currency" items. ble if needed.
3. Generate the analysis. 8. Create the installation of the application or site.
4. Describe the windows, pages, reports, ... For each cur-
rency value that must be supported: 5.3.2 The Euro in your data files
- specify that the associated control (edit control, table Your application or your site manages Euros only
column or report control) must be a "Currency + The display in francs is given for information only: your
Euro" control, data files can store the Euro values only.
- specify the display currency,

5.4 Properties linked to the Euro management


The following properties are used to manage the Euro in: Euro" edit control.
• "Currency + Euro" type edit controls and table colu- MemoryCurrency
mns in windows and pages,
Enables you to find out and modify the currency used
• The "Currency + Euro" item controls and calculated when handling a "Currency + Euro" edit control by pro-
controls found in reports. gramming.
DisplayCurrency See ’Window, page and control properties’, page 331, for
Enables you to find out and modify the currency used more details.
Part 5: Standard Functions

when displaying or entering a value in a "Currency +

5.5 Functions for Euro management


The following functions are used to manage the Euro:
eChangeCurrency Converts a currency into another currency
eDefaultViewCurrency Identifies or modifies the display currency used by default
eDefaultMemCurrency Identifies or modifies the stored currency used by default
eRoundDifference Returns the rounding difference between the displayed value of a "Currency + Euro"
control and the associated control used for dual display
eInitCurrency Adds or modifies the characteristics of a currency in the exchange table of currencies
eCurrencyName Returns the caption of a currency
eExchangeRate Returns the value of the exchange rate for a currency
eToCurrency Converts a value expressed in Euro into another currency
eToEuro Converts into Euros a value expressed in a specific currency
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 343 Vendredi, 28. mai 2010 5:50 17

343

6. HANDLING THE MEMORY ZONES WD WebDev

The following functions are used to manage memory zones:


MemAdd Adds an element to a memory zone
MemCreate Creates a memory zone
MemLast Points to the last element of a memory zone and returns the value of this element
MemCurrent Returns the subscript of the current element
MemOut Enables you to find out whether the browse performed on the memory zone is outside the memory
zone
MemExist Checks the existence of a memory zone
MemModify Modifies an element in a memory zone
MemCount Returns the number of elements found in a memory zone
MemSetPosition Positions the memory zone on an element
MemPrevious Points to the previous element of a memory zone and returns the value of this element
MemFirst Points to the first element of a memory zone and returns the value of this element
MemSeek Seeks an element in a memory zone
MemRetrieve Retrieves the value of an element in a memory zone
MemNext Points to the next element of a memory zone and returns the value of this element
MemDelete Deletes an element from a memory zone
MemDeleteAll Clears and deletes a memory zone
MemSort Sorts the elements found in a memory zone
MemFound Checks whether the sought element was found
MemKeyVal Returns the value (added or modified by MemAdd or MemModify) of the current element in a
memory zone

Part 5: Standard Functions


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 344 Vendredi, 28. mai 2010 5:50 17

344

7. HANDLING EXTERNAL FILES


7.1 Overview
A large number of WLanguage functions let you manage files. The HyperFileSQL files are data files in a WinDev/
external files. WebDev format and they must be handled by the Hyper-
An external file is a file with direct access, also called FileSQL functions.
"text file". The external files can have any type (".TXT", Three groups of functions let you work with:
".INI", etc.). The external files can contain:
•the content of your external files,
•readable characters (in character string format),
•the files found on your disks (file copy for instance),
•non-readable characters (in binary format).
•the directories of your disks (directory creation for
instance).
Caution: do not confuse external files with HyperFileSQL

7.2 Handling the content of external files


You can: 64KB. This ".INI" file is too large to be handled by the INI
•create, open and close your external files, functions. The functions for managing the external files
•manage the locking of your external files, enable you to handle this file.
•read the content of your external files: read a line or a To retrieve the content of this file: read the content of the
block of bytes (characters), file and assign the information read into a section of
memory.
•write into your external files: write a line, a character
string ot a section of memory, To modify the content of this file: add various information
to this file at a given position.
•move inside your external files.
Part 5: Standard Functions

This file must be partially locked in order to be updated:


Example lock the file. This file will only be accessible by the appli-
Your program manages a ".INI" file whose size exceeds cation or the site that locks it.

7.3 Handling files


You can: Example
•compress and encrypt the files, Your program manages large files containing confidential
•find out the characteristics of a file, information. Encrypt and compress these files before
•find out and modify the name and path of the files, transferring them by network.
•compare the content of several files, Perform a search on your files and run a specific proce-
dure on the files found.
•list the files found in a directory by running a proce-
dure that performs a process on each file.

7.4 Handling disks and their directories


You can:
•find out information about the accessible directories
and disks,
•handle the directories.
Tome1_2.book Page 345 Vendredi, 28. mai 2010 5:50 17

345

7.5 Functions for managing external files


The following functions are used to manage external files:
CompleteDir Adds (if necessary) the "\" character at the end of a character string. This function is use-
ful for building full file names when the format of the path is unknown (if the user enters a
file path for instance)
UncompleteDir Removes the "/"’ or "\"’ character found at the end of a string. This function is useful for
building full file names when the format of the path is unknown (if the user enters a file
path for instance)
fAttribute Identifies or modifies the attributes of a file
fAttributeReadOnly Identifies or modifies the "Read-only" attribute of a file
fLock Entirely or partially locks an external file
fChangeSize Resizes a file
fLoadText Loads the content of a text file into any text control or text variable (string variable, edit
control in a window or page, static control in a report, etc.)
fShortPath Returns the full short path of a file or directory
fLongPath Returns the full long path of a file or directory
fCompress Compresses a file
fCompare Compares the content of two files bit by bit
fCopyFile Copies a file
fCreate Creates a new external file
fCrypt Encrypts a file in binary format or in ASCII format
fDate Returns or modifies the different dates associated with a file (creation, modification or
access)
fUnlock Entirely or partially unlocks an external file
fUncompress Decompresses a file
fUncrypt Decrypts a file previously encrypted by fCrypt

Part 5: Standard Functions


fMoveFile Moves a file. You have the ability to rename it
fDetectRemovableSto- Detects whether a removable storage unit (CD, USB key, USB camera, …) was added or
rage removed
fCurrentDrive Returns or modifies the current disk
fDriveInfo Returns information about a disk
fDriveReady Enables you to find out whether the floppy drive is available or whether the disk exists
fWrite Writes a character string or a memory section into an external file
fWriteLine Writes a line into an external file
fExtractPath Returns the different elements of a path: drive, directories, name and extension of the file
fClose Closes an external file
fFileExist Checks the existence of an external file
fTempFile Returns the name of a unique temporary file
fGraphicFilter Returns the list of image formats supported by WinDev, in the format expected by the filter
of fSelect
fTime Returns or modifies the different times associated with a file: creation, modification or
access
fListFile Lists the files found in a directory (and the files found in the sub-directories of the direc-
tory) and returns the number of listed files
fListDirectory Lists the directories of a given directory (and its subdirectories) and returns the number of
listed subdirectories
fRead Reads the content of an external file and assigns it (or not) to a memory section
fReadLine Reads a line in an external file
fShortName Returns the short name of a file or directory
fNameOfFile Returns the name of an external file currently opened.
Tome1_2.book Page 346 Vendredi, 28. mai 2010 5:50 17

346

fLongName Returns the long name of a file or directory


fOpen Opens an external file
fOpenTempFile Creates and opens a temporary file. A unique name is given by the system to each tempo-
rary file
fSeek Returns and modifies the current position in an external file
fRename Renames a file
fDir Searches for a file or for a directory
fDirAttribute Returns the attributes of a directory
fCopyDir Copies a directory and its content
fMakeDir Creates a directory
fMoveDir Moves a directory and its content
fDataDir Returns the full path of the directory for the HyperFileSQL data files
fDataDirCommon Returns a directory path for the data shared. This data is shared among all the computer
users.
fDataDirUser Returns a directory path for the data of the current application. This data is specific to the
current user for the current application.
fDirAttrib Identifies the access rights granted to a user for a specified directory
fCurrentDir Identifies or modifies the current directory
fDirectoryExist Checks the existence of a directory
fTempPath Returns the name of the directory where the system stores the temporary files
fReportsAndQueriesDir Returns the full path of the directory for custom or shared reports and queries
fExeDir Returns the full path of the project’s runtime directory
fGlobalDirCommon Returns a directory path for the global data of the current application (data shared among
several applications), regardless of the current user.
fGlobalDirUser Returns a directory path for the global data of the current application (data shared among
several applications), for the current user.
fSelectDir Opens a directory picker
Part 5: Standard Functions

fRemoveDir Deletes a directory from a disk


fDirSize Returns the size (in bytes) of a directory.
fWebDir Returns the full path of the Web objects’ directory (image, Flash, …)
fSaveText Creates and fills a text file with the content of a text control or text variable (string variable,
edit control in a window, static control in a report, etc.)
fSelect Opens the file picker of Windows
fImageSelect Opens the image picker of Windows
fStopCompress Stops compressing or decompressing a file. The compressed or decompressed file is not
created
fDelete Deletes a file accessible from the current computer
fSize Returns the size of a file (in bytes)
fSizeUncompressed Returns the size of a file before compression
FolderWeb Returns the path of the directory containing the images, the Javascript files, the Java
applet files and the other files accessible from the browser
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 347 Vendredi, 28. mai 2010 5:50 17

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.

8.2 Principle for printing in WLanguage


The steps for printing in WLanguage as are follows: width of the page, number of copies, etc.).
• Step 1 (optional): Configure the print parameter. 2. Choose the printer used for the print job (iConfigure).
• Step 2 (optional): Create the print fonts. You can:
• Step 3: Print the characters, lines or images and end •open the standard printer selection window (WinDev
printing. and WinDev Mobile),

Part 5: Standard Functions


• Step 4: Start printing (iEndPrinting). •modify the printer used for the current printout
directly. This modification can be temporary (for the
Advice: to print faster, limit the number of graphic options current program only) or permanent (modification of
(borders, hash, etc.) that slow down printing a lot or that the default printer in the control panel of Windows for
use a lot of print memory. instance).
3. Redefining the print margins (iMargin). The top, bot-
8.2.1 Step 1: Configuring the print parameters tom, left and right margins can be modified. If this func-
This step enables you to choose: tion is not called, the default margins (different
•the print settings of the document (quality, number of according to the selected printer) will be used.
copies.
Caution: the operation order outline above must be res-
•The printer configuration parameters (printer driver, pected. If a print job is in progress, iParameter and iCon-
orientation, paper format, etc.). figure cancel the current print job.
This step is optional. Functions used to configure the print
This step must be performed if the default parameters destination
(defined in the control panel of Windows) are not suita- The following functions are used to configure the print
ble for the print job. destination and to get the current configuration:
• iPreview/iDestination: configures the print destina-
The different operations
tion.
The possible operations are as follows:
• iConfigure: configures the printer.
1. Selecting the print parameters of the document (iPa-
• iInfoPrinter: retrieves the settings of the current printer
rameter). You can:
or of the default printer.
•open the standard print configuration window (Win-
• iListPrinter: returns the list of printers installed on the
Dev and WinDev Mobile),
computer.
•configure the print parameters one by one (for ins-
• iParameter: Print parameter.
tance, orientation and paper format, height and
Tome1_2.book Page 348 Vendredi, 28. mai 2010 5:50 17

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

•the typeface (name and family),


• iPrint: sends the character string passed as parameter
•the size (of the characters),
to the print buffer.
•the attributes (bold, italic, underlined, etc.),
•the color. • iPrintBarCode: prints a bar code in a rectangle.
The various font parameters are defined using several • iPrintWord: sends the character string passed as para-
constants. meter to the print buffer.
• iPrintZone: prints a text inside a rectangular area.
Each font is associated with a number. iFont enables you • iPrintZoneRTF: prints a text in RTF format inside a rec-
to choose the print font. tangular area.
• iTextWidth: calculates the width of the text to print in
Dynamic font millimeters, according to the specified font.
A "Font" type variable allows you to create a dynamic • iLink: prints a link to a URL when printing an HTML
font that can be used in all the project’s objects: win- page.
dows, pages, reports, print jobs, charts, drawings, etc.
• iFont: selects the default font.
To define a dynamic font:
1. Create a Font variable. • iDidotFont: selects the unit to use for the font height
2. Define the characteristics of the font: (created using the iCreateFont function): DIDOT point
or PICA point.
•usingFontCreate,
• iXPos: manages the horizontal position (x-coordinate)
•using the font properties: Angle, StrikeOut, Con- of the print cursor in the page.
densed, Color, Extended, Bold, Italic, Large,
Name, Underlined and Size. • iYPos: manages the vertical position (y-coordinate) of
the print cursor in the page.
ifont enables you to choose a print font.
Notes:
Printer Font • Texts can be in different fonts: the font is selected by
Printer manufacturers install fonts on their printers. iFont.
Tome1_2.book Page 349 Vendredi, 28. mai 2010 5:50 17

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).

Part 5: Standard Functions


rounded end) at the specified coordinates.
• iTransparentMagenta: modifies the setting of the • iPageWidth: calculates the width of the printable
Magenta color so it is made transparent or not for page, taking into account the defined margins.
future print jobs. • iPageNum: returns or reinitializes the number of the
• iMMToPica: converts the coordinates of a point page being printed.
(expressed in millimeters) into system coordinates. • iRAZ: reinitializes the print parameters stored in the
• iXPos: manages the horizontal position (x-coordinate) print library.
of the print cursor in the page. • iSkipLine: forces a line break.
• iYPos: manages the vertical position (y-coordinate) of • iSkipPage: generates a page break.
the print cursor in the page. • iReportPrintingStatus: returns the status of the cur-
rent print job.

8.3 Printout functions


Here are the print functions:
iPreview Configures the destination of the printout
iBorder Prints a border at the specified coordinates
iRoundBorder Prints a rounded border at the specified coordinates
iConfigure Configures the printer
iConfigureReport Configures the printer by opening the configuration window
iCreateFont Creates a new print font
iLastFile Returns the full name of the last file generated during the printout (PDF, RTF, XML, …)
iDestination Configures the destination of the printout
iEllipse Prints an ellipse inside a rectangle
Tome1_2.book Page 350 Vendredi, 28. mai 2010 5:50 17

350

iEscape Sends an ESCAPE command to a printer


iWindowCancel Configures the display of the window used to cancel the current printout
iCloseReport Stops the current printout immediately
iEndReport Forces a report created in the report editor to stop from printing
iEndPrinting Indicates the end of the document to print and actually starts printing the data stored
in the printer spooler
iForceComplement Forces a body complement block to print
iNestedHeaderFooter Prints (or not) the page headers and footers of the nested report
iImageHeight Calculates the height of the image to print (in millimeters)
iPageHeight Calculates the height of the printable page (in millimeters) while taking the margins
(top or bottom) into account
iPageHeightLeft Calculates the available height (in millimeters) left on the current page while taking
the margins (top or bottom) into account
iTextHeight Calculates the height of the font for the text to print (in millimeters)
iZoneHeight Calculates the necessary height of a fixed-width area in order for the entire text to be
printed in this area
iDocumentCanceled Enables you to find out whether the current printout was canceled by the user
iDocumentPrinted Enables you to find out whether the user has requested to print the document from the
print preview
iPrint Sends the character string passed in parameter to the printout "buffer"
iPrintBlock Forces a report block to print
iPrintBarCode Prints a bar code in a rectangle
iPrintBodyComplement Forces the printout of a body complement block while specifying the height of the
complement block
iPrintReport Prints a report created in the report editor
iPrintImage Sends the image file to print to the printout buffer
iPrintWord Sends the character string passed in parameter to the printout "buffer"
Part 5: Standard Functions

iPrintZone Prints a text inside a rectangular area


iPrintZoneRTF Prints a text in RTF format in a rectangular area
iInfoPrinter Retrieves the characteristics of the current or default printer
iInitReportQuery Initializes the query linked to the report (for a query with parameters)
iInitReportQueryConnec- Initializes the query linked to the report (query based on a specific connection)
tion
iImageWidth Calculates the width of the image to print (in millimeters)
iPageWidth Calculates the width (in millimeters) of the printable page while taking the margins
(left or right) into account
iTextWidth Calculates the width (in millimeters) of the text to print according to the specified font
iLink Prints a link toward a URL when printing an HTML page
iNewLine Prints a line (in Windows standard, with a rounded end) at the specified coordinates
iListNestedReports Returns the list of nested reports currently printing
iListPrinter Returns the list of printers installed on the current computer
iTransparentMagenta Specifies whether the Magenta color will be considered as being transparent or not in
the next printouts
iMargin Defines the "logical" print margins
iMMToPica Converts the coordinates of a point (expressed in millimeters) into system coordinates
iPageNum Returns or initializes the number of the page currently printing
iParameter Configures the print job
iParameterPreview Configures the display of each button found in the print preview
iParameterReport Configures the printer by opening the configuration window
iParameterExport Configures the export options from the print preview (options for sending emails for
instance).
Tome1_2.book Page 351 Vendredi, 28. mai 2010 5:50 17

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).

Part 5: Standard Functions


Tome1_2.book Page 352 Vendredi, 28. mai 2010 5:50 17

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.

9.2 Functions for managing the registry


The following functions are used to manage the registry:
RegistrySeek Searches for a character string in the registry
RegistryNextKey Identifies the key found after the specified key in the Windows registry
RegistryCreateKey Creates a key in the Windows registry
RegistrySetValue Writes a value into a register of the Windows registry
Part 5: Standard Functions

RegistryExist Checks the existence of a key in the Windows registry


RegistryListValue Returns the name (and possibly the type of the values) of a key found in the registry.
RegistryQueryValue Reads the value of a register in the Windows registry
RegistryFirstSubKey Identifies the path of the first sub-key for the specified key in the registry of Windows
RegistryDeleteKey Deletes a key from the Windows registry
RegistryDeleteValue Deletes a value from the Windows registry
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).

9.3 Functions for managing the clipboard WD WDMobile

The following functions are used to manage the clipboard:


Clipboard Retrieves the text or the image found in the Windows clipboard
ClipboardFormat Identifies the format of the information found in the clipboard
ClipboardHeight Calculates the height of an image (in bitmap format) found in the clipboard
ClipboardWidth Calculates the width of an image (in bitmap format) found in the clipboard
ClipboardRTF Retrieves an RTF string from the clipboard (the content of the clipboard is in RTF format).
TableToClipboard Copies the content of a table to the clipboard (treeview table, browsing table or memory
table).
TwainToClipboard Enables you to copy the document coming from the Twain device to the clipboard, or to
view the document coming from the Twain device in the user interface of the device.
Tome1_2.book Page 353 Vendredi, 28. mai 2010 5:50 17

353

ToClipboard Writes text information into the Windows clipboard


ToClipboardRTF Writes a character string in RTF format into the clipboard.
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).

9.4 Functions for managing the recycle bin


WD

The following functions are used to manage the recycle bin:


RecycleBinListFile Lists the files found in the recycle bin
RecycleBinRestore Restores a file found in the recycle bin
RecycleBinDelete Deletes a file from the recycle bin
RecycleBinClear Clears the recycle bin.
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).

9.5 Functions for managing the


mouse WD WDMobile

The following functions are used to manage the mouse:


ControlOver Identifies the control hovered by the mouse cursor.
CursorDisplay Displays or hides the mouse cursor

Part 5: Standard Functions


CursorCapture Directs all the events associated with the mouse toward a specific window or a control
CursorPos Returns and modifies the position of the mouse cursor
Hourglass Changes the mouse cursor into an hourglass (and conversely)
MouseXPos Returns the horizontal position (x-coordinate) of the mouse cursor in relation to the control
MouseYPos Returns the vertical position (Y-coordinate) of the mouse cursor in relation to the control
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).

9.6 Functions for managing the serial and parallel


ports WD WDMobile

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

sClose Closes the specified serial port or parallel port


sEndEvent Disables the detection of event on a serial port.
sParameter Configures or modifies the configuration settings of the specified serial port or parallel port
sRead Reads a character string in the entry buffer of the specified serial port
sOpen Opens and initializes the specified serial port (or parallel port)
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).

9.7 Functions for managing the Twain devices WD

The following functions are used to manage the Twain devices:


TwainState Returns the status of the current source.
TwainSourceHeight Returns the height of the area to scan.
TwainSourceWidth Returns the width of the area to scan.
TwainListSource Returns the list of drivers for the Twain devices connected to the current computer.
TwainSelectSource Displays the list of Twain devices available for the current computer and enables you to
choose the Twain device used by default.
TwainCurrentSource Enables you to find out and change the Twain device used by default.
TwainToBMP Enables you to:
• save the document coming from the Twain device in a Bitmap file (".BMP" extension).
• view the document coming from the Twain device in the user interface of the device.
TwainToControl Enables you to:
• view the document coming from the Twain device in an image control.
• view the document coming from the Twain device in the user interface of the device.
TwainToGIF Enables you to:
Part 5: Standard Functions

• 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

9.8 USB functions WD

The following functions are used to manage the USB devices:


USBDisconnect Disconnects or ejects a USB device
USBDetectRemova- Detects whether a removable storage unit (CD, USB key, USB camera, …) was added or
bleStorage removed
USBListDevice Returns the list of USB devices currently plugged into the current computer
USBProperty Retrieves the value of a property for a USB device
USBFind Finds a USB device according to keywords
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).

9.9 MCI functions WD

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)

Part 5: Standard Functions


MCIPlay Plays a multimedia file
MCIWidth Returns the width of a multimedia file (in pixels)
MCIMsgErr Returns the text of the last error caused by a MCI function
MCITrackCount Returns the number of tracks in the multimedia file
MCIOpen Opens a multimedia file
MCIPause Enables you to pause a multimedia file’s execution
MCITrack Returns the number of the current track
MCIPosition Enables you to find out or modify the position of a multimedia file
MCIRetrieve Returns the last result returned by MCIExecute
MCISize Enables you to get the size of a multimedia file (expressed in the unit defined by MciPosition-
Format)
MCIWindowSize Modifies the size and the position the display window of a multimedia file
MCIVolume Modifies or identifies the sound volume for "MID" or "WAV" files
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 356 Vendredi, 28. mai 2010 5:50 17

356

9.10 Service functions


The following functions are used to manage Windows ser-
vices:
ServiceRefresh Asks a service to re-read its configuration information.
ServiceStop Stops a service.
ServiceWaitStatus Waits for a service to be in a specific status.
ServiceControl Sends a control message to a service.
ServiceStart Starts a service.
ServiceUninstall Uninstalls a service.
ServiceStatus Returns the current status of a service
ServiceInfo Returns the characteristics of a service
ServiceInstall Installs a service according to the information given in the members of the Service varia-
ble.
ServiceList Returns the list of services found on the current computer or on the specified remote
computer.
ServiceModify Modifies the configuration of a service according to the information given in the mem-
bers of the Service variable.
ServicePause Pauses a service.
ServiceRestart Restarts a service that was previously stopped.
ServiceContinue Restarts a paused service.
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).

9.11 System functions


Part 5: Standard Functions

The system functions are as follows:


SysShutdown Stops the system or closes the current Windows session
SysChangeScreenReso- Modifies the resolution of a screen.
lution
SysColor Identifies or modifies the color of a Windows element
SysColorRes Returns the resolution of the screen in number of colors
SysSetFocus Gives focus to a window or to a control
SysEnvironment Returns the environment variables of the operating system
SysSpace Returns the total amount of memory for the current computer
SysWinActive Returns the handle of the active window or activates a window
SysWinShow Modifies the display status of a window
SysWinHandle Returns the handle of a window identified by its title
SysWinTitle Returns the title of a window
SysValidHandle Checks the validity of a window handle
SysIconAdd Adds an icon to the taskbar
SysIconModify Modifies the icon file and/or the rollover message of an icon in the taskbar
SysIconDelete Deletes an icon from the taskbar
SysIconize Enables you to find out whether a window is minimized
SysIMEI Returns the IMEI number of a Smartphone
SysInstance Returns the instance of an application
SysReleaseDC Frees the current DC (Device Context) retrieved by SysGetDC
Tome1_2.book Page 357 Vendredi, 28. mai 2010 5:50 17

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).

9.12 Miscellaneous Windows functions

Part 5: Standard Functions


Here are the Windows functions:
CallInterface Runs a method of an interface of an object implemented in a DLL external to the WinDev fra-
mework. This object can be a C++ object or a COM object.
API/CallDLL32 Runs a function found in an external 32-bit DLL
APIParameter Modifies the options for calling API and CallDLL32
LoadDLL Loads the specified 32-bit library (DLL) in memory
ComponentLoad Loads the specified component in memory
MakeInteger Builds an integer from two 2-byte integers
CreateShortcut Creates a shortcut on the Windows desktop, in the "Start" menu of Windows or in a specific
directory
FreeDLL Frees the 32-bit library (DLL) previously loaded in memory by LoadDLL
SendKey Simulates keystrokes
IconInstall Creates an icon (associated with a program) in a group of Windows programs, with the asso-
ciated command line
Instance Returns the "system handle" (HINSTANCE) of the current program
Ping Checks whether an address is accessible (similar to the PING network command)
LoWord Returns the two low bytes of an integer
HiWord Returns the two high bytes of an integer
StandardOutput Writes information into the standard output stream "stdout" (also called "console")
DeleteShortcut Deletes a shortcut previously created by CreateShortcut
KeyPressed Checks which key is pressed
Tome1_2.book Page 358 Vendredi, 28. mai 2010 5:50 17

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).

9.13 Windows event


The following functions are used to manage the Windows events:
Event Intercepts a Windows event on a control, a group of controls or a WinDev window
EndEvent Cancels the interception of a Windows event on a control or a WinDev window implemented by the
Event function
EndTimer Ends the execution of a timer triggered by Timer
EndTimerSys Ends the execution of a timer triggered by TimerSys
Handle Returns the system "Handle" (HWND) of a WinDev control or window
HandleParen- Forces the parent of the next window to open. This function allows a WinDev window to be the child of
tNext an another application, or to be the child of a non-WinDev window.
Multitask Enables you to define a time-out, to give the control back to Windows or to give the control back to
Windows and to WLanguage
PostMessage Sends a Windows message to a control or to a window
SendMessage Sends a Windows message to a control or to a window
Wait Temporarily stops the execution of a program
Timer Periodically and automatically calls a WLanguage procedure. Called in the procedure, Timer is used
to identify the timer that has run the procedure.
TimerSys Periodically and automatically calls a WLanguage procedure. Called in the procedure, TimerSys is
Part 5: Standard Functions

used to identify the timer that has run the procedure.


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).

9.14 Java functions WebDev WD

The following functions are used to manage Java applications:


javaLoad Specifies the location of the classes required to run the Java application or the Java applet
JavaExecute Starts a Java application or a Java applet by invoking the "Main" method of a given Java class
javaExecuteFunction Runs a specific static function of a Java class
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).
Tome1_2.book Page 359 Vendredi, 28. mai 2010 5:50 17

359

9.15 Miscellaneous WinDev/WebDev functions


Here are the miscellaneous functions:
AddVoiceCommand Adds a voice command to the current window
ProfilerStart Starts "collecting data" for the performance profiler
ProfilerEnd Stops "collecting data" for the performance profiler
AppliControl Enables (or disables) the remote control for the current multi-user WinDev applica-
tion
AutomationEvent Branches a procedure to the event of an automation object
AutomationParameter Configures the management of accesses to the ActiveX objects and to the Automa-
tion objects
Beep Emits a beep
StringDisplay Displays a character string (or a buffer) in the browser
ChangeSkinTemplate Dynamically changes the skin template associated with a window (specific window,
windows of WinDev components, etc.)
LoadWDL Loads a library of objects in memory (.WDL)
Compile Compiles a procedure dynamically
ComponentInfo Returns information about a component
ConnectionCount Returns the number of instances of the WebDev site currently run on the server
BuildAutomationVariant Builds an Automation variant parameter
UnloadWDL Frees the library previously loaded in memory by LoadWDL
DisableAAF Disables an automatic feature of WinDev on a control or on a window
Dimension Calculates the size of a variable or resizes a dynamic array
GetIdentifier Calculates a unique identifier (integer) for a given executable
InAJAXMode Identifies whether the code is run from an AJAX process or from a procedure called
by AJAXEXecute or AJAXExecuteAsynchronous

Part 5: Standard Functions


InAWPMode Specifies whether the code is run from an AWP page.
InComponentMode Specifies whether the code is run from a WinDev application or from a component
InReportsAndQueriesMode Specifies whether the code is run during the test of a report or query in Reports and
Queries
InJavaMode Specifies whether the code is run in Java
InUMCMode Specifies whether the code is run from a user macro-code.
InPHPMode Specifies whether the code is run in PHP or not
InPocketMode Specifies whether the code is run from a WinDev Mobile application or from a stan-
dard WinDev application
InStoredProcedureMode Indicates whether the code is run on a HyperFileSQL server
InSimulatorMode Enables you to find out whether the application is run in "simulator test mode" from
WinDev Mobile.
OnTestMode Identifies how the application or site is started
InAutomaticTestMode Enables you to find out whether an automatic test is currently run
InTSEMode Specifies whether the code is run from a computer in TSE mode or from a remote
desktop.
InWebMode Identifies how the current code is started
ErrorInfo Returns information about the last error that occurred in a component function
IsNumeric Enables you to find out whether a variable or a control is a numeric or a string that
can be converted into numeric
Execute Starts the execution of a process by programming
ExecuteAncestor When the code is overloaded, used to run the process of the template correspon-
ding to the process of the current control.
ExecuteAAF Runs an automatic application feature (AAF) on a specific control
ExecuteProcess Starts the execution of a process by programming
Tome1_2.book Page 360 Vendredi, 28. mai 2010 5:50 17

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).

9.16 Functions for managing the executables


The following functions are used to handle the executables and to get information about the executables found on the
current computer:
AutoRunAdd Enables you to automatically start a WinDev Mobile application when a specific event
occurs. This startup is defined from a WinDev Mobile application.
Also enables you to automatically start a WinDev application when a specific event occurs.
This startup is defined from a WinDev application.
AutoRunDelete Enables you to cancel the automatic start of a WinDev Mobile application or WinDev applica-
tion. This automatic start was previously defined by the AutoRunAdd function.
GetIdentifier Calculates a unique identifier (integer) for an executable or for a session.
ExeGetPID Returns information about the current process.
ExeInfo Retrieves information about the version of an executable or about the version of a DLL
ExeRunning Enables you to find out whether an application is already started

Part 5: Standard Functions


ExeListDLL Returns the list of libraries (".DLL" files) used by an application currently run
ExeListProcess Returns the list of applications currently run. For each application found, you can find out its
identifier, the identifier of the parent process (the one that started the application), the
name and extension of its executable, the name and full path of its executable, its current
memory consumption and its maximum memory consumption.
ExePriority Returns or modifies the priority of an application currently run
ExeTerminate Terminates the execution of a 32-bit application: all the instances of the executable are
"killed"
ExeRun Starts the execution of a program (an executable for instance) from the current application
or site
ShellExecute Directly opens a document in the associated application or site
ListDLL Returns the list of libraries (".DLL" files) used by the current WinDev application, WinDev
Mobile application or WebDev site. Only the libraries loaded in memory are listed.
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).
Tome1_2.book Page 362 Vendredi, 28. mai 2010 5:50 17

362

9.17 Functions for DDE management WebDev WD

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.

9.18 Functions for managing the agents WD

The following functions are used to manage agents:


Part 5: Standard Functions

AgentShow Displays an agent


AgentBeep Emits a sound
AgentHide Hides an agent
AgentChoice Displays a message containing a title, a list of choices, an icon and a set of buttons
AgentAdvice Displays a message containing text, an icon and a set of buttons
AgentCreate Initializes an agent for an application
AgentMove Moves and/or resizes the window of an agent
AgentHeight Returns the height of the agent window
AgentWidth Returns the width of the agent window
AgentMessage Displays a message containing a title, a text, an icon and a set of buttons
AgentXPos Returns the horizontal position of the agent window
AgentYPos Returns the vertical position of the agent window
AgentInput Displays a message containing a title, a text, an icon, a set of buttons and an input area
AgentTerminate Removes an agent from memory
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 363 Vendredi, 28. mai 2010 5:50 17

363

9.19 Functions for managing the networks


The following functions are used to manage networks:
NetworkConnect Associates a drive with a shared network directory
NetworkDisconnect Disconnects a network drive
NetworkDirName Identifies the directory associated with a network drive
NetworkUser Identifies the name of the connected user
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).

9.20 Functions for managing the SNMP protocol


The following functions are used to manage the SNMP protocol:
SNMPStringToOID Converts an OID from its text representation to its numeric representation.
SNMPLoadMIB Loads an MIB file in memory and analyzes it.
SNMPSet Writes one or more values on an SNMP agent for which an SNMP session was started.
SNMPCloseSession Closes an SNMP session.
SNMPGet Reads one or more values of an agent with which an SNMP session was started.
SNMPGetNext Reads the value found after the last value retrieved for an SNMP agent.
SNMPGetTable Reads a table of SNMP values.
SNMPOIDAccess Returns the authorized access modes of a specific OID.
SNMPOIDDescription Returns the description of an OID.
SNMPOIDStatus Returns the status of an OID.
SNMPOIDType Returns the type of data found in an OID.

Part 5: Standard Functions


SNMPOIDToString Converts an OID from its numeric representation to its text representation.
SNMPStartSession Starts an SNMP session.
SNMPTrapEnable Enables the interception of an SNMP "trap" sent by an agent.
SNMPTrapDisable Disables the interception of an SNMP trap.
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 364 Vendredi, 28. mai 2010 5:50 17

364

9.21 Functions for managing the projects


These functions enable you to easily manage the elements of a projects:
ComponentLoad Loads the specified component in memory. This component will be loaded in memory
until the end of the application.
ComponentInfo Returns information about a component.
ComponentList Returns the list of components (".WDK" file) used by the current application
ComponentLocate Specifies the access path to a project component
EnumElement Enables you to list the project’s elements (windows, pages, reports, queries, …)
EnumSubElement Enables you to list the sub-elements of a project’s element (windows, reports, queries,
…). This function can be run even if the element is not opened
ListDLL Returns the list of libraries (".DLL" files) used by the current application or installed on
the current computer
WindowCount Calculates the number of windows currently opened in the current application
ProjectInfo Returns specific information about the project currently running (project name, associa-
ted registry key, …)
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).

9.22 Functions for managing the schedu-


ler WD

The following functions are used to manage the Windows scheduler:


SchedulerAddTrigger Creates a schedule for a scheduled task
Part 5: Standard Functions

SchedulerAddTask Creates a task in Windows scheduler


SchedulerTaskStatus Retrieves or modifies the status of a task created in the Windows schedu-
ler
SchedulerTaskList Retrieves the list of scheduled tasks
SchedulerModifyTrigger Modifies the parameters of a scheduled task, i.e. the events that will trig-
ger the task
SchedulerModifyTask Modifies the parameters of a scheduled task
SchedulerOpenTaskProperties Opens the property page for a scheduled task
SchedulerTriggerProperties Reads the properties of a scheduled task and updates the TriggerSchedu-
ledTask structure
SchedulerTaskProperties Reads the properties of a scheduled task and updates the ScheduledTask
structure
SchedulerReset Fills the ScheduledTask and TriggerScheduledTask structures with the
default values
SchedulerDeleteTrigger Deletes a schedule from a scheduled task
SchedulerDeleteTask Deletes a scheduled task
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 365 Vendredi, 28. mai 2010 5:50 17

365

10. HANDLING YOUR XLS FILES WebDev WD

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.

Part 5: Standard Functions


Tome1_2.book Page 366 Vendredi, 28. mai 2010 5:50 17

366

10.2 XLS functions


The following functions are used to manage Excel files:
xlsAddWorksheet Adds or inserts a new worksheet into an Excel document.
xlsData Retrieves the data from a cell of the XLS file
xlsClose Closes an XLS file
xlsCurrentWorksheet Used to find out and modify the current worksheet in an XLS file
xlsMsgError Returns the caption of the last error caused by an XLS function
xlsNbColumn Returns the number of columns in an XLS file
xlsNbWorksheet Returns the number of worksheets found in an XLS file
xlsNbRow Returns the number of rows found in an XLS file
xlsOpen Opens an XLS file
xlsSave Saves an Excel document.
xlsDeleteWorksheet Deletes a worksheet from an Excel document.
xlsColumnTitle Retrieves the title of a column in an XLS file
xlsColumnType Returns the type of the data entered in a column of an XLS file
xlsVersion Returns the Excel version used
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).
Note: TableToExcel enables you to create an XLS file with the data found in a table.
Part 5: Standard Functions
Tome1_2.book Page 367 Vendredi, 28. mai 2010 5:50 17

367

11. THE ARCHIVES


11.1 Overview
WLanguage functions are available for compressing and For instance, the archives allow you to:
grouping files into archives. •save your files on a regular basis while reducing the
An archive is a physical file: storage space,
• of ".WDZ" type for a WinDev archive. •simplify the transmission of your files over the Inter-
• whose type is ".ZIP" for a WinZip or PKZip archive. net/Intranet,
This file groups several automatically compressed files of •create self-extracting archives,
different types (".pdf", ".fic", ".mmo", and so on). •etc.
An optimized compression allows your files to take less
disk space and to be easily distributed on different media
(diskettes, CD, Internet, etc.).
There are two types of archive:
•single-part archive: the archive is made of one file.
•multi-part archive: the archive is made of several files
(or sub-archives).
Note: WinDev also supports standard zip formats (WinZip
and PKZip).

Part 5: Standard Functions


11.2 Handling the archives
More than 20 WLanguage functions let you manage your •create self-extracting executables.
archives. These functions are used to: Example
•handle archives (create, open, close), To save the database of your customer, your program
•handle the files in the archive (add and compress creates a backup archive. The files to save are com-
files (single file or all the files in a directory), extract pressed into the archive.
and uncompress a file, delete files or delete an To store this archive on diskettes: this archive is split into
archive), several parts. This enables you to easily transmit this
•get various information about archives and com- archive!
pressed files (size before and after compression, To make the backup file easier to use: create a self-
etc.), extracting archive. All you have to do is run the archive to
•split and/or merge archive volumes, automatically decompress all the files.
Tome1_2.book Page 368 Vendredi, 28. mai 2010 5:50 17

368

11.3 The single-part and multi-part archives


11.3.1 Overview You can store the sub-archives on different media (dis-
Two types of archive are available: kettes, CD, etc.).
•single-part archive, The sub-archives can be merged (zipMerge.
•multi-part archive. Note: all these operations can also be performed using
WDZip (for more details, see ’WDZip - Archive manager’,
Single-part archive page 586).
A single-part archive contains a single ".WDZ" or ".ZIP"
file: an archive file contains all the compressed files. Caution: some archiving functions can be used only with
The archive occupies the necessary space to contain all single-part archives (add files, delete files, create a self-
the compressed files. extracting executable, etc.). To perform these operations
on a multi-part archive, merge the sub-archives (zip-
Example: your program or your site needs to save several Merge) to create a single-part archive.
large files. Your program or your site can create an
archive containing all the files to save. This archive will From a multi-part archive, you can only:
increase the available disk space. •Merge the different parts (zipMerge),
•Get information about the archive and about the files
Multi-part archive found in the archive (zipExtractPath, zipInfoFile,
A multi-file archive contains several files (or sub-archi- zipListFile, etc.),
ves) of identical size. The size of each sub-archive is defi- •Extract the files (zipExtractFile, zipExtractAll).
ned when creating the multi-file archive.
The first sub-archive is a ".WDZ" or ".ZIP" file. The fol- 11.3.3 Examples
lowing sub-archives are files numbered from 1 to N via • Your WinDev program must store a large amount of
their extension. data on diskettes. Your program can create an archive
For the archives in WinDev format (WDZ), the sub-archi- containing the requested data. Once created, this
ves have the following extensions: ".001", ".002", …, archive can be divided into several parts. These volu-
".NNN". mes have the size of a floppy disk (1.44 MB). All you
For the archives in ZIP format, the sub-archives have the have to do is copy these different parts on the disket-
Part 5: Standard Functions

following extensions: ".Z01", ".Z02", …, ".ZNN". tes.


• Your WebDev site need to offer the download of a large
11.3.2 Principle file. For users with a slow connection (phone line for
To create a multi-file archive: instance), there is often an option to download a file in
1. Create an archive (zipCreate). several parts. Your site can create an archive contai-
2. Add files to this archive. The added files are auto- ning all the data you want. Once created, this archive
matically compressed (zipAddFile, zipAddDirec- can be divided into several parts. These volumes can
tory). have a size well suited for download. Now all you have
3. Split this archive into several sub-archives (zipS- to do is provide a link for each part of the archive to the
plit). The sub-archives have the same size. You user.
define the size of the sub-archives.

11.4 Archiving functions


The following functions are used to manage archives:
zipAddFile Adds a file to an archive and compresses it
zipAddFileList Adds a list of files to an archive and compresses it
zipAddDirectory Adds all the files found in a directory and in its sub-directories to an archive
zipChangePath Modifies the path of a file found in the archive
zipFindFile Finds a file in an archive according to a given path
zipCreate Creates a new archive
zipCreateExe Creates a self-extracting executable from an archive
zipSplit Splits an archive into several parts
zipIsMulti Returns the archive’s type: single-part archive or multi-part archive
Tome1_2.book Page 369 Vendredi, 28. mai 2010 5:50 17

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

Part 5: Standard Functions


zipSize Returns the size of all the files found in an archive (before and after compression)
zipFileSize Returns the size of a file in an archive (before and after compression)
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 370 Vendredi, 28. mai 2010 5:50 17

370

12. BURNING A CD OR A DVD WebDev WD

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.

12.2 Burning a CD/DVD


To burn a CD: 4. If needed, delete the files already present on the
1. If needed specify the burner to use: CD/DVD (BurnerErase). A WLanguage procedure
BurnerPath Returns the path of the current bur- ("callback") is regularly called during this erase pro-
ner cess. This procedure is used to manage the different
BurnerStatus Returns the status of the current bur- events that occur.
ner 5. If needed, specify the name to give of the CD/DVD
to burn with BurnerVolumeName.
BurnerList Returns the list of burners installed
on the current computer 6. Select the files to burn onto the CD/DVD:
BurnerProperty Used to find out and modify the pro- BurnerAddFile Adds a file to the compilation
perties of the current burner BurnerAddDirectory Adds all the files found in a directory
BurnerSelect Used to select the default burner to the compilation
Part 5: Standard Functions

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

12.3 Burner functions


The following functions are used to manage archives:
BurnerAddFile Adds a file to the compilation
BurnerAddDirectory Adds all the files found in a directory to the compilation
BurnerCancel Cancels the current burn process
BurnerPath Returns the path of the current burner
BurnerErase Erases the files found on a rewritable CD
BurnerEject Opens or closes the door of the current burner
BurnerSave Burns the files found in the compilation to the CD
BurnerStatus Returns the status of the current burner
BurnerCompilationInfo Retrieves the characteristics of the current compilation
BurnerMediaInfo Retrieves the characteristics of the CD found in the current burner
BurnerList Returns the list of burners installed on the current computer
BurnerVolumeName Used to find out and modify the name of the CD to burn
BurnerProperty Used to find out and modify the properties of the current burner
BurnerSelect Used to select the default burner
BurnerMediaType Enables you to find out and modify the format of the CD to burn
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 5: Standard Functions


Tome1_2.book Page 372 Vendredi, 28. mai 2010 5:50 17

372

13. FUNCTIONS FOR ACCESSING A POCKET


PC WD

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.

Part 5: Standard Functions


Tome1_2.book Page 374 Vendredi, 28. mai 2010 5:50 17

374

14. FUNCTIONS SPECIFIC TO WINDEV MOBILE


14.1 WinDev Mobile and SIM cards
14.1.1 Overview 14.1.3 Operating mode in GO mode and at run
WinDev Mobile lets you access the information found in a time
mobile phone’s SIM card via the WLanguage SIM func- In GO mode (simulation on the development computer),
tions. a WLanguage error is generated when calling a SIM card
The SIM card (Subscriber Identity Module) is the chip management function.
found in a cell phone. Required to access the communi-
cation network, this smart card identifies the user and 14.1.4 WLanguage functions
stores all the information about the network and about These functions enable you to easily manage the infor-
the subscription (phone number, type of contract, etc.). mation found in the personal directory present on a SIM
The SIM card also contains a personal directory. The SIM card:
functions of WLanguage are used to manage the informa-
tion found in this directory. SIMWrite Writes or modifies an entry in the
Note: the personal directory found on the SIM card only directory of the SIM card
contains the name and phone number of the contacts. SIMRead Reads an entry in the directory of
Only this information can be handled. the SIM card
14.1.2 Required configuration SIMNbContact Returns the number of entries
found in the directory of the SIM
To be able to use the SIM functions, the application must card
be installed:
SIMDelete Deletes an entry from the directory
• on a Pocket PC with phone access (GSM). of the SIM card
• and/or on a Smartphone.
Part 5: Standard Functions

14.2 Pocket keyboard


14.2.1 Overview WinDev Mobile enables you to easily manage this key-
To allow the users of your applications to enter data, the board via the WLanguage functions.
keyboard of the Pocket PC must be used (also called SIP Note: other types of keyboards may also be available.
for Software Input Panel).
This keyboard allows you to: 14.2.2 WLanguage functions
• display a miniature keyboard at the bottom of the The functions used to manage the keyboard of a Pocket
screen. The user clicks this keyboard with the stylus to PC are:
enter information. SIPList Returns the list of keyboard
automatically recognize the different words written on types available on the Pocket PC
the screen with the stylus (method called "Transcri- SIPMode Enables you to find out and
ber"). modify the keyboard currently
• automatically recognize the letters entered in a specific used
character set (method called "Letter Recognizer"). SIPVisible Enables you to find out whether
automatically recognize the blocks of words entered in the current keyboard is enabled
a specific character set (method called "Block Reco- and to enable the keyboard
gnizer").
Tome1_2.book Page 375 Vendredi, 28. mai 2010 5:50 17

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

1.2 Implementing the upload in a WebDev site


1.2.1 Available elements ver.
The following elements are used to manage the file 3. In the server click code of this link or button, you
upload: can use:
• an UPLOAD type edit control: in the browser, a •UploadFileName to check that the file was uploa-
"BROWSE" button is automatically added on the right ded and retrieve its name. Indeed, during the
of the Upload type edit control. This button allows the upload, the file is renamed with a temporary file
Web user to select the file to "upload". name.
A gray button is displayed in the editor. This button can- • UploadCopyFile to copy and rename the file

Part 6: Web specific features


not be modified (style, caption, …). uploaded to the server. This file can be copied to
Caution: this edit control is a special control; we the resource directory (_WEB) or to a directory
recommend you use the Value type properties on this accessible via an alias.
control. To find out the name of the uploaded file, use •HLinkMemo to load the image in a memo item of a
UploadFileName. Hyper File file.
• two server functions of WLanguage:
•UploadCopyFile 1.2.3 Displaying the image to upload
Saves an "uploaded" file on the server. During this To display the image selected in an upload control
backup, the saved file can be renamed on the ser- (UploadControl) in an image control (ImageControl):
ver. 1. In the description window of the "ImageControl"
•UploadFileName image control ("General" tab), clear the "Locate the
Returns the name of an "uploaded" file (initial file image in the _WEB directory in browser code"
name or file name saved on server). option.
2. In the code of the page, add the optional
1.2.2 Uploading a file into a page "OnMouseMove" browser code.
3. Enter the following code lines in this code:
To upload a file in a page:
IF UploadControl <> "" AND ...
1. Create an UPLOAD edit control (the control type is
ImageControl <> UploadControl THEN
defined in the "General" tab of the control).
ImageControl = UploadControl
This control will be used to select the file to upload.
END
2. Add a button or a link.
This control will be used to upload the file to the ser-
Tome1_2.book Page 378 Vendredi, 28. mai 2010 5:50 17

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.

2.2 Implementing file download in a WebDev site


Several methods are available to download a file: • if the file type is not recognized or if it corresponds to
• description window of the button or link used to per- an executable, a dialog box allows you to download
form the download. this file and/or to run it directly.
• programming in WLanguage.
2.2.3 forcing the file download
2.2.1 Using the description window of controls
(button, link,…)
To propose file download:
1. Create a "Link" control, "Button" control, …
2. Display the description window of this control.
3. Click "Other actions".
Part 6: Web specific features

4. In the window that opens, select "Other actions:


enter a link".
5. Specify the full path of the file (directory + name)
found on the server. The file must be found in the
"_WEB" directory of the site.
At run time, when clicking this control:
• if the file type is recognized, the file is directly opened
in the browser.
• if the file type is not recognized or if it corresponds to To open this dialog box regardless of the type of file to
an executable, a dialog box allows you to download download, enter the following code line:
this file and/or to run it directly. FileDisplay(CompleteDir(…
fWebDir()) + "NOTES.TXT", …
2.2.2 Programming "application/unknown")
To offer file download by programming, use FileDisplay in However, the name of the file proposed for download
the server click code of the button or link used to down- does not correspond to a valid name. To immediately
load the file. offer the name of the file to download, you need to confi-
Example: gure the MIME type by indicating the name of the file to
// Display in the browser download:
FileDisplay(CompleteDir(… MIME is string =
fWebDir()) + "NOTES.TXT", .. "application/unknown" + CR + ….
"text/plain") "name=NOTES.TXT" + CR +…
"Content-Disposition: "+…
At run time, when clicking this control: "Attachment;"+…
• if the file type is recognized, the file is directly opened "filename=NOTES.TXT" + CR + EOT
in the browser. FileDisplay(CompleteDir(…
fWebDir()) + "NOTES.TXT", MIME)
Tome1_2.book Page 379 Vendredi, 28. mai 2010 5:50 17

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, …

3.2 What is a cookie made of?


A cookie is a text file stored on the computer of the Web • Expiration date, after which the cookie is not valid any-
user (in the Internet "cache" of the browser) during a more.
specified length of time. The cookie is created by the • Name of the Internet domain that created the cookie.
browser or by the server. Reminder: the Internet domain is a specific piece of the

Part 6: Web specific features


Each cookie contains the following information: Internet address: http://machine.domain.com/MyPa-
ges/Index.html.
• Cookie name: used by the site to identify the cookie.
• Cookie text: information written by the site (page
viewed, information provided by the user, …).

3.3 WebDev and the management of cookies


3.3.1 Available elements 3.3.2 Writing a cookie on the user’s machine
Two WLanguage functions allow you to manage cookies To write a cookie on the computer of the Web user:
in your sites: • In server code:
• CookieWrite Use CookieWrite, and specify the cookie’s name, its
Sends a cookie to the client when the HTML page is dis- content and its duration.
played in the browser of the Web user. The cookie will be created on the computer of the Web
• CookieRead user when the next page is displayed.
Retrieves the value of a cookie written on the computer Note: a cookie created in server code can be read by
of the Web user. the CookieRead function:
•immediately if CookieRead is used in a browser
These functions can be used in server code and in brow- code.
ser code.
•during the next user connection if CookieRead is
used in a server code.
Tome1_2.book Page 380 Vendredi, 28. mai 2010 5:50 17

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

4.VALIDITY OF A SITE’S PAGES


4.1 Overview
When creating a page, a validity period can be defined for •WebDev will inform the developer when the project is
this page. opened according to a configurable frequency. A GUI
For example, if a page is related to a specific event (a error will be automatically displayed.
trade fair, a promotion), this page must not be displayed •The application server will send an email to a given
anymore from a given date. address with a specific message.
To avoid forgetting it: The risks to forget are minimized.

4.2 How do I proceed?


4.2.1 Defining the validity period of pages At the specified time, the application server will
To define the validity period of a page: perform a search for the expired pages on all the
1. Display the page’s description. dynamic WebDev sites managed by the server.
2. In the "Details" tab: •the email address of the sender of the alert email.
•Specify the validity period of the page. The parameters of the email recipients have been
defined in the page description, in the editor.
•Click the "Configure the reminders" button. In the
window that opens, specify: •the address and the port of the SMTP server used
- the email address of the recipient of the reminder. If to send the emails. You can also specify whether
the WebDev application server is configured to find the email spooler must be used.
the expired pages, a reminder message will be auto- •the login and password of the user of the SMTP ser-

Part 6: Web specific features


matically sent to this address. ver (for the servers with authentication).
- the text added to the reminder message. 5. Validate.
- the date for sending the reminder (one week and one
day before by default). This date will also be used to 4.2.4 Configuring the Linux application server
display a compilation error of GUI. This compilation to manage the validity period
error will indicate whether the validity period of the
In order for the WebDev application server to check the
page was reached.
3. Validate validity period of the pages (version 140025 and later):
1. Start the remote WebDev administrator if needed.
2. In the setting options, display the "Advanced
4.2.2 Deleting the validity period parameters" and click the "Expired pages" tab.
To delete the validity period of a page: 3. Select the "Authorize search in expired pages"
1. Display the page’s description. box.
2. In the "Details" tab, delete the validity period of 4. Specify:
the page. •the start time of the search for the expired pages.
1. Validate At the specified time, the application server will
perform a search for the expired pages on all the
4.2.3 Configuring the Windows application dynamic WebDev sites managed by the server.
server to manage the validity period •the email address of the sender of the alert email.
In order for the WebDev application server to check the The parameters of the email recipients have been
validity period of the pages (version 140025 and later): defined in the page description, in the editor.
1. Start the WebDev administrator if needed. •the address and the port of the SMTP server used
2. In the "Advanced" tab, check "Allow the search to send the emails. You can also specify whether
for expired pages". the email spooler must be used.
3. The configuration window automatically comes •the login and password of the user of the SMTP ser-
up. ver (for the servers with authentication).
4. Specify: 5. Validate using the "Apply" button.
•the start time of the search for the expired pages.
Tome1_2.book Page 382 Vendredi, 28. mai 2010 5:50 17

382

5.INCLUDING JAVASCRIPT FILES OR A WEB


RESOURCE

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, …).

5.2 How do I proceed?


5.2.1 Including Javascript files (.js) 5.2.5 To include an external resource in a
You have the ability to include one or more Javascript files page:
in a site or in a page (*.js). These files will be used by the 1. Display the description of the page.
generated HTML pages. These files must be found in the 2. Select the "Advanced" tab.
"<ProjectName>_WEB" directory of the site 3. Select the "Javascript" tab.
4. Click the "Add a Web resource" button and spe-
5.2.2 To include a Javascript file in a page: cify the address of the requested Web resource.
1. Display the page’s description. 5. Select (if necessary) the requested encoding. If
2. Select the "Advanced" tab. the encoding corresponds to "<Not defined>", the
3. Select the "Javascript" tab. encoding is automatically detected.
4. Click the "Add" button and select the path of the 6. Validate.
Part 6: Web specific features

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

5.3 Handling external Javascript objects from the WLanguage


The WLanguage in "Browser" mode is used to interface tion.
with the Web APIs such as the ones proposed by Google •In the "Javascript" tab, click the "Add a Web
or Yahoo. The interaction with the external components resource" button. Enter the address used to
proposed by these sites is simplified. include the calendar service: http://www.goo-
You have the ability to allocate external Javascript objects gle.com/
in browser code written in WLanguage. jsapi?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The use of external Javascript objects does not necessa- xx (the key code corresponds to your personal
rily require the use of the Javascript language: program- code).
ming can be done in WLanguage. 2. Enter the browser code allowing you to retrieve the
Example: To retrieve a task list from a Google calendar: task list .
1.1. Include in the page the programming interface MIME is string =
of the Google calendar. "application/unknown" + CR + ….
"name=NOTES.TXT" + CR +…
•Display the "Advanced" tab of the page descrip-
"Content-Disposition: Attachment;"+…
tion.
"filename=NOTES.TXT" + CR + EOT
•In the "HTML" tab, add the following code line into FileDisplay(CompleteDir(…
the HTML code of the page header: <script fWebDir()) + "NOTES.TXT", MIME)
type="text/javascript">google.load("gdata",
"1");</script>.
•This code is supplied in the Google documenta-

Part 6: Web specific features


Tome1_2.book Page 384 Vendredi, 28. mai 2010 5:50 17

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 Automatic and immediate AJAX


Part 6: Web specific features

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.

Display the characteristics of the country:


•without AJAX: the entire page is redisplayed.
•with AJAX: only the controls containing the
characteristics of the country are refreshed.
To use AJAX in this site, the "Whenever Modified" server
process of the "Select a country" control is switched to
For example, a site page is used to find out the different AJAX mode. A simple click is required! The code remains
characteristics of a country (capital city, currency, flag, the same.
location, and so on). The corresponding information is
displayed according to the country selected by the Web 6.2.2 Processes that can use AJAX automati-
user. cally
The following processes can be switched to automatic
Action performed by the Web user. In our exam- AJAX mode:
ple, the Web user selects the country in the •server "Click" process of a button, link, clickable
combo box named "Select a country". image or pager.
•server quot;Whenever Modified" process of a list
Send the request to the server. box, combo box, check box or radio button.
Tome1_2.book Page 385 Vendredi, 28. mai 2010 5:50 17

385

To swith to the automatic AJAX mode, click "AJAX" in the


bar of the process:

Process that uses the AJAX technology


Note: If a process using the AJAX technology is executed
Process that does not use the AJAX technology
on a browser that does not support this technology, the
process is executed "as if" it were not using the AJAX
technology (refresh the entire page for instance).

6.2.3 Elements and characteristics that can be automatically used by AJAX


AJAX enables you to modify the characteristics of the fol-
lowing elements (no specific programming is required):
Value Font color Background color Visibility
Edit control X X X X
(Text entered) (Color of the text ente- (Background color of
red) the text entered)
Formatted display X X X X
control (Text displayed) (Color of the text dis- (Background color of
played) the text displayed)
Table X X X X
(Content of the rows) (Color for the content (Background color for
of the rows) the even and odd rows)

Part 6: Web specific features


Looper X X X X
(Content of the con- (Color for the content (Background color of
trols) of controls) controls)
List X X X X
(Listed elements and (Color of listed ele-
selected elements) ments)
Combo box X X X X
(Listed elements and (Color of listed ele-
selected elements) ments)
Check box X X X X
(Selected options) (Option color)
Radio button X X X X
(Selected option) (Option color)
Image X X
(Image)
Clickable image X X
(Image)
Thumbnail X X
(Image)
Chart X X
(Chart)
Static X X X X
HTML static X X X X
Tome1_2.book Page 386 Vendredi, 28. mai 2010 5:50 17

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

Note: For the pager clicks to also be in AJAX mode, you


need to:
Tome1_2.book Page 387 Vendredi, 28. mai 2010 5:50 17

387

6.3 Programmed AJAX


6.3.1 Overview AJAXExecuteAsyn- Runs a server procedure without
The diagram below presents the use of "programmed chronous refreshing the page. This function is
AJAX" in a WebDev site: a non-locking function. The other
processes continue to run (regar-
dless of whether the result of the
procedure run is retrieved or not).
AJAXAsynchro- Used to find out whether a server
nousCallPending procedure called by AJAXExecuteA-
synchronous is currently running
AJAXCancelAsyn- Cancels the automatic execution of
chronousCall the browser procedure called by
AJAXExecuteAsynchronous.

These functions enable you to run a server procedure


from a browser process.
Run a browser process (AJAXExecute or AJAXExe- Caution: You need to make sure of the integrity of the
cuteAsynchronous). information stored on the server and the one displayed
on the user’s machine. For example, if data is modified,
Request for running a server procedure. this data must be modified both on the server and on the
page displayed in the browser.
Running the server procedure.
6.3.3 Procedures that can be called by AJAX
Generation of the result. The result of the proce- To secure the WebDev sites, the server procedures are
dure will be contained in a character string or in an protected from illegal calls (attempt to reroute a session
XML document. for instance). To run a server procedure from a browser

Part 6: Web specific features


process (AJAXExecute or AJAXExecuteAsynchronous),
Send the result of the procedure (RESULT). you must allow this procedure to be called by AJAX.

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.

7.2 Creating the gadget


7.2.1 The steps Limitations
To create a Vista gadget: The following controls cannot be used in a Vista gadget:

Part 6: Web specific features


1. Open or create a WebDev project. Treeview control, Java control, site map control, site map
2. Create the pages of your Vista gadget. These path control.
pages can be static pages or dynamic AWP pages. The image control in a looper in generated mode or in
3. To help you create the pages of your Vista gadget, database mode (memo) displays no image.
you can view the page size used by a Vista gadget
("Display .. Navigation size .. Vista gadget"). 7.2.2 Generating the gadget
4. In the description of the gadget pages ("General" To generate a Vista gadget:
tab): 1. Select "Workshop .. Vista gadget .. Generate a
•check "Vista Gadget compatible" Vista gadget". The wizard starts.
•specify the type of the page in the gadget: main 2. Specify the description option of the gadget :
page, configuration page, Flyout page. •Name of the gadget
5. Program your pages. The "Vista Gadget Compati- •Version of the gadget (in wwww.xxxx.yyyy.zzzz for-
ble" pages propose specific processes according to mat)
the type of page. •Name of the author or company
6. Generate the Vista gadget using "Workshop ..
Vista gadget .. Generate the Vista gadget". •URL and text of the link
A specific project configuration ("Vista Gadget" type) •Logo of the company
can be created to group the pages of your Vista gadget. •Copyright
•Image of the gadget. The rollover image is dis-
Vista gadget in AWP mode:
played when the gadget is moved.
• In order for the Vista gadgets in AWP mode to operate,
•Description of the gadget.
you must use a WebDev application server version
120048 or later. 3. Select the pages to include in the gadget. The
• The server codes will be run in automatic Ajax mode (if main page is automatically selected.
the code exists in Ajax mode). 4. Select the gadget’s languages.
5. If the Vista gadget uses AWP pages, specify the
• The AWP site corresponding to the gadget must be
server settings (server name, virtual directory, ?).
deployed on a WebDev application server.
Tome1_2.book Page 390 Vendredi, 28. mai 2010 5:50 17

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

7.3 Programming the Vista gadgets


7.3.1 Overview Anchor the page Browser code run when the Vista
WebDev enables you to easily create gadgets for Win- to the Windows gadget is "docked" to the gadget
dows Vista. A gadget is a "mini site" containing specific pane (Browser pane of Windows.
pages. code)
To manage these pages and to exploit all the properties Remove the page Browser code run when the Vista
of the Vista gadgets, WebDev proposes: from the Windows gadget is "undocked" (exit) from
• specific processes associated with the different types pane (Browser the gadget pane of Windows.
of pages of a Vista gadget. code)
• specific WLanguage functions used to manage some After closing the Browser code run when closing the
specific features of the Vista gadgets. configuration page used to configure the Vista
window (Browser gadget.
7.3.2 The different types of pages code)
Three types of pages can be used in a gadget:
Opening the con- Browser code run when opening the
• Presentation page figuration win- page used to configure the Vista
• Configuration page dow (Browser gadget.
• Flyout page code)
These three types of pages contain some specific proces- Mouse out (Brow- Browser code run when the mouse
ses. ser code) cursor is located outside the Vista
Remarque: if the pages of the Vista gadget are static gadget.
Part 6: Web specific features

pages, only browser processes are available. If the gad-


get pages are AWP pages, the standard server processes Configuration page
are added to the browser processes. The configuration page is used to configure the Vista gad-
get. This page is displayed by the configuration button
(tool icon) found in the gadget. This button is automati-
Presentation page
cally displayed if a configuration page is found. This but-
The presentation page is the page displayed in the gad- ton cannot be configured.
get pane in Windows Vista. This page must have a width
The width of this page must be set to 278 pixels.
included between 25 and 130 pixels, and a minimum
height of 60 pixels. The configuration page automatically contains a valida-
tion button and a cancelation button.
To create a clipped gadget, specify a background image.
This image must support the transparent mode (image in In the configuration page, a font must be specified in the
GIF or PNG format for instance). styles: if the font is "undefined", the default font will be
used. In this case, some differences of page layout may
This page can be used to display "Flyout" pages. Simply
call the GadgetDisplayFlyout function in the code of the occur between the edit mode and the runtime mode.
relevant button. The background color of the configuration page is gray.
The browser code associated with this page is as follows: This color cannot be modified. A background image can
be used. If this background image manages the transpa-
Page load Browser code run when the page is rency, it is recommended not to write in the transparent
(onload) (Brow- displayed in the browser (created by areas.
ser code) PageDisplay or PageRefresh for ins-
tance)
Page unload Browser code run when a new page
(onunload) is displayed in the browser.
(Browser code)
Tome1_2.book Page 391 Vendredi, 28. mai 2010 5:50 17

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.

7.3.3 The WLanguage functions


Here are the Gadget functions:
GadgetDisplayFlyout Displays a page of the Vista gadget in a popup area.

Part 6: Web specific features


GadgetLoadParame- Loads a persistent value in a Vista gadget. This value was previously saved by GadgetSave-
ter Parameter.
GadgetCloseFlyout Closes the popup area of a vista gadget.
GadgetSaveParame- Saves a persistent value in a Vista gadget. This value can be read by GadgetLoadParameter.
ter
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 392 Vendredi, 28. mai 2010 5:50 17

392

8. SSL: SECURE TRANSATIONS


8.1 Overview
By default, when using an Internet application, data tra- the RSA public key algorithm. A RSA key is the result of
veling between the end-user computer and the Web ser- operations between prime numbers.
ver is not protected: the data can be accessed by any
web user. The confidentiality of data is not guaranteed. Concretely: what is changed when a transaction is secu-
red?
Several systems enable you to ensure data confidentia-
lity. The most common one is the SSL protocol (Secure • a secure transaction uses a specific address (https ins-
Socket Layer). tead of http).
SSL is a communication protocol used to ensure the • a padlock is automatically displayed in the status bar
authentication, the confidentiality and the integrity of of the browser, indicating that a secure transaction is in
data. This protocol uses a recognized encryption method: progress.

8.2 Implementing secure transactions with the SSL protocol


To implement secure transactions (SSL protocol): 4. You can then use secure transactions between the
1. On the Web server, create a key, with the IIS key server and the client (see next paragraph).
manager for instance if your Web server is IIS.
2. Send the certificate request to a company provi- Note: "Verisign" provides test certificates, valid for 14
ding key certificates (www.verisign.com for exam- days, that allow you to test if your HTTPS connection is
ple). working. These test keys enable you to check the opera-
3. The company returns a key certificate (for a fee). ting mode of secure transactions.
Part 6: Web specific features

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-----

Part 6: Web specific features


8.4 Inserting secure transactions (SSL) into a WebDev site
In an Internet/Intranet site, all the transactions do not be opened either by an action defined in the button
necessarily contain confidential data: simply secure the (or link) description window, or by programming in
transfer of the sensitive data (sending a credit card num- server code. The characteristics of this button are:
ber for instance). •Type: "Send value to server" or "None".
Caution: implementing secure transactions in a WebDev •Action: "Display page XXX" (or "None" if the page
site assumes that the all the operations formalities linked is opened by programming).
to the SSL protocol have been accomplished.
•Target:
8.4.1 Principle - "Current browser" to open the page in the current
browser.
The secure mode is implemented when opening a new - "New browser" to open the page in a new browser.
page via a button or link, using the WLanguage SSLActive 2. Enter the following code line in the browser click
function. As soon as the secure page is opened, all the code of the button:
actions and subsequent page opening will be performed
SSLActive(True)
in secure mode, regardless of the elements used (link,
table, clickable image). 3. If necessary (action not defined in the description
The secure mode ends when SSLActive is used in the of the button), use PageDisplay in the server click
code of a link or button used to open a new page. code to display the requested page in secure mode.
4. The page opened by the button will be in secure
8.4.2 Implementation mode. This secure mode will be used until the non-
secure mode is explicitly requested.
To open a page in secure mode:
1. Create a button that opens a page. This page can
Tome1_2.book Page 394 Vendredi, 28. mai 2010 5:50 17

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.

9.2 Getting information in JSON format


9.2.1 Operating mode 3. Processing the JSON data: this process is written
To get information in JSON format, WebDev enables you in browser code.
to run a page that returns information in JSON format. Let’s take a simple example: the JSON data is sent back
Two WLangage functions are available: in the following format:
{id: 12,
JSONExecute Calls a server URL of the list: [
same domain that returns {last name: "smith", first name:
data in JSON format (JavaS- "john"},
cript Object Notation).

Part 6: Web specific features


{last name: "dupond", first name:
"marie"},
JSONExecuteExter- Calls an external server URL {last name: "martin", first name:
nal that returns data in JSON for- "laura"}]
mat (JavaScript Object Nota- }
tion). The data is processed
in a specific procedure. You can for example:
• Retrieve the value of a member of the dynamic object.
9.2.2 Example for using JSONExecute For example:
MyContacts:id
The following code is used to run an AWP page in order to
get the list of contacts in JSON format. • Retrieve the different elements from a list of values. For
The steps are as follows: example:
1. Declaring a dynamic object. This dynamic object FOR i=1 _TO_ Dimension(…
will contain the result in JSON format. MyContacts:list)
MyContacts is dynamic object ListAdd(LIST_Contact_list,…
MyContacts:list[i]:last name+" "+
2. Calling the JSONExecute function: …
MyContacts = JSONExecute(… MyContacts:list[i]:first name)
FolderWeb()+ … END
"FR/PAGE_Objet.awp?id=12")
Tome1_2.book Page 396 Vendredi, 28. mai 2010 5:50 17

396

9.2.3 Example for using JSONExecuteExternal sing the JSON data.


The principle for using JSONExecuteExternal is the same Example: In this example, an AWP page is called and the
as the principle for using JSONExecute. data is processed in the procedure named FunctionRes-
In this case, the page used to retrieve the JSON data is ponse:
not found in the same domain. The Internet security rules JSONExecuteExternal(…
impose to use a callback function to process the result in "http://MySite/MySite_WEB/US/
an asynchronous way. JSONExecuteExternal lets you PAGE_Object.awp?id=12",…
specify the name of the procedure executed for proces- "JsonCallback",FunctionResponse)

9.3 Creating pages that return JSON data


WebDev gives you the ability to create a site that provides The following example is used to manage the call with
JSON services. JSONExecute and JSONExecuteExternal. For an external
The pages used to get the JSON data must return a cha- call, you must check the presence of a specific parameter
racter string of a specific format. These pages can be found on the URL. This parameter was supplied to the
AWP pages or PHP pages. user of the JSON service.
sObject is string = [
9.3.1 Case of a page called by the JSONExe- {id: 12,
cute function list: [
The following code is used to return an identifier and a list {last name: "smith", first name:
of values: "john"},
{last name: "dupond", first name:
sObject is string = [
"marie"},
{id: 12,
{last name: "martin", first name:
list: [
"laura"}]
{last name: "smith", first name:
}
"john"},
]
Part 6: Web specific features

{last name: "dupond", first name:


"marie"},
// Management of an external call.
{last name: "martin", first name:
// Check the presence of a procedure
"laura"}]
name
}
// on the URL
]
IF PageParameter(…
// StringToUTF8 enables you to manage
"JsonCallback") <> "" THEN
// accents
sObject = PageParameter(…
StringDisplay(StringToUTF8(sObject))
"JsonCallback") + "("+ …
The StringDisplay function lets you return JSON informa- sObject + ");"
tion. The StringToUTF8 function lets you return a string in END
UTF8 format. This last function is mandatory to get a valid // StringToUTF8 enables you to manage
format. // accents
StringDisplay(StringToUTF8(sObject))
9.3.2 Case of a page called by the JSONExe-
cuteExternal function To allow the users of the WebDev sites to use the JSON
services, all you have to do is inform these users of the
In addition to the code used to manage the JSON ele- parameters that must be specified in the address of the
ment to return, the name of the procedure that will be page to start.
used to process the data must be specified in the data
Note: for more details about the syntax that can be used
returned. The name of this procedure is indicated in para-
with data returned in JSON format, we recommend that
meter on the URL of the page. you consult a JASON specific documentation.
Tome1_2.book Page 397 Vendredi, 28. mai 2010 5:50 17

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.

Communication Features provided by WinDev/WebDev For more details …


means
• emails Sending and receiving emails. See ’Communicating by emails’, page
419.
• Lotus Notes Access to the data handled by Lotus Notes. See ’Accessing Lotus Notes and Outlook’,
page 430
• Outlook Access to the data handled by Outlook. See ’Accessing Lotus Notes and Outlook’,
page 430
• phone Computer automated use of the phone. See ’WinDev and telephony’, page 459.
• fax Send and receive faxes. See ’Sending faxes’, page 466.
• palm pilot Managing a Palm Pilot user database. See ’Handling a Palm Pilot’, page 469.
• Internet Retrieve HTML pages through the HTTP func- See ’Retrieving HTML pages’, page 480.
tions.
• data transfer Send and receive data using the FTP/RPC See ’Managing files on the Internet’,
functions of WinDev. page 481.
• transfer files Handling files on an FTP server. See ’Communicating with an FTP server’,
page 484.
• sockets Application and site communication through See ’Socket management’, page 486.

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

1.2 Communication with WinDev Mobile


WinDev Mobile can be used to establish communication The table below presents the communication modes
between two Pocket PCs, a Pocket PC and a Smartphone, available for each feature proposed by WinDev Mobile:
a Pocket PC and a PC, …
These "dialogs" are performed via infrared, Wi-Fi, GPRS.

Remote Email FTP HTTP Telephony SOAP Socket SMS


access (RPC J2EE
on HyperFi- .NET
leSQL)

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

Principle for a WebDev site:

Principle for a Mobile application:


Part 7: Communication
Tome1_2.book Page 403 Vendredi, 28. mai 2010 5:50 17

403

2.2.2 Step 1 (WinDev Mobile only): connecting Example:


the Pocket PC to a PC The following code is used to start an email session via
If the Pocket PC is not equipped with an Ethernet card or the POP3 and SMTP protocols. In this session, you will be
a GPRS modem, the Pocket PC must be connected to a able to read and send emails.
PC to manage the emails. USER is string = "User_FP"
This connection allows the Pocket PC to share the Inter- Password is string = …
net connection of the PC. "User"
POPServer is string =…
No specific setting is required in ActiveSync.
"123.123.123.123"
2.2.3 Step 2: Connect to the access provider IF EmailStartSession(USER, …
Password, POPServer) THEN
(WinDev and WinDev Mobile only)
UserName = USER
An Internet connection is required to manage the emails. ELSE
Several cases may occur: UserName = ""
•The user uses a modem to connect to the Internet: Error("Connection failed")
the NetRemoteAccess function lets you open the END
Internet connection.
•The user uses a direct connection to Internet (cable 2.2.5 Step 4: Reading emails
or ADSL): no specific operation required. The following functions allow you to read the emails recei-
ved on the email server (at the provider):
WinDev Mobile: to connect to the access provider, no
special operation required. • EmailReadLast: reads the last email waiting on the
email server.
Note: to limit the connection time, we recommend that:
• EmailReadMessage: reads a message identified by its
•When reading the emails, read all the incoming number on the email server.
emails and save them in a HyperFileSQL database for
instance. • EmailReadPrevious: reads the previous message wai-
ting on the email server.
•when sending the emails, prepare the emails before-
hand. • EmailReadFirst: reads the first message on the email
server.
2.2.4 Step 3: Starting an email session • EmailReadNext: reads the following message on the
EmailStartSession enables you to start an email ses- email server.
sion. This function must be the first "email" function For each email read, the different variables associated

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.

2.2.7 Step 6: Closing the message session


When the management of the incoming and outgoing
emails is completed, that session is closed by EmailClo-
seSession. This function must be the last "email" func-
tion used.
Tome1_2.book Page 404 Vendredi, 28. mai 2010 5:50 17

404

Example: 2.2.8 Step 5: Closing the connection


The following code is a procedure used to close an email If an Internet connection was required to manage the
session. In this code, the SessionNum variable corres- email session, this connection can be closed by NetClo-
ponds to the session identifier returned by EmailStart- seRemoteAccess.
Session .
Procedure CloseSession(…
SessionNum)
// Close the session
EmailCloseSession(SessionNum)

2.3 Managing emails with "Simple MAPI" (WinDev and WebDev)


Simple MAPI (also called "Simple Mail API") is an email
management API used by Microsoft applications and 2.3.1 Principle
specifically by MS Exchange 4.
To send or read messages via Simple MAPI, you must:
Simple MAPI is used to simplify the management of the 1. Describe a user profile. This user profile must be
emails received at the host. When an email is read, it is created directly in the Microsoft email management
automatically loaded in the local message box and dele- application (MS Exchange for instance).
ted from the server (at the host). 2. From the WinDev application, connect to the
All the characteristics required to manage emails (POP3 email management application (MS Exchange 4 for
protocol, SMTP protocol, remote access, and so on) are example) with EmailStartSession.
grouped in the "User Profile". 3. Send and read the messages.
With the email functions of WLanguage, an application or 4. Close the session with the email management
a site can directly handle the emails managed in a appli- application (MS Exchange 4 for example) with Email-
cation or a site that uses "Simple MAPI". CloseSession.
WinDev principle
Part 7: Communication

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

2.4 Manage the emails via CEMAPI (WinDev Mobile only)


CEMAPI is an API for email management used by most of All the characteristics required to manage the emails
the Pocket applications to send and receive emails (Poc- (POP3 protocol, SMTP protocol, remote access, and so
ket Outlook in most cases). on) are grouped in the "User Account".
CEMAPI simplifies the management of the emails recei- With the WLanguage email functions, a WinDev applica-
ved by the host. When an email is read, it is automatically tion can directly handle the emails managed in an appli-
loaded in the local message box and deleted from the cation that uses "CEMAPI".
server (at the host). See the online help for more details.

2.5 Writing an email


Writing an email in WLanguage consists in filling the ges:
email structure of WLanguage. This structure enables you MyHTMLText = fLoadText(…
to specify: "C:\Email\MyMail.htm")
•the recipient(s) of the email, EmailImportHTML(MyHTMLText,…
•the subject of the email, "C:\Email")
Email.Recipient = …
•the content of the email,
"flop-fr@laposte.net"
•the email’s attachments, etc. Email.Subject = "Test"
When the message is sent (EmailSendMessage), the EmailSendMessage("User")
data found in the email structure will constitute the mes-
sage sent. 2.5.3 Using the EML format to customize the
emails
WB The email can be written directly from In some cases, the structure of the outgoing emails may
the user’s computer, using his email not correspond to the requested information.
software. Then, all you have to do is Some examples:
use EmailOpenMail in browser code. • The communication with some entities (emails for
SESAM-VITALE) may require some specific structures.
2.5.1 The different steps • You may also want to force a specific character set (for

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

2.6 Reading an email


The email is read by the different WLanguage functions // For each attached file
(EmailReadFirst, EmailReadNext, etc.). FOR I= 1 to Email.NbAttach
The email structure of WLanguage is initialized for each // Copy the file into a
email read. The variables of this structure correspond to // temporary directory
all the characteristics of the current email. EmailSaveAttachment(…
Email.Attach[I], Temp_Dir +…
2.6.1 The different steps Email.Attach[I])
// Retrieve the identifier of the
The different steps for reading an email are as follows:
// attachment file in the mail
1. use an email reading function (EmailReadFirst, CID = "cid:"+…
EmailReadNext, etc.) Email.AttachIdentifier[I]
2. Read the content of the email structure (see example // Replace the references to
below). // the attached file by the real
3. If the Email.HTML variable is not empty: the message name
is in HTML format. It must be displayed in a browser. For // of the file
each attached file: Email.HTML = …
•save the file on disk. Replace(Email.HTML, CID,…
"file:"+…
•Browse through the HTML message and search for
Temp_Dir + Email.Attach[I])
the "cID:"+Email.AttachIdentifier value of the atta-
END
ched file. Replace this value by the full path of the
attached file copied on disk. // Display the HTML content into a
•Display the message in a browser. // Web browser
4. If the Email.HTML variable is empty: the message is in // Create a temporary file
text format. Save the attached files on disk if necessary // containing the HTML code
and display the text of the message. FileName is string =…
Temp_Dir + "temp.htm"
2.6.2 Example hfile is int = fOpen(FileName,…
This example is used to analyze an email in HTML format foCreate+foWrite)
and to display it in a browser. In this example, we assume fWrite(hfile,Email.HTML,…
Length(Email.HTML))
Part 7: Communication

that the email was read by a function for reading emails.


fClose(hfile)
Temp_Dir is string
// Supply the temporary HTML file
Temp_Dir = "C:\temp\"
// to the browser
CID is string
// Browser_WEB is an ActiveX control
// "Microsoft Web Browser"
Browser_WEB>>Browse(FileName)

2.7 The email structure


The email structure is a preset structure of WLanguage limits are the ones given by the server.
(no declaration is required). This structure enables you ReturnReceipt Boolean (False by default).
to: In outgoing mode, requests a deli-
•create an email, very receipt from the recipient. The
•retrieve the content of emails. recipient does not necessarily have
to send a delivery receipt.
2.7.1 The different variables of the email struc- In incoming mode, enables you to
ture find whether the sender requested a
The structure contains the following members: delivery receipt.
Note: the limits described in this table are only for MS If a read receipt is requested, it has
Exchange. When using the POP3/SMTP protocol, the priority over the return receipt.
Tome1_2.book Page 409 Vendredi, 28. mai 2010 5:50 17

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

The corresponding variables are as follows: Variable used: Email.Error.


AttachContentType Array of strings corresponding • EmailStartSession
to the content of the MIME Con- Variable used: Email.Error.
tent-type control of each atta- • EmailDeleteMessage
ched file. The number of Variable used: Email.Out.
attachments is limited to 10.
2.7.3 The Email.Error variable
AttachContentDes- Array of strings corresponding
cription to the content of the MIME Con- After each function, the Email.Error variable contains the
tent-description control of each error report for the function:
attached file. The number of Value Meaning
attachments is limited to 10. 0 No error
These variables are accessible in read-only when recei- 1 Cancelation requested by the user
ving an email and in read/write when sending an email.
2 Unknown error
Note: if Email.Message and Email.HTML are empty, and if
the mail only has one attached file, the MIME Content- 3 Unable to connect
Type and Content-Description fields will correspond to 4 Disk full
the characteristics of the attached file. 5 Out of memory
2.7.2 Which functions use the email structure? 6 Access denied
The following functions use the email structure: 8 Too many opened sessions
• EmailSendMessage 9 Too many attachments (up to 10 files)
Variables used in read mode to create the email: 10 Too many recipients (20 recipients)
Email.Attach, Email.Message, Email.Recipient,
Email.NbAttach, Email.NbRecipient and Email.Sub- 11 Attachment not found
ject. 12 Unable to open the attachment
• EmailReadFirst 13 Unable to write the attachment
Variables used in write mode: Email.SenderAddress,
Email.Attach, Email.ReceiveDate, Email.Out, 14 Unknown recipient
Email.Message, Email.NbAttach and Email.Subject. 17 Invalid message
• EmailReadNext 18 Text of the message too long
Variables used in write mode: Email.SenderAddress,
Part 7: Communication

Email.Attach, Email.ReceiveDate, Email.Out, 19 Invalid session


Email.Message, Email.NbAttach and Email.Subject. 21 Ambiguous recipient address
• EmailUpdate 23 Network error

2.8 Email management functions


The following functions are used to manage emails:
EmailSetTimeOut Changes the value of the "time-out" for connecting to the SMTP and POP3 messaging
servers
EmailBuildSource Generates the source code of the outgoing email from the variables currently found in
the email structure.
EmailSend Sends a message using the POP3 protocol while fully controlling the email buffer
EmailSendMessage Sends a message
EmailStatus Enables you to find out the status of an email sent during an SMTP session opened in
asynchronous mode
EmailCloseSession Closes the POP3 session
EmailImportHTML Enables you to send an email in HTML format with included images
EmailImportSource Fills the variables of the email structure using the content of the Email.Source varia-
ble.
EmailProgressBar Manages a progress bar for sending and receiving emails
Tome1_2.book Page 411 Vendredi, 28. mai 2010 5:50 17

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

3. ACCESSING LOTUS NOTES AND OUTLOOK


3.1 Accessing Lotus Notes
3.1.1 Overview 4. Change the Lotus Notes database to use: Notes-
WinDev and WinDev allow you to easily access the data CloseDatabase and NotesOpenDatabase.
handled by Lotus Notes (Domino database). You have 5. Disconnect from the Domino server: CloseSes-
the ability to retrieve, modify, add or handle your con- sion or EmailCloseSession.
tacts, appointments, tasks, emails, databases, …
3.1.3 Quick method if you do not want to
The data managed by Lotus Notes is organized as fol- access the documents
lows:
If you only want to access the emails, tasks, appoint-
•A database per user containing the emails, the tasks ments, contacts and/or groups of contacts, you can
and the appointments of this user.
establish the connection with the Domino server and
•A database common to all the users containing the start a session for accessing the Lotus Notes database
contacts and the groups of contacts. by directly using EmailStartNotesSession (syntax 1)
•Several databases containing some documents. without calling NotesOpenConnection.
To access Lotus Notes, the Lotus Notes client must be
installed on the end-user computers. 3.1.4 Handling the data
The access to Lotus Notes is available for Lotus Notes Once the connection has been established with the
version 6.5 or later. Domino server and once the Lotus Notes database has
been specified, you can handle:
3.1.2 Method for accessing Lotus Notes •the emails via the email functions (see page 431)
1. Establish the connection with the Domino server: •the tasks via the Task functions (see page 433)
NotesOpenConnection. •the appointments via the Appointment functions (see
2. Start a session for accessing emails, tasks, page 433)
appointments, contacts and/or groups of contacts: •the contacts via the Contact functions (see page
EmailStartNotesSession (specifying the connection 433)
identifier and the local or remote Lotus Notes data-
Part 7: Communication

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)

3.2 Accessing Outlook


3.2.1 Overview 3.2.3 Sending and receiving emails
WinDev and WinDev allow you to easily access the data To send and receive emails, Outlook must be started on
handled by Outlook. You have the ability to retrieve, the current computer.
modify, add or handle your contacts, appointments, To actually send and receive emails:
tasks, emails, … •Automatic send and receive: Select the following
options in Outlook:
3.2.2 Method for accessing Outlook
•"Send the messages immediately during the con-
1. Start a session for accessing emails, tasks, nection"
appointments, contacts and/or groups of contacts:
EmailStartOutlookSession or OutlookStartSession. •"Check the new incoming messages every X minu-
2. Close session: CloseSession or EmailCloseSes- tes" and specify the requested number of minutes.
sion. •Manual send and receive: click the "Send/Receive"
button.
Tome1_2.book Page 413 Vendredi, 28. mai 2010 5:50 17

413

3.2.4 Version of Outlook 3.2.5 Handling the data


The access to Outlook is available for Outlook version 97 Once the connection was established with the Domino
or later. server and once the Lotus Notes database was specified,
Note: groups of contacts are not supported by version 97 you can handle:
of Outlook. Therefore, they cannot be accessed in this •the emails via the email functions (see page 432)
version of Outlook. •the tasks via the Task functions (see page 433)
Caution: In Outlook express, you can only access emails. •the appointments via the Appointment functions (see
In this case, use EmailStartSession to start the session page 433)
for accessing the emails. •the contacts via the Contact functions (see page
433)
The access to Outlook is compatible with the MS •the groups of contacts via the group functions (see
Exchange servers. page 434)
•the documents with the Notes functions (see page
434)

3.3 Lotus Notes and Outlook functions


3.3.1 Email functions for Lotus Notes

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

3.3.2 Email functions for Outlook

EmailAddFolder Adds a folder to Outlook


EmailChangeFolder Modifies the current folder in Outlook
EmailSeekFirst Searches for one or more emails according to the criteria specified in the Outlook mes-
saging software
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.
EmailCurrentFolder Returns the name of the current folder in the Outlook messaging software
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.
EmailImportHTML Enables you to send an email in HTML format with included images
EmailListFolder Returns the list of folders found in the Outlook messaging software
EmailReadLast Reads the last incoming email
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 header of the email found after the current email
EmailReadMessage Reads an incoming email
EmailReadPrevious Reads the email found before the current email
EmailReadFirst Reads the first incoming email
EmailReadNext Reads the incoming email found after the current email
EmailNbMessage Returns the number of incoming messages currently found
EmailStartOutlookSession Enables you to access the data handled by Outlook
Part 7: Communication

EmailSaveAttachment Copies the email attachments to the local computer


EmailRemoveFolder Deletes a folder from the Outlook messaging software
EmailDeleteMessage Deletes a message
EmailCheckAddress Checks the validity of an email address.
CloseSession Closes the session

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

3.3.3 Task functions


The following functions are used to manage the tasks found in the task list of Lotus Notes or Outlook:

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).

3.3.4 Appointment functions


The following functions are used to manage the appointments found in the calendar of Lotus Notes or Outlook:

AppointmentAdd Adds an appointment into the calendar of Lotus Notes or Outlook


AppointmentLast Reads the last appointment found in the calendar of a Lotus Notes or Outlook messaging
AppointmentRead Reads an appointment found in the calendar of Lotus Notes or Outlook
AppointmentModify Modifies the current appointment in the calendar of Lotus Notes or Outlook
AppointmentPrevious Reads the appointment found before the current appointment in the calendar of Lotus Notes
or Outlook
AppointmentFirst Reads the first appointment found in the calendar of Lotus Notes or Outlook
AppointmentReset Resets the Appointment structure

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

3.3.5 Contact functions


The following functions are used to manage the contacts found in the address book of Lotus Notes or MS Outlook:

ContactAdd Adds a contact to the address book of Lotus Notes or Outlook


ContactSearch Searches for a contact in the address book of Lotus Notes or Outlook
ContactLast Reads the last contact found in the address book of a Lotus Notes or Outlook messaging
ContactRead Reads a contact previously read, found in the address book of Lotus Notes or Outlook
ContactModify Modifies the current contact in the address book of a Lotus Notes or Outlook messaging
ContactPrevious Reads the contact found before the current contact in the address book of Lotus Notes or Out-
look
ContactFirst Reads the first contact found in the address book of a Lotus Notes or Outlook messaging
ContactReset Resets the Contact structure
ContactNext Reads the contact found after the current contact in the address book of a Lotus Notes or Out-
look messaging
ContactDelete Deletes the current contact from the address book 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).

3.3.6 Group functions


The following functions are used to manage the groups of contacts found in the address book of Lotus Notes, Domino or
Outlook:

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

3.3.7 Notes functions


The following functions are used to manage the Notes documents found in Lotus Notes:

NotesActivateView Indicates the view to handle in Lotus Notes


NotesAddAttachment Attaches a file to an item of the current document in Lotus Notes
NotesItem Returns the value of the items for the current document in Lotus Notes
NotesDeactivateView Disables the view currently handled in Lotus Notes
NotesItemDimension Returns the dimension of an item for the current document in Lotus Notes
NotesDocumentSeek Seeks a document in Lotus Notes
NotesDocumentLast Positions on the last document found in Lotus Notes
NotesDocumentPrevious Positions on the document found before the current document in Lotus Notes
NotesDocumentFirst Positions on the first document found in Lotus Notes
NotesDocumentNext Positions on the document found after the current document in Lotus Notes
NotesDocumentDelete Deletes the current document from the Lotus Notes database
NotesOut Enables you to find out whether there is a current document in Lotus Notes
NotesSave Saves the current document in Lotus Notes
NotesExtractAttachment Extracts a file attached to an item of the current document in Lotus Notes
NotesCloseDatabase Closes the local or remote database used (Lotus Notes or Domino)
NotesListItem Returns the list of items for the current document in Lotus Notes
NotesListAttachment Returns the list of files attached to an item of the current document in Lotus Notes
NotesListView Returns the list of views found in the current Lotus Notes database
NotesModifyItem Modifies the specified item of the current document in Lotus Notes
NotesModifyAttachment Modifies a file attached to an item of the current document in Lotus Notes
NotesNbAttachment Returns the number of files attached to an item of the current document in Lotus Notes
NotesOpenDatabase Enables you to access the documents managed by Lotus Notes
NotesOpenConnection Opens a connection with a local or remote Lotus Notes or Domino database

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

teristics of the connection to your Google account.


Example:
To create a Google contact: // Retrieves all the contacts
A Google contact can be created via the Google interface ArrContacts is array of …
or by programming with the WLanguage functions. 0 GglContact
To create a Google contact with the WLanguage func- ArrContacts = GglListContact(Cnt)
tions: // Browse the contacts
1. Create a gglContact variable. Contact is gglContact
2. Define the characteristics of the contact with the FOR EACH Contact OF ArrContacts
gglContact properties. IF Contact.Name = "MOORE" THEN
3. Validate the creation of the contact with the Contact.PostalAddress [1]..Address
GglWrite function. = "34080 Montpellier"
// Actual update of
Note: // the server changes
If a proxy is used to access Internet, the proxy must be GglWrite(Cnt, Contact)
configured (Proxy) to use the Google functions. END
END
4.1.3 How do I retrieve a Google contact? To delete a contact:
To retrieve a Google contact: 1. Retrieve the list of contacts.
1. Declare an array of gglContact variables 2. Search for the contact to delete.
2. Use the GglListContact function. This function is 3. Delete the contact with GglDelete
Tome1_2.book Page 419 Vendredi, 28. mai 2010 5:50 17

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

4.1.5 Functions for managing the Google contacts


The following functions are used to manage the contacts
via the "Google Contacts" service
GglWrite Creates or updates a contact or a group of contacts.
GglListContact Retrieves the list of contacts associated with the specified Google account.
GglListContactByRequest Retrieves a list of contacts from custom parameters.
GglListContactGroup Retrieves the list of groups of contacts associated with the specified Google
account.
GglRequest Sends a communication request (HTTP request) to a Google service.
GglDelete Deletes a contact or a group of contacts.

See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).

4.2 Managing Google calendars

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

To create a Google calendar with the WLanguage func- Example:


tions: // Retrieve the calendar
1. Create a ggCalendar variable. // named "Work"
2. Define the characteristics of the calendar with the Calendar is gglCalendar …
gglCalendar properties. = GglGetCalendar(Cnt, "Work")
3. Define (if necessary) the events linked to the // Read the calendar events
calendar (gglEvent variable). IF NOT ErrorOccurred THEN
4. Validate the creation of the calendar with Evt is gglEvent
GglWrite FOR EACH Evt of gglCalendar
Note: if you use a proxy to access the Internet, you need Trace(Evt.Title)
to configure the proxy (proxy function) in order to use the END
Google functions. END

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

To delete an event from a calendar:


// Retrieves the events 1. Retrieve the requested calendar and its events.
// of the first calendar 2. Search for the event to delete.
GglFillCalendar(Cnt, arrCalendars[1]) 3. Delete the event.
// Create an event 4. Validate the modifications with GglWrite.
MyEvent is gglEvent Note: you can perform several deletions before using
MyEvent.StartDate = … GglWrite.
"20081201085000"
MyEvent.EndDate = …
Example:
"20081201093000" // Retrieve the calendar
MyEvent.Title = "Appointment" // named "Work"
MyEvent.Content = … Calendar is gglCalendar = …
"Appointment to discuss … GglGetCalendar(Cnt, "Work")
the November status report" // Delete the second
// Add the event to the calendar // event from the calendar
Add(ArrCalendars[1].Event,… Delete(Calendar.Event, 2)
MyEvent) // Actual update of
// Update the calendar // the server changes
// on the server GglWrite(Cnt, Calendar)
GglWrite(Cnt, ArrCalendars[1])

4.2.5 Functions for managing the Google calendars


The following functions are used to manage the calen-
dars via the Google Calendar service:

GglWrite Creates or updates a calendar/


GglListCalendar Retrieves the list of Google calendars associated with the specified Google account.
GglGetCalendar Retrieves a Google calendar and its events according to its title or identifier.
GglFillCalendar Fills a calendar that was previously retrieved: the events corresponding to the calen-
dar are retrieved (possibly using some criteria).
GglFillCalendarByRequest Fills a calendar that was previously retrieved: the events corresponding to the calen-

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

4.3.2 How do I proceed? // Add the photo 1 to the album


1. Create a gglAlbum variable. This variable contains Add(MyAlbum.PhotoData, …
the characteristics of the album. APhoto)
2. For each photo that must be included in the // Photo 2
album, use a gglPhoto variable to describe the cha- APhoto = new gglPhoto ..
racteristics of the photo. You also have the ability to // Used to re-initialize
describe the tags and the comments associated APhoto.Image = CompleteDir …
with the photo. (fExeDir()) + CST_ImageDir …
3. Add the photo to the album (each photo is an ele- + "puzzle.png"
ment of the PhotoData array found in the gglAlbum Add(MyAlbum.PhotoData,APhoto)
variable). // Photo 3
4. Use GglWrite to create the photo album on the APhoto = new gglPhoto
Google server APhoto.CommentingEnabled = False
APhoto.FileName = …
Example: "Tropical fish"
MyAlbum is gglAlbum APhoto.Image = CompleteDir …
ATag is gglTag (fExeDir()) + CST_ImageDir …
APhoto is gglPhoto + "tropical.jpg"
AComment is gglComment Add(MyAlbum.PhotoData, …
// Create the album APhoto)
MyAlbum.Title = "Summer holidays" // Photo 4
MyAlbum.Description = … APhoto = new gglPhoto
"Summer vacation in … APhoto.FileName = "Drawing"
Germany with the family" dStartDrawing(IMG_Map)
MyAlbum.Timestamp = … dCircle(20,20,50,50,PastelGreen,…
"UTC Date and Time" LightRed)
MyAlbum.CommentingEnabled = True APhoto.Image = …
// Photo 1 dSaveImageJPEG(IMG_Map, …
APhoto.CommentingEnabled … inMemory)
= True IMG_Map = ""
APhoto.FileName = "Test" Add(MyAlbum.PhotoData, …
APhoto.Image = CompleteDir … APhoto)
(fExeDir()) + CST_ImageDir + … // Create the album
Part 7: Communication

"US.jpg" IF NOT GglWrite(sConnection,…


APhoto.Legend = … MyAlbum) THEN
"Tower near the river." Error("Error creating …
// Add tags the album: " + ErrorInfo)
ATag.Text = "tour" END
Add(APhoto.Tag, ATag)
ATag.Text = "United States of America"
Add(APhoto.Tag, ATag) To retrieve and modify a Picasa album:
ATag.Text = "By night" 1. Retrieve the Picasa album you want. You can use:
Add(APhoto.Tag, ATag) •GglListAlbum to retrieve the list of available
// Add comments albums.
AComment.Text = … •GglGetAlbum to retrieve a specific album. Different
"Nice photo !" options allow you to specify the elements that will
Add(APhoto.Comment, … be retrieved (thumbnails, tags, covers, ?). The ima-
AComment) ges of the photos will not be retrieved.
AComment.Text = … •GglFillAlbum to retrieve the characteristics of an
"Touched up album (an album listed by GglListAlbum for exam-
photo!!!"Add(APhoto.Comment, … ple). Different options allow you to specify the ele-
AComment) ments that will be retrieved (thumbnails, tags,
AComment.Text = … covers). The images of the photos will not be retrie-
"How did you do it ?" ved.
Add(APhoto.Comment, …
AComment)
Tome1_2.book Page 423 Vendredi, 28. mai 2010 5:50 17

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.

4.3.3 Functions for managing the Picasa albums


The following functions are used to manage the Google
Picasa photo albums:
GglWrite Creates or updates a Google Picasa album or photo.
GGLLISTALBUM Retrieves the list of "Google Picasa" albums available for the user.
GglListComment Retrieves:
•the list of comments saved for the Google client account.
•the list of comments associated with a photo found in a Google Picasa album.
GglListPhoto Lists the photos found in the Google Picasa albums corresponding to specific crite-
ria.
GglListTag Retrieves:
•the list of tags associated with a Google client account.
•the list of tags associated with a Google Picasa album
•the list of tags associated with a photo found in a Google Picasa album
GglGetAlbum Retrieves a Google Picasa album.

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).

4.4 Managing the Google documents


4.4.1 Overview documents.
Google Docs and Google Spreadsheet are the online Warning: before using a feature linked to a Google ser-
word processing and the online spreadsheet proposed by vice, we recommend that you check the user license for
Google. the service. Some restrictions may apply. The content of
WinDev and WebDev allow you to manage these docu- the licenses may change over time.
ments via several WLanguage functions. You can: PC SOFT is in no case responsible for the way the native
•Upload documents on the Google server. access functions are used. Please make sure that you
comply with the license of the service provider.
•Delete documents.
•List the documents and perform a search in the
Tome1_2.book Page 424 Vendredi, 28. mai 2010 5:50 17

424

4.4.2 How do I manage the Google docu-


ments? GglUploadDo- Sends a document to the Google server.
To manage the Google documents found on a Google ser- cument
ver: GglListDocu- Retrieves the list of documents availa-
1. If needed create a Google account. This account ble on the Google server for the current
ment
can be created via the following address: http:// user
code.google.com/intl/en/apis/maps/signup.html. GglDelete Deletes a Google document from the
Caution: this page’s address may have changed server
since this page has been written.
The Google account is identified by an email address If a proxy is used to access Internet, the proxy must be
and the associated password. configured (Proxy) to use the Google functions.
2. In the code of your application, create a gglCon- See the online help to check the availability of these
nection variable. This variable contains the charac- functions in the different products (WinDev, WebDev,
teristics of the connection to your Google account. WinDev Mobile).
3. To manage the documents found on the Google
server, use one of the following functions:

4.5 Using the Google Maps service


4.5.1 Overview 4.5.2 How do I proceed?
The Google Maps service is an Internet cartography Retrieving a map in your applications or
software proposed by Google. It is used to display a map in your sites
by proposing several viewing features. To include a map that uses the Google Maps service in
Note: the mapping service offered is Google Static Maps. your applications or in your sites:
Examples of processes that can be performed in WLan- 1. Generate a Google key. This key is supplied by
guage: Google. This key can be generated via the following
• Retrieving a map, displaying it in a window control or in address: http://code.google.com/intl/en/apis/
a report control and sending it by email. maps/signup.html.
Caution: this page’s address may have changed
• Defining the map area and the size of the image to since this page has been written.
retrieve by specifying the latitude, the longitude, the 2. Create an Image control in your WinDev or Web-
Part 7: Communication

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

4.5.4 Functions for managing the Google maps


The following functions are used to manage the maps via
the "Google Maps" service:
GglAddressToCoordinates Retrieves the coordinates (latitude/longitude) of an address.
GglGetStaticMap Retrieves the map of a specific location via the Google Maps service.
GglRequest Sends a communication request (HTTP request) to a Google service.

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

•GglAdWListClientAccountInfo is used to retrieve the


5.1.2 How do I manage a Google AdWords information regarding each account found in the
account? multi-account center. This information (email
To manage a Google AdWords account: address and management mode) is retrieved in an
1. Create (if necessary) a Google AdWords account array of gglAdWClientAccountInfo variables. This
(via the Google interface). The account is identified information can be used to retrieve the characteris-
by an email address and the associated password. tics of the account with GglAdWGetAccountInfo.
2. In the code of your application, create a gglAdW- •GglWrite is used to take into account the modifica-
Connection variable. tions of the account characteristics on the server.
3. Use the functions for managing the AdWords
accounts.

5.2 .Ad group management


5.2.1 Overview tion of the display for the ad.
Google AdWords proposes the "AdGroup" service. This The operations concerning an ad group are managed by
service is used to manage the Google ad groups. the "AdGroup Service".
The operations concerning an ad are managed by the
An ad group contains: "Ad Service".
•one or more ads. This help page explains how to use the "AdGroup Ser-
vice" with the WLanguage functions.
•one or more location criteria used to define the loca-
Tome1_2.book Page 427 Vendredi, 28. mai 2010 5:50 17

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

•Mobile ad: 5.3.2 How do I proceed?


The mobile ads are textual AdWords ads appearing Caution: an ad must be associated with an ad group; it
on the mobile Web sites or when a Web user per- cannot exist by itself. Before creating an ad, you must
forms a search on Google from a cell phone. create an ad group.
•Mobile image ad: 1. Create a variable corresponding to the type of ad
The mobile illustrated ads are graphic AdWords ads . to create:
They are displayed on the mobile Web sites. •Image ad: gglAdWImageAd variable.
•Text ad: •Local business ad: gglAdWLocalBusinessAd varia-
The text ads are ads containing text only. ble.
•Video ad: •Mobile ad: gglAdWMobileAd variable.
A video ad played on a page is displayed as a static
opening image. The video is played when the user •Mobile image ad: gglAdWMobileImageAd varia-
clicks this image or the play button. If the user clicks ble.
the URL displayed at the bottom of the ad or the ad •Text ad: gglAdWTextAd variable.
itself while the video is played, it is automatically •Video ad: gglAdWVideoAd variable.
redirected to the specified Web site. 2. For each type of variable, specify:
This help page presents how to use the "AdGroup Ser- •the DestinationURLproperties that defines the URL
vice" with the WLanguage function available. used in the ad: the users will be able to click this
Reminder: to use the Google AdWords service by pro- link in your ad.
gramming, you need to use the Google AdWords APIs. •the DisplayedURL property that will correspond to
These APIs have a cost associated to them. GglAdWGet- the caption of the destination URL.
MethodCost lets you estimate the cost of each function.
•the GroupIdentifier property, that corresponds to
Warning: before using a feature linked to a Google ser- the ad group to which the ad belongs.
vice, we recommend that you check the user license for
the service. Some restrictions may apply. The content of 3. Use GglWrite.
the licenses may change over time.
Note:
PC SOFT is in no case responsible for the way the native
• If you need to create several types of ads at the same
access functions are used. Please make sure that you
time, we recommend you use an array of variants con-
comply with the license of the service provider.
taining the different ad types to create.
Caution: if you use a proxy to access the Internet, you
• We recommend you use GglAdWCheckAd to make sure
need to configure the proxy (proxy function) in order to
the ads conform with the service’s use conditions
Part 7: Communication

use the Google functions.


Updating an ad
To update an ad: Example:
1. Retrieve the requested ad (with the following AMobileAd is …
functions): gglAdWMobileAd
GglAdWListAd Retrieves the list of ads found in an ad AdType is string = …
group. arrMyAds[1]..Class
GglAdWListActi- Retrieves the list of active ads found in If AdType ~= …
an ad group. "gglAdWMobileAd" THEN
veAd AMobileAd = arrMyAds[1]
GglAdWGetAd Retrieves the characteristics of a Goo- Trace(AMobileAd.Description)
gle AdWords ad. END
Note: when retrieving ads from an ad group, the result is 2. Modify the variable corresponding to the ad to
in the format of an array of variants. Indeed, the group of modify.
ads can be associated with several types of ads. To find 3. Use GglWrite to update the modified ads
out the type of an ad, use the Class property.
Tome1_2.book Page 429 Vendredi, 28. mai 2010 5:50 17

429

5.4 Management of campaigns


5.4.1 Overview 5.4.2 How do I proceed?
Google AdWords proposes the "CampaignService" ser- Creating a campaign
vice. This service is used to manage the Google AdWords 1. Create a gglAdWCampaign variable.
advertising campaigns. Each campaign can contain one 2. Use GglWrite to create the campaign.
or more ad groups. Note: after creating a campaign, you can create ad
This help page explains how to use the "CampaignSer- groups and associate them with the campaign. See
vice" with the WLanguage functions. ’Managing ad groups’ for more details.
Note: to handle the Google AdWords service by program-
ming, you need to use the Google AdWords APIs. These Updating a campaign
APIs have a cost associated to them. GglAdWGetMetho- To update a campaign:
dCost lets you estimate the cost of each function. 1. Retrieve the campaign you want (using the fol-
Warning: before using a feature linked to a Google ser- lowing functions for instance):
vice, we recommend that you check the user license for
GglAdWListCampaign Lists the Google AdWords
the service. Some restrictions may apply. The content of advertising campaigns for
the licenses may change over time. the connected account
GglAdWGetCampaign Retrieves a Google AdWords
PC SOFT is in no case responsible for the way the native campaign from its identifier.
access functions are used. Please make sure that you 2. Modify the gglAdWCampaign variable correspon-
comply with the license of the service provider. ding to the campaign to modify.
Caution: if you use a proxy to access the Internet, you 3. Use GglWrite to update the modified campaigns
need to configure the proxy (proxy function) in order to
use the Google functions.

5.5 Management of criteria


5.5.1 Overview These APIs have a cost associated to them. The GglAd-
Google AdWords proposes the "CriterionService" ser- WGetMethodCost function lets you estimate the cost of

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

does not trigger any problem.


Note: before creating a new criterion, we recommend you
use GglAdWCheckCriterion to make sure the criterion

5.6 Managing the function cost


5.6.1 Overview Several WLanguage functions can be used to manage
Google AdWords proposes the "InfoService" service. this service.
This service is used to retrieve information about the use Note: to handle the Google AdWords service by program-
of the Google AdWords API functions and their cost. ming, you need to use the Google AdWords APIs. These
APIs have a cost associated to them.

5.6.2 WLanguage functions


The WLanguage functions used to manage the "InfoSer-
vice" service are as follows:
GglAdWGetMethodCost Retrieves the execution cost of an API method 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.

5.7 Management of keyword suggestions


Part 7: Communication

5.7.1 Overview 5.7.2 How do I proceed?


Google AdWords offers the "KeywordToolService" ser- Getting suggestions from a keyword
vice. This service is used to generate new keywords 1. Create a gglAdWSeedKeyword variable. This
based on the keywords you submit or on the words found variable contains all the characteristics of the
in a Web page. keyword used as base keyword for the suggestions.
Note: to handle the Google AdWords service by program- 2. Use the GglAdWGetKeywordVariation function.
ming, you need to use the Google AdWords APIs. These The result of this function is a gglAdWKeywordVaria-
APIs have a cost associated to them. The GglAdWGet- tionsCollection variable containing the variations of
MethodCost function lets you estimate the cost of each the specified keywords with all their characteristics
function. (traffic, search volume, etc.).
Warning: before using a feature linked to a Google ser- Getting suggestions from a Web site
vice, we recommend that you check the user license for 1. Create a gglAdWSiteKeyword variable. This varia-
the service. Some restrictions may apply. The content of ble contains all the characteristics of the site used as
the licenses may change over time. base site for the suggestions.
PC SOFT is in no case responsible for the way the native 2. Use GglGetKeywordsFromSite and specify
access functions are used. Please make sure that you whether the links found in the page must be taken
into account. The result of this function is a gglAdW-
comply with the license of the service provider. SiteKeywordGroup variable containing the keywords.
Caution: if you use a proxy to access the Internet, you
need to configure the proxy (proxy function) in order to
use the Google functions.
Tome1_2.book Page 431 Vendredi, 28. mai 2010 5:50 17

431

5.8 Report management


5.8.1 Overview requested report.
Google AdWords offers the "Reports" service. This ser- 2. Validate the description of your report with GglAd-
vice is used to manage the reports regarding the statis- WValidateReportJob. This validation is used to find
tics for the different Google AdWords elements out whether the different characteristics of your
(campaign, ad, ad group, …). report are correct.
This help page explains how to use this service with the Note: we recommend you check a report before running
WLanguage functions. it, the cost of the verification is much less that the cost of
a report’s execution failure.
Note: to handle the Google AdWords service by program- 3. Start the report’s execution using the GglAdWS-
ming, you need to use the Google AdWords APIs. These cheduleReportJob function. This function returns the
APIs have a cost associated to them. GglAdWGetMetho- identifier of the report.
dCost lets you estimate the cost of each function. 4. Check (if necessary) the status of the report’s
Warning: before using a feature linked to a Google ser- printing with GglAdWGetReportJobStatus.
vice, we recommend that you check the user license for 5. The report can be downloaded once the printing is
the service. Some restrictions may apply. The content of over. The following functions are used to find out the
the licenses may change over time. URL address for download:
PC SOFT is in no case responsible for the way the native •GglAdWGetURLReport: is used to get the down-
access functions are used. Please make sure that you load address of the report.
comply with the license of the service provider. •GglAdWGetURLReportGZip: is used to get the
Caution: if you use a proxy to access the Internet, you download address of the report in the GZip com-
need to configure the proxy (proxy function) in order to pressed format.
use the Google functions. Note: 15 generated reports are stored by Google
AdWords. When the 16th report is generated the oldest
5.8.2 How do I proceed? report is automatically deleted. A report can be deleted
To use the "Reports" service of Google AdWords: by GglAdWDeleteReport
1. Create a gglAdWDefinedReportJob variable. This
variable contains all the characteristics of the

5.9 Management of site suggestions

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

5.10 Management of traffic estimates


5.10.1 Overview 5.10.2 How do I proceed?
Google AdWords proposes the "Traffic Estimator" ser- To use the "Traffic Estimator" service:
vice. This service is used to get the estimated traffic 1. Create a gglAdWKeywordRequest variable. This
based on keywords: number of click per day, cost per variable contains all the characteristics of the
click, ... keyword for which the traffic estimate must be per-
This service can be used to estimate: formed.
•an isolated keyword, 2. Create (if necessary) a gglAdWAdGroupRequest
variable and a gglAdWCampaignRequest variable to
•the keywords of an ad group, perform an estimation of the keywords linked to an
•the keywords of a campaign. ad group or to a campaign.
You can for instance estimate a keyword by taking into Note: the estimation of an existing or new element is
account (or not) the criteria for geographical targeting of determined by the presence of the ..Identifier pro-
Part 7: Communication

the campaign. perty in the various variables. For example, to esti-


This help page explains how to use this service with the mate the keywords of a new campaign, all you have
WLanguage functions. to do is create a gglAdWCampaignRequest variable
with ..Identifier not filled. To estimate the keywords
Note: in the Google AdWords interface, this service cor-
of an existing campaign, all you have to do is create a
responds to the traffic prediction tool.
gglAdWCampaign variable and specify the identifier
Note: to handle the Google AdWords service by program- of an existing campaign in ..Identifier.
ming, you need to use the Google AdWords APIs. These 3. Execute the function corresponding to your
APIs have a cost associated to them. The GglAdWGet- search :
MethodCost function lets you estimate the cost of each GglAdWEstima- Returns the estimated traffic genera-
function. ted by the keywords found in a set of
teCampaign
Warning: before using a feature linked to a Google ser- Google AdWords advertising campai-
vice, we recommend that you check the user license for gns.
the service. Some restrictions may apply. The content of GglAdWEstimateAd- Returns the estimated traffic genera-
the licenses may change over time. Group ted by the keywords for a set of
groups of Google AdWords ads
PC SOFT is in no case responsible for the way the native
access functions are used. Please make sure that you GglEstimate- Returns the estimated traffic genera-
Keyword ted by a set of Google AdWords
comply with the license of the service provider. keywords
Caution: if you use a proxy to access the Internet, you 4. Depending on the type of estimation performed,
need to configure the proxy (proxy function) in order to the estimation’s result may correspond t:
use the Google functions. •a gglAdWCampaignEstimate variable
•a gglAdWAdGroupEstimate variable
•a gglAdWKeywordEstimate variable
Tome1_2.book Page 433 Vendredi, 28. mai 2010 5:50 17

433

5.11 Google AdWords functions


The following functions are used to manage the Google
AdWords services:
GglAdWSetCampaignExcluded- Deletes all the excluded criteria defined for a Google AdWords campaign and writes
the new excluded criteria for this campaign.
Criterion
GglAdWGetOptimizedAdServing Enables you to find out whether the specified Google AdWords campaign uses the
optimized ad serving mode
GglAdWEstimateCampaign Returns the estimated traffic generated by a set of Google AdWords advertising
campaigns
GglAdWEstimateAdGroup Returns the estimated traffic generated by a set of Google AdWords ad groups
GglAdWEstimateKeyword Returns the estimated traffic generated by a set of Google AdWords keywords
GglAdWListMCCAlert Retrieves the list of alerts from the multi-account center (also called My Client Cen-
ter) for all the accounts that are linked to the current AdWords account.
GglAdWListAd Retrieves the list of ads for a set of ad groups.
GglAdWListActiveAd Retrieves the list of active ads for several ad groups
GglAdWListCampaign Lists the Google AdWords advertising campaigns for the connected account
GglAdWListClientAccount Retrieves the list of primary email addresses for each account managed by the
multi-account center
GglListCriteria Lists the criteria associated with a Google AdWords ad group. These criteria can be
"Keyword" criteria or "Web Site" criteria.
GglListExcludedCriteria Lists the criteria that have been excluded from a Google AdWords advertising cam-
paign
GglAdWGetConversionOptimize- Enables you to find out whether some Google AdWords campaigns are eligible for
using the conversion optimizer.
rEligibility
GglAdWListBusiness Retrieves the list of companies corresponding to the requested criteria and found in
the "Local Business Center" database of Google.
GglAdWGetActiveGroup Lists the active ad groups for a Google AdWords campaign. The information regar-
ding these ad groups is also retrieved.

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.

6.2 Salesforce functions

Part 7: Communication
The following functions are used to manage the Salesforce databases:

SFAdd Creates a record in a file of a Salesforce database.


SFForwardQuery Continues to run a SOQL query (Salesforce Object Query Language) on the records
of a Salesforce database
SFConnect Enables you to authenticate toward a Salesforce platform.
SFConvertLead Converts the leads (also called LEAD). These leads can be converted into account,
contact or opportunity.
SFDisconnect Disconnects the Salesforce platform, the current Salesforce session or the specified
Salesforce sessions.
SFExecuteQuery Runs a SOQL (Salesforce Object Query Language) query on a Salesforce database.
SFExecuteProcess Requests the execution of a specific process. You can submit records to the approval
process or perform an approval action.
SFMerge Merges the Salesforce records (also called Salesforce objects).
SFRead Retrieves the Salesforce records from their identifiers.
SFModify Modifies the records of a file defined in Salesforce.
SFSearch Performs a search among the records found in a Salesforce database. The search is
performed via SOSL (Salesforce Object Search Language).
SFSeekModified Seeks and retrieves the records (Salesforce objects) modified during the specified
period.
Tome1_2.book Page 436 Vendredi, 28. mai 2010 5:50 17

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

7.2 How do I procee?


To read a RSS stream: 4. The content of the RSS stream can be displayed in
1. Declare a rssStream variable. This variable will a table linked by data binding to the rssChannel
contain the information regarding the RSS stream to variable containing the entries of the stream (in our
handle. example, MyChannel.Entry).
2. Load the RSS stream with rssInitialize. TheRSS
Stream variable is initialized with the specified Note: we recommend you use:
stream •FOR EACH loops to read the entries of a channel
associated with a stream.
MyRSSStream is rssStream •manual loops using the Occurrence property (can be
MyRSSStream = rssInitialize … used on the rssChannel type to find out the number
("http://blogs.webdev.info … of channels and on the rssEntry type to find out the
/rss.awp?blog=technical … number of entries).
support", fromURL)
3. Check that the stream’s channel is valid and load Databinding and RSS stream
it. For example: The Databinding is available for the rssXXX variables, so
IF MyRSSStream.Channel..Occurrence … that the RSS information can be displayed without pro-
gramming.

Part 7: Communication
>= 1 THEN
MyChannel is rssChannel
MyChannel = MyRSSStream.Channel[1]

7.3 Functions for managing the RSS streams


The following functions are used to manage the RSS
streams:
rssDisplay Builds a RSS stream and displays the result on the browser of the Web user.
rssBuildString Builds the RSS stream and returns the result (in XML format) in a character string.
rssInitialize Loads a RSS stream in memory.
rssSave Builds the RSS stream and saves the RSS stream in an XML file.
Tome1_2.book Page 438 Vendredi, 28. mai 2010 5:50 17

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

ted only if it has no child element.


LDAPDeleteAttribute Deletes an attribute and all its values.
LDAPDeleteAttributeValue Deletes a value for a specified attribute.
LDAPValue Returns the value corresponding to the subscript passed in parameter for the speci-
fied attribute.
LDAPValidateAdd Validates the addition of a new object into an LDAP server.
LDAPValidateModify Validates the modification of an existing object in an LDAP server.

See the online help for more details about these functions.
Tome1_2.book Page 439 Vendredi, 28. mai 2010 5:50 17

439

9. WINDEV AND TELEPHONY WD WDMobile

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

tapiNewCall New call detected waiting for an Caution:


answer or for a rejection. This WLanguage procedure being run in a thread, all the
constraints of the threads must be complied with (no
tapiCallInformation The additional information (pre- window opening, no timer management, no event mana-
sentation of the number) is gement, and so on). See the online help for more details.
available. In most cases, this
We recommend that you limit the number of processes
information will be available after
performed in this procedure. Indeed, during the duration
the fist ring.
of the call, the detection of the other calls (as well as all
• manage the call via the following functions: the telephony events) is frozen. If long processes must be
- find out the characteristics of the incoming call: performed, we advise you to process the call in the main
thread of the application (see the example below).
tapiCallStart Returns the date and time of the
beginning of the call 4. To end the session for detecting the incoming calls,
use tapiStopCallDetection.
tapiCallIsOver Enables you to find out whether
the call is over 9.2.2 Example
tapiCallEnd Returns the date and time of the This example manages the incoming calls in the main
end of the call thread.
• Code for declaring the global variables of the window
tapiCallDuring Returns the duration of the call
used for call detection. The different events used to
tapiCallerID Returns the calling phone number manage the calls in the main thread of the application
are declared in this code.
- perform specific operations: GLOBAL
gnEventID is int
tapiStop Forces the reading of a prerecor- //Event to manage
ded message to stop (tapiPlay //incoming calls in a popup
IF Event("DetectedCall","*.*",…
tapiRecord Saves the current communica- "PhoneCall")=0 THEN
tion in a .WAV file. Error("Unable to manage"+…
tapiPlay Plays a sound file (.WAV) for the "the call detection popup",…
specified line. You can play the ErrorInfo())
message found on the answering END
Part 7: Communication

machine for instance. IF Event("EndDetectedCall",…


"*.*","EndPhoneCall")=0 THEN
tapiSendKey Enables you to simulate the use Error("Unable to manage"+…
of the phone keys. "the call detection popup",…
tapiAnswerCall Answers an incoming call (pre- ErrorInfo())
viously detected) END
IF Event(…
tapiKeyPressed Enables you to find out the history "CallIdentifierDetected",…
of the keys pressed on the phone "*.*","PhoneCallInfo")=0 THEN
keypad. Error("Unable to manage"+…
"call detection popup",…
ErrorInfo())
END
Tome1_2.book Page 441 Vendredi, 28. mai 2010 5:50 17

441

• Window initialization code: this code starts the call Message).


detection procedure. To debug this type of process, you need to use Trace.
// Call detection service PROCEDURE CallDetection(…
If tapiListen(… nServiceID,nCallID,nStatus)
"IncomingCall", tapiOptionMediaMode- // Detect the incoming calls
Fax,… SWITCH nStatus
"CallDetection") THEN // Detect a new call :
// The call monitoring service // Note: we will have additional
// has started // information after at least
Message("Call detection"+… // one ring
" enabled") CASE tapiNewCall :
ELSE // Signal an incoming call
// The call monitoring service // to the main window in order to
// has not started // open a popup
Error("Unable to start"+… PostMessage(Handle(Window_Call),…
"the call detection"+CR+… "PhoneCall",nCallID,nStatus)
"Error details:"+CR+… // Call information
ErrorInfo(errMessage)) CASE tapiCallInformation :
END // Signal an incoming call
• Call detection procedure: this procedure is used to // to the main window in order to
detect the incoming calls. For each incoming call, the // open a popup
characteristics of the call are sent to the main thread PostMessage(Handle(Window_Call),…
by PostMessage. "PhoneCallInfo",nCallID,nStatus)
Caution: the processes used in this procedures are call // The line has been hung up
from a thread. The display management should be CASE tapiLineDisconnected:
done via the main thread (which is why we use Post- // Signal an incoming call
// to the main window in order to
// open a popup
PostMessage(Handle(Window_Call),…
"EndPhoneCall",nCallID,nStatus)
END

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

9.4 Telephony functions


These functions enable you to easily handle all the telephony features of a modem from a WinDev application:
tapiCallStart Returns the date and time of the beginning of the call
tapiCallIsWaiting Enables you to find out whether the call is on hold
tapiCallIsBusy Enables you to find out whether the number called is busy
Part 7: Communication

tapiCallIsOver Enables you to find out whether the call is over


tapiCallEnd Returns the date and time of the end of the call
tapiNoAnswer Enables you to find out whether an answer was given to the call
tapiStop Forces the reading of a prerecorded message to stop (tapiPlay
tapiCapability Enables you to find out the capacity of the TAPI device used
tapiDial Dials a phone number for a voice line.
tapiLineDial Dials a phone number for a voice line and chooses the device to use
tapiListen Starts a service for call detection
tapiCallDuring Returns the duration of the call
tapiRecord Saves the current communication in a .WAV file.
tapiError Indicates if the last tapixxx function has returned an error to the TAPI module
tapiCompleteTransfer Transfers a call with ability to retrieve the call
tapiStopCallDetection Stops the specified call detection.
tapiPlay Plays a sound file (.WAV) for the specified line. You can play the message found on
the answering machine for instance.
tapiDeviceList Returns the list of TAPI devices installed on the computer
tapiHold Puts a call on hold
tapiCallerID Returns the calling phone number
tapiCalledID Returns the phone number called
tapiSendKey Enables you to simulate the use of the phone keys.
tapiOrigin Enables you to find out the origin of a call
Tome1_2.book Page 443 Vendredi, 28. mai 2010 5:50 17

443

tapiDevice Selects the TAPI device that will be used by default


tapiHangUp Hangs up a phone line opened by tapiDial
tapiAnswerCall Answers an incoming call (previously detected)
tapiUnhold Picks up a call on hold
tapiKeyPressed Enables you to find out the key currently down.
tapiBlindTransfer Performs a "blind" transfer
See the online help for more details about these functions.

Part 7: Communication
Tome1_2.book Page 444 Vendredi, 28. mai 2010 5:50 17

444

10. MANAGING SMSS WDMobile

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.)

10.2 The SMS structure


10.2.1 Overview
CountryPre- Character string containing the inter-
The SMS structure is a preset structure of WLanguage (no fix national prefix (33 by default for
declaration is required). This structure is used to create France).
SMS. If the recipient number starts with
Note: to reset all the variables of the SMS structure, use "0" and if a national prefix is speci-
SMSReset. fied, "0" will be replaced by this pre-
fix.
10.2.2 The variables of the SMS structure
If no national prefix is specified, use
The structure contains the following members: a number in international format. For
Receive- Date and time when the SMS was example, 33612345678.
Date received
Part 7: Communication

Number- Specifies the type of number used:


Note: On Pocket PC 2002, this mem-
Type •smsInternationalNumber
ber contains the date and time when
the SMS was read. (default value): these numbers
can be accessed anywhere and
Attempt Boolean (True by default) are in 06.xx.xx.xx.xx. format.
Indicates whether the message must •smsNationalNumber: short num-
be regularly sent if wrong reception. bers, accessible within the
country only.
Subscript Integer corresponding to the subs-
cript of the incoming SMS.
10.2.3 Reading and deleting SMSs on Smart-
Message Character string containing the phone
outgoing message or the incoming
message (up to 160 characters). To read and/or delete SMS on a Smartphone (SMSNb-
Message, SMSFirst, SMSNext or SMSDelete), the execu-
Number Character string containing the reci- table of the WinDev Mobile application and its framework
(WinDev Mobile libraries) must be digitally signed. A cer-
pient number or the sender number.
tificate is required to perform this operation.
Note: The use of the SMSSend and SMSReset functions
does not require any special signature.
Tome1_2.book Page 445 Vendredi, 28. mai 2010 5:50 17

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.

10.3 WLanguage functions


These functions enable you to easily send SMSs :

SMSSend Sends an SMS


SMSNbMessage Returns the number of SMS received or the maximum number of SMS that can be received
SMSFirst Points to the first SMS received
SMSReset Resets all the variables of the SMS structure
SMSNext Points to the next received SMS
SMSDelete Deletes the specified SMS

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. SENDING FAXES WD WebDev

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.

11.2 Configuring the "fax server"


11.2.1 Configuring the current computer displayed, install the fax server of Windows 2000
The following elements are required to send faxes: (see above).
3. Select the "Advanced options" tab and click the
• Windows XP or 2000, "Open the fax service management console" but-
• a configured modem on the computer, ton.
• the standard Windows fax server must be started. 4. "Device" is used to list the modems and the
faxes installed on the computer.
WB Caution: the following operations only 5. Double-click your modem/fax.
apply to the server computer used to 6. In the "General" tab, activate the fax sending
send faxes (and not to the browser option so you can send faxes from your application
computers). or site.
7. Validate.
Part 7: Communication

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

11.3 Fax sending application or site


11.3.1 Sending a fax from an application or a FaxDisconnect.
site
To send a fax from an application or a site, you need to:
11.3.2 Sending a fax created with the report
1. Prepare the fax, that is the file that will be sent. A editor
specific first page can also be attached to the fax To send a fax created with the report editor:
(called "Cover Page"). This cover page is a ".cov" You can:
file and it can be created from the fax server. • use only the iPreview/iDestination function (syntax 3).
2. Use FaxConnect. This function lets you connect The report printed by iPrintReport will be sent directly
the application or site to the fax server installed on to the specified fax number. In this case, you cannot
the current computer. follow the progress of the fax.
3. Send the fax: // Send the "CustInvoice" report by
•with FaxSend. When sending the fax, you have the fax
ability to specify the name of a WLanguage proce- iDestination(iFax,"0006050402")
dure. This procedure will be called whenever the sta- iPrintReport(CustInvoice)
tus of the fax is modified by the fax server. The status • use the fax functions and iPreview/iDestination (syn-
of the fax is returned by FaxStatus.
tax 4). iPreview/iDestination connects to the fax ser-
•with iPreview/iDestination and the print functions. ver if needed and returns the identifier of the
This solution enables you to directly print a report connection. This identifier can be used by the Fax func-
created with the report editor. In this case, you can tions to follow the progress of the send operation.
give a name to the fax sent. The status of the fax will // Send the "CustInvoice" report by
be returned by FaxStatus. fax
Note: you can only send one fax at a time. However, Fax- ConnectID is int
Send can be run several times in a row: the faxes will be ConnectID = FaxConnect()
added to the fax sending queue. The WLanguage proce- ConnectID = iDestina-
dure combined with FaxStatus allows you to find out tion(iFax,"0006050402",…
which fax is being processed. "MyFax",ConnectID)
iPrintReport(CustInvoice)
4. Once the faxes have been sent, disconnect the
application or the site from the fax server with

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

• information about the fax sender (Windows 2000): 11.4.2 Tips


The corresponding registry key is To create a fax server and manage redial, the following
HKEY_LOCAL_MACHINE\SOFTWARE\Micro- options must be specified in the fax manager:
soft\Fax\UserInfo:
• No retry for sending faxes:
Number of the fax sender FaxNumber RegistrySetVa-
Mailbox address Mailbox lue("HKEY_LOCAL_MACHINE\SOFTWARE\’
Microsoft\Fax","Retries",0)
Organization Company • 0 mn delay between two attempts:
Title Title RegistrySetVa-
lue("HKEY_LOCAL_MACHINE\SOFTWARE\’
Full name FullName Microsoft\Fax","Retry Delay",0)
Service Department • 0 day for keeping the unsent faxes:
RegistrySetVa-
Business address Office lue("HKEY_LOCAL_MACHINE\SOFTWARE\’
Home phone HomePhone Microsoft\Fax","Dirty Days",0)

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

11.5 Functions for managing the faxes


These functions let you send faxes from an application or a site:
FaxOutbox Lists the pending faxes or the outgoing faxes
Part 7: Communication

FaxInbox Lists the pending faxes or the incoming faxes


FaxConnect Establishes connection to a fax server
FaxDisconnect Closes the connection to a fax server
FaxSend Sends a fax
FaxStatus Returns the status of the specified fax
FaxRestart Restarts a fax in the spooler
FaxResume Re-enables a fax paused in the spooler
FaxDelete Deletes a fax from the spooler and cancels it
FaxPause Pauses a fax in the spooler
See the online help to check the availability of these functions in the different products (WinDev, WebDev, WinDev
Mobile).

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. WORKING WITH A PALM


PILOT WD

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.

12.2 Modifying the data of a Palm Pilot


To modify the data managed by a Palm Pilot, WinDev Principle
offers two possibilities: In order to modify the records of a Palm Pilot database
• First option (recommended): insert, modify and delete from a WinDev application, you must:

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

Principle Pilot database. You can use:


In order to modify the records of the Notepad Palm Pilot • PalmToString.
database from a WinDev application, you must : • the standard PALM read functions. See ’Reading the
1. Install the WinDev DLL for managing the Palm Pilot. data of a Palm Pilot’, page 477, for more details.
This operation is performed by PalmInstall. 4. Uninstall the WinDev DLL for managing a Palm Pilot
2. Add records to the "Notepad" database of the Palm using PalmUninstall.
Pilot with StringToPalm or FileToPalm.
Caution: we recommend you use PalmInstall and PalmU-
3. Synchronize with the Palm Pilot. This synchronization ninstall in the same program.
can only be performed from the Palm Pilot. From this syn-
chronization, you can read records found in the Palm

12.3 The Palm structure


The Palm structure is a preset structure of WLanguage 12.3.2 Palm structure used for the task list
(no declaration is required). This structure enables you The structure contains the following members:
to:
• create a Palm record, Palm.Category Character string. Record cate-
gory (maximum 16 charac-
• retrieve the content of a Palm record.
ters). Variable in read/write
Note: the variables in the Palm structure are different mode.
based on the database used - Notepad, Task list,
Address book or Calendar. When adding a record, if this
variable is equal to:
12.3.1 Palm structure used by the Notepad - an existing category, the mes-
The structure contains the following members: sage added is associated with
this category.
Palm.Category Character string - a non-existing category, this
Record category (maximum 16 category is created.
characters). Variable in read/ - an empty category (empty
write mode. string): the message is added
palmMemo.Data Character string. Data for the to the "Not classified" cate-
Part 7: Communication

record found in the Palm "Note- gory.


pad" database (message subject Palm.Data Character string. Data for the
and message body in binary for- record found in the Palm "Task
mat). Variable in read/write List" database (in binary for-
mode. mat). Variable in read/write
mode.
Palm.Position Integer. Position of the current
record. The variable is read-only. Palm.Position Integer. Position of the current
record. The variable is read-
only.
PalmTask.Completed Boolean. True if the task has
completed, False otherwise.
Variable in read/write mode.
PalmTask.Description Character string. Caption of the
task to perform. Variable in
read/write mode.
palmTask.Deadline Character string in "YYYYM-
MDD" format or Date variable.
Deadline of the task (date
before which the task must be
done).
Tome1_2.book Page 453 Vendredi, 28. mai 2010 5:50 17

453

PalmTask.Notes Character string (maximum PalmAddress.Name Character string (up to 255


2047 characters). Comments characters).
about the task to perform. Person’s name.
Variable in read/write mode. Variable in read/write mode.
PalmTask.Priority Integer included between 1 PalmAddress.Notes Character string (maximum
and 5. 2047 characters).
Priority of the task to perform
(1 = Maximum priority) Note attached to the contact
and to his address.
12.3.3 Palm structure used for the address Variable in read/write mode.
book PalmAddress.Main- Integer (from 1 to 5)
The structure contains the following members: ContactNum Number of the element to dis-
play as the main contact to
PalmAddress.Address Character string (up to 255 reach the person. This number
characters). corresponds to the number of
Contact address. one of the elements found in
Variable in read/write mode. the PalmAddress.ContactType
PalmAddress.ZipCode Character string (up to 63 cha- and PalmAddress.Contact
racters). arrays.
Zip code for the address of the The information about the
contact. main contact will be the only
information displayed when
Variable in read/write mode. the address book will be in list
PalmAddress.Contact Array of strings (array of 5 ele- format.
ments maximum, each ele- Variable in read/write mode.
ment can have up to 63 Example: PalmAddressMain-
characters)
Contact = 2, if the main way of
Number (or email address) contacting someone is his
used to contact the person. business number and this
This number must correspond number is the second element
to the type of contact specified of the PalmAddressContact-
in the palmAddress.Contact-

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

PalmAddress.Contact- Array of character strings Palm.Position Integer. Position of the current


Type (array with up to 5 elements) record. The variable is read-
Defines the type of contact only.
found in the corresponding
palmAddress.Contact varia-
ble. This parameter corres-
ponds to one of the following
constants:
• palmOtherContact: other
way of contacting the person
not in the list below.
• palmWorkContact: Work
phone number (default
value for the palmAd-
dress.ContactType variable).
• palmHomeContact: home
phone number.
• palmEmailContact: email
address.
• palmFaxContact: fax num-
ber.
• PalmPagerContact: pager
number.
• palmCellContact: mobile
phone number.
• palmMainContact: main
contact number for the per-
son.
PalmAddress.City Character string (up to 255
characters).
Part 7: Communication

City corresponding to the con-


tact address.
Variable in read/write mode.
Palm.Category Character string
Record category (maximum 16
characters). Variable in read/
write mode.
When adding a record, if this
variable is equal to:
• an existing category, the
message added is associa-
ted with this category.
• a non-existing category, this
category is created.
• an empty category (empty
string): the message is
added to the "Not classi-
fied" category.
Palm.Data Character string. Data for the
record found in the Palm
"Address Book" Palm data-
base (in binary format). Varia-
ble in read/write mode.
Tome1_2.book Page 455 Vendredi, 28. mai 2010 5:50 17

455

12.3.4 Palm structure used for the calendar


The structure contains the following members:
PalmOrganizer.AlarmType Unit used to configure the alarm. This unit corresponds to one of the following
constants:
• palmAlarmHour: alarm expressed in number of hours. Example: alarm XX hours
before the start of the calendar task.
• palmAlarmDay: alarm expressed in number of days. Example: alarm XX days
before the start of the calendar task.
• palmAlarmMinute: alarm expressed in number of minutes. Example: alarm XX
minutes before the start of the calendar task.
• palmNone: no alarm.
The palmOrganizer.AlarmValue variable will be expressed in this unit.
Variable in read/write mode.
PalmOrganizer.AlarmValue Integer. Alarm value. Corresponds to the number of units needed to start the
alarm. For example, to trigger the alarm 5 minutes before the beginning of the
calendar task, enter the code:
• palmOrganizer.AlarmValue = 5
• palmAgenda.AlarmUnit = palmAlarmMinute
Variable in read/write mode.
PalmOrganizer.Date Character string in YYYYMMDD format or Date variable. Mandatory information.
Date of the task saved in the calendar. If the date is not specified, the task will be
automatically assigned to today’s date.
Variable in read/write mode.
PalmOrganizer.Description Character string (up to 511 characters). Mandatory information.
Description of the task saved in the calendar.
Variable in read/write mode.
PalmOrganizer.StartTime Character string in HHMMSSCCC format

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

PalmOrganizer.IntervalRepetition Integer included between 0 and 99.


Recurrence interval. This interval depends on the type of recurrence (palmA-
genda.RepetitionType variable)
Variable in read/write mode.
PalmOrganizer.DaysRepetition Array of boolean (maximum 7 elements)
Day of the week for which the task will be repeated. The first element of the array
corresponds to Sunday.
This variable is taken into account only if palmOrganizer.RepetitionType = palm-
WeeklyRepetition. To repeat the task on the selected day, the corresponding array
element must be initialize to True.
Example: to repeat a task every Monday, simply use palmOrganizer.DaysRepeti-
tion[2]=True
Variable in read/write mode.
PalmOrganizer.WeekNumRepeti- Integer included between 1 and 5.
tion Number of the recurring week (in the month). This variable is taken into account
only if palmOrganizer.RepetitionType = palmMonthlyRepetitionByDay.
Variable in read-only mode EXCEPT when the week number corresponds to the
fourth or fifth week.
5th week = week starting at the end of the month.
PalmOrganizer.RepetitionType Integer constant
Type of the recurrence to perform. Corresponds to one of the following constants:
• palmNone: no recurrence.
• palmYearlyRepetition: task recurring every XX years.
• palmWeeklyRepetition: task recurring every XX weeks on Monday, Tuesday …
• palmMonthlyRepetitionByDate: task recurring every XX of the month (where XX
represents a day). The XX is defined according to the start date of the task. For
example, task starting on 08/19/02 and recurring every month on the 19th.
• palmMonthlyRepetitionByDay: task recurring every XX day of each month. The
day of the week and its position in the month are defined according to the task’s
Part 7: Communication

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

12.4 Read the data of a Palm Pilot


12.4.1 Principle the current computer. The Notepad, Calendar, Task List
Reading the Palm Pilot data from a WinDev application is and Address Book databases are accessible. Data can
directly performed in the Palm Pilot database found on be accessed in read/write mode.

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

12.4.2 The different steps PalmListCategory Lists the different categories


Step 1: Opening an access with the PalmLoad function available for the current access.
PalmLoad lets you create a "View" of the data found in PalmRead Returns information about the
the specified database of the Palm Pilot. This view is an current record: record’s contents,
Access. All the database records are loaded in memory its category or position
and can be used by PALM functions.
You can then work with the records corresponding to a PalmReadLast Points to the last record of the
specific access. You can filter these records, read these specified access and reads this
records and so on, ... record.
You can define several simultaneous accesses to a PALM PalmReadPrevious Points to the previous record of
database. These accesses can be performed on one of the specified access and reads
the databases of one user only: the data will only be loa- this record.
ded once into memory. You can for instance define an
access containing only the records found in the notepad PalmReadFirst Points to the first record of the
of the WORK category at the same time as an access con- specified access and reads this
taining the records found in the notepad of the CUSTOM record.
category. Each of these accesses will be identified by its PalmReadNext Points to the next record of the
name. specified access and reads this
Example: the following code lets you create an access to record.
the PALM "Notepad" database of the user JEF. In case of PalmPosition Points to the record identified by
failure, an error message is displayed and the program its position in the specified
stops. access and reads this record.
//String containing a message from the
// notepad The various read functions let you update the Palm struc-
MyMemo is string ture. This structure is used to find out all the characteris-
If PalmLoad("ACCESJEF",… tics of the record. See the ’Palm structure’ paragraph,
"JEF") = False Then page 472, for more details.
Error("Error while"+… PalmFilter lets you filter records in an access.
"accessing the "+… PalmNbRec lets you find out the number of records found
"PALM database" + … in the specified access.
ErrorInfo())
Part 7: Communication

EndProgram() Step 3: Refreshing the accesses (optional step)


END PalmRefresh lets you refresh the specified access. There-
MyMemo = PalmReadFirst("ACCESJEF") fore, if a synchronization was performed, PalmRefresh is
used to load in memory all the modifications performed
Step 2: Reading the records found in the PALM database by the synchronization.
In order to read the records of a Palm Pilot database,
simply use the read functions: Step 4: Closing the accesses
Once the management of Palm data is completed, you
PalmOut Enables you to find out whether need to close the accesses previously opened. Palm-
the PALM record to which you Close is used to close the accesses. All the accesses are
want to point is outside the PALM automatically closed when the application is closed.
file or the filter.
Tome1_2.book Page 459 Vendredi, 28. mai 2010 5:50 17

459

12.5 PALM functions


The following list presents the PALM functions.
The use principle of the PALM functions as well as the details of these functions are available in the online help:
StringToPalm Transmits a character string (in text memo format) to the Palm Pilot
FileToPalm Sends the current record found in a HyperFileSQL file (in memo format) to the Notepad data-
base of the Palm Pilot
PalmAdd Adds a record to the specified access
PalmLoad Initializes an access to a PALM database
PalmUninstall Restores the initial configuration of the Palm Pilot (HotSync.EXE)
PalmOut Enables you to find out whether the record of the PALM notepad you want to point to is out-
side the PALM file or outside the filter
PalmClose Closes an access to the PALM Notepad database
PalmFilter Filters the records of an access to the Palm Notepad database
PalmInstall Automatically configures the Palm Pilot program (HotSync.EXE) to allow the communication
with an application developed in WLanguage
PalmListCategory Lists the different categories available for the current access
PalmListUsers Lists all the users of the Palm Pilot defined by the HotSync program
PalmRead Reads the information regarding the current record when accessing a Palm Pilot Notepad
database
PalmReadLast Points to the last record of the specified access and reads it
PalmReadPrevious Points to the previous record of the specified access and reads it
PalmReadFirst Points to the first record of the specified access and reads it
PalmReadNext Points to the next record of the specified access and reads it
PalmModify Modifies the current record in the specified access
PalmNbRec Returns the number of records found in a specific access to a PALM database
PalmPosition Points to the record identified by its position in the specified access and reads it
PalmRefresh Refreshes the current accesses to a PALM database according to the last modifications per-
formed on this database

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

13. RETRIEVING HTML PAGES


13.1 Overview
You can retrieve pages in HTML format. To retrieve HTML These functions enable you to retrieve:
pages you need to: • the full content of an HTML page,
1. Execute a query on the Web server using HTTPRe- • data files,
quest.
This request can be a GET or POST type request. • images,
This request can be executed on a standard URL or a •…
protected URL.
2. Get the request’s result with HTTPGetResult.

13.2 HTTP functions


The following functions are used to manage HTTP requests:
HTTPAddFile Adds a file to an HTTP form.
HTTPAddParameter Adds a parameter to an HTTP form.
HTTPCancelForm Cancels the declaration of an HTTP form and frees all its resources.
HTTPCreateForm Creates an HTTP form.
HTTPDestination Indicates the backup file for the result of the next HTTP request, run in the same thread.
HTTPGetResult Retrieves the result or the header of the last HTTP request (run by HTTPRequest)
HTTPProgressBar Manages a progress bar for receiving an HTTP request
HTTPResetForm Clears an HTTP form currently edited.
HTTPRequest Starts an HTTP request on a server
HTTPTimeOut Defines the time-out for the WLanguage functions that use the HTTP protocol
Part 7: Communication

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. MANAGING FILES ON THE INTERNET WD

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

14.2 Detailed use of WinDev FTP/RPC


14.2.1 Step 1: establishing a connection with a 14.2.2 Step 2: uploading a file onto a WinDev
WinDev RPC/FTP server FTP server

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

// Branch the Gauge procedure


- - Button for sending the transfer
// on this message
IF Transfer_InProgress = True THEN
Event("UpdateProgressBar", "MAIN",…
Error("File transfer"+…
WM_MYMESSAGE)
"in progress")
ELSE
-- Code of the button for file
Transfer_Done = False
-- download
Transfer_InProgress = True
HourGlass(True)
IF NetSendFile(hConnect,…
IF NOT NetGetFile(…
"C:\autoexec.bat", …
hConnect,…
"C:\autoexec.cli", …
"C:\autoexec.bat", …
"SendFile", 10) = False THEN
"C:\autoexec.cli", …
Info("Transfer failed")
WM_MYMESSAGE, 10) THEN
END
Error("Error while"+…

"transferring files")
END
END
Hourglass(False)
- - Procedure ProgrBar_Transfer :
- - managing the current transfer - - Procedure UPDProgBar()
Procedure ProgrBar_Transfer Procedure UPDProgBar()
Message("Transfer in progress") // Display the progress bar
Gauge(_EVE.wParam, _EVE.lParam) // If the entire file has been
IF _EVE.wParam = _EVE.lParam THEN transferred,
Transfer_InProgress = False // reinitialize the progress bar
Transfer_Done = True IF _EVE.wParam = _EVE.lParam THEN
Message("Transfer done") // Transfer completed
Info("Transfer done") Gauge()
END ELSE
// Transfer in progress
14.2.3 Step 3: downloading a file from a Win- Gauge(_EVE.wparam, _EVE.lparam, …
Dev FTP server "Transfer in progress")
NetGetFile lets you download a file found on the WinDeb END
FTP/RPC server.
14.2.4 Step 4: Closing a connection with a
Part 7: Communication

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

14.3 Net functions


The following functions are used to manage the WinDev FTP/RPC communications:
NetIPAddress Returns the IP (Internet Protocol) address of a computer
NetMACAddress Returns the MAC address of one of the network cards found on the computer.
NetConnect Connects to an FTP server (File Transfer Protocol) or to a RPC server (Remote Procedure
Call) created by WinDev
NetDisconnect Disconnects from a WinDev FTP (File Transfer Protocol) or RPC (Remote Procedure Call) ser-
ver
NetStartServer Starts an FTP server (File Transfer Protocol) or a RPC server (Remote Procedure Call) crea-
ted by WinDev
NetSendBuffer Transmits a character string to an FTP server (File Transfer Protocol) or to a RPC server
(Remote Procedure Call) created by WinDev
NetSendFile Transmits a file to an FTP server (File Transfer Protocol) created by WinDev
NetSendMessage Triggers a Windows event on the system of an FTP server (File Transfer Protocol) or RPC ser-
ver (Remote Procedure Call) created by WinDev
NetClientSendMessage Sends a message from the server to all the connected client computers
NetExecute Runs a specific program on an FTP server (File Transfer Protocol) or on a RPC server
(Remote Procedure Call) created by WinDev
NetCloseRemoteAccess Closes the line previously opened by NetOpenRemoteAccess
NetEndServer Stops an FTP server (File Transfer Protocol) or a RPC server (Remote Procedure Call) created
with WinDev and previously started by NetStartServer
NetInfoRemoteAccess Returns information and statistics about the status of a connection
NetIPToMAC Returns the MAC address corresponding to the specified IP address.
NetListRemoteAccess Returns the list of available remote accesses
NetDiskList Lists the available disks
NetDirList Lists the directories and the files
NetMACToIP Returns the IP address corresponding to a MAC address
NetClientMessageBox Displays a dialog box on each client computer connected to the server

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

15. COMMUNICATING WITH AN FTP SERVER


15.1 Handling files on a RPC server
15.1.1 Overview 1. Connect to an FTP server (FTPConnect).
FTP (File Transfer Protocol) is a protocol used to transfer 2. Upload and download files (according to the connec-
files from a site to another remote site. This protocol is tion mode). For a passive connection, the application or
used to exchange files via TCP/IP, Wi-Fi or the Internet. site must request the authorization from the FTP server
Several thousands of file servers can be accessed by FTP before each file operation on the server. You can also:
on Internet. These servers propose shareware or freeware • find out the characteristics of the files found on the FTP
to the public. server: attributes, size, …
Some WLanguage functions enable you to manage files • handle the files found on an FTP server: creation, dele-
on an FTP server from your applications or your sites. tion, …
• list the files of a directory found on the FTP server by
15.1.2 FTP running a procedure used to perform a process for
Convention each file found.
• In theory, you cannot connect to an FTP site without an 3. Close the connection with the server (FTPDisconnect).
FTP account and a password. Only a user with an
account and a password can connect to this site. 15.1.4 Relative path/absolute path
• Usually, most servers found on the Internet have an The notions of relative path and absolute path are very
Anonymous account. The password of this account is important in an FTP application.
not implemented but an email address will be reques- • A path starting with a slash is considered as being an
ted. absolute path: this is the path from the root of the FTP
server (parameter specific to the server).
To only download the files found on an FTP server, all you ex: /pub/user/FIONA
have to do is connect as an "anonymous user".
• A path not starting with a slash is considered a relative
To upload files to an FTP server (to send HTML pages to path, that is a path given in relation to the current
your Web site for instance), a non-anonymous account directory. This current directory can be returned or
and a password are required.
Part 7: Communication

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:

15.2 FTP functions


The following functions are used to manage FTP (File Transfer Protocol):
FTPAttribute Identifies the attributes of a file found on an FTP server (File Transfer Protocol)
FTPCommand Sends a specific FTP command to a server
FTPConnect Connects the current computer to an FTP server (File Transfer Protocol)
FTPDate Returns the different dates (creation, modification or access) associated with a file found on
an FTP server (File Transfer Protocol)
FTPDisconnect Disconnects the current computer from the FTP server (File Transfer Protocol)
FTPSend Transfers a file or directory to an FTP server (File Transfer Protocol)
FTPTime Returns the times (creation, modification or access) associated with a file on an FTP server
(File Transfer Protocol)
FTPListFile Lists the files found in a directory of an FTP server and returns the number of listed files
FTPName Returns the name of the last file accessed by an FTP function (File Transfer Protocol)
FTPGet Transfers a file or a directory from an FTP server (File Transfer Protocol) to the current compu-
ter
FTPRenameFile Renames or moves a file found on an FTP server (File Transfer Protocol)
FTPMakeDir Creates a directory on an FTP server (File Transfer Protocol)
FTPCurrentDir Identifies or modifies the current directory on an FTP server (File Transfer Protocol)
FTPRemoveDir Deletes a directory and its content (files and sub-directories) from an FTP server (File Trans-

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

16. SOCKET MANAGEMENT


16.1 Overview
WLanguage functions are available for advanced socket • real-time email management,
management. • access to a news server (forum).
A socket is a communication resource used by the appli-
cations to communicate between computers regardless 16.1.1 Different possibilities
of the network type. A WinDev application can manage sockets according to
This communication mode can be used, for instance, to different modes:
communicate between computers connected via Inter- • Client WinDev application: the application connects to
net. a standard server and exchanges data via a socket.
With a Pocket PC, data exchange between two machines See ’WinDev client application/WebDev client site’,
can be performed: page 486, for more details.
• by Wi-Fi. • "Simplified Server" WinDev application: the WinDev
• by ActiveSync. application is a server that exchanges information via a
• by GPRS (caution: not all the telephone service con- socket with a single client computer (WinDev socket
tracts allow you to connect two machines). recommended on the client computer but not manda-
tory). See ’"Simplified server" WinDev application’,
• by network card. page 487, for more details.
WinDev, WebDev and WinDev Mobile enable you to • "Standard server" WinDev application: the WinDev
manage: application is a server that exchanges information via
• Standard sockets sockets with several client computers. See ’Standard
• UDP sockets socket server’, page 488, for more details.
• Infrared sockets
16.1.2 Example
• SSL sockets
WinDev comes with a socket management example: WD
Examples for using sockets: instant messaging.
Part 7: Communication

16.2 Client WinDev application/Client WebDev site


A client application of a socket server connects to a stan- computers. These two computers can read and write cha-
dard server in order to exchange information via a socket. racter strings on the socket.
Example: A WinDev client application or a client WebDev Note: To avoid locking the applications or sites, the inco-
site can connect to a standard news server on Internet. ming messages are usually managed by a specific thread
(see ’Managing the threads’, page 493, for more details).
16.2.1 Principle of a client application or a To read and write on the server’s socket, the WinDev
client site client application or the WebDev site must use Socke-
Step 1: Connection to the server tRead and SocketWrite.
To connect to a server socket, use SocketConnect. This Caution: to perform a read operation, a write operation
function is used to establish a connection to the server. must have been performed. For example:
The socket is identified by its port and by its address. 1. The client computer writes to the socket: it sends a
Step 2: Exchange of data request to the server.
Once two computers have connected their socket, a com- 2. The server computer reads from the socket.
munication stream is established between these two
Tome1_2.book Page 467 Vendredi, 28. mai 2010 5:50 17

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.

16.3 "Simplified Server" WinDev application WD WDMobile

WinDev gives you the ability to create a simplified socket


server. This server enables you to communicate with a Step 2: Exchange of data
single client computer at a time. This type of application When two computers use the same socket, a communi-
is very useful when two remote applications must com- cation stream is established between these two compu-
municate between themselves. ters. These two computers can read and write character
Note: WinDev also offers the ability to create a more ela- strings on the socket.
borate socket server (standard socket server), managing Note: To avoid locking the applications or sites, the inco-
the simultaneous connection of several client machines. ming messages are usually managed by a specific thread
See ’Standard socket server’, page 488, for more details. (see ’Managing threads’, page 493, for more details).

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

Step 3: Closing the socket The message is in the format: "11\r\nHelloWord"


To end the communication, the server closes the socket Method 2: Standard mode: the end of the message is
with SocketClose. marked by a specific character, set in advance. This
transmission mode is recommended when sockets are
Note: the socket can also be closed by the client compu- used to communicate between a WinDev application and
ter. another application. In this case, a specific character
must be included in the message to indicate that the
16.3.2 Transmission mode of information message is over.
The transmission mode of the message defines the mode The message has the following format: "Hello
used to specify the length of the message. World<EOF>"
Several methods can be used to define the length of the Method 3: Standard mode with buffer: Corresponds to
message during the communication between sockets. the standard mode optimized for the protocols that are
Method 1: WinDev mode: By default, the number of cha- the most used on the Internet.
racters in the message is specified at the beginning of SocketChangeTransmissionMode lets you change the
the message. This transmission mode is recommended transmission mode used.
when sockets are used to communicate between two
WinDev applications.

16.4 Standard socket server WD

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

and a port number are associated with each socket. Example


The following example is used to create a socket on the
Step 2: Waiting for connection on the socket server and to manage the connections of the client com-
All the computers wanting to communicate with the ser- puters in a thread. If the connection is accepted, the
ver machine can connect to the socket: these are client management of this connection is performed by a speci-
machines. The server computer manages the various fic thread.
connection requests from the client machines using the A thread is run for each connection. Each thread uses the
SocketWaitForConnection function. same service function ("ManagementProcedure"). To
allow the procedure execution by several threads simul-
taneously, you must change the thread synchronization
mode: use ThreadMode with the threadCriticalSection
This function is used to find out whether a connection parameter in the project initialization code. The synchro-
request is performed on a specific socket. nization between the threads must be done manually
We recommend that you use SocketWaitForConnection (see ’Thread management’, page 493, for more details).
Tome1_2.book Page 469 Vendredi, 28. mai 2010 5:50 17

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

16.5 Socket functions


The following functions are used to manage sockets:
SocketAccept Accepts the connection of a client computer to the server
SocketWaitForConnection Checks whether a connection was requested by a client computer
SocketChangeTransmissionMode Changes the transmission mode used on a socket
SocketClientInfo Allows a server computer to retrieve information about a socket connected to
a client computer
SocketConnect Enables you to connect to a data socket
SocketConnectBluetooth Connects a client computer to a specific Bluetooth socket.
SocketConnectInfrared Connects a client computer to a given socket via the infrared port
SocketConnectSSL Connects a client computer to an SSL server.
SocketCreate Creates a socket
SocketCreateBluetooth Creates a Bluetooth socket.
SocketCreateInfrared Creates a socket that uses the infrared port
SocketCreateSSL Creates an SSL socket.
SocketCreateUDP Creates a socket that uses the UDP protocol
SocketWrite Sends a message between two sockets
SocketExist Checks the existence of a socket
SocketClose Closes a socket or a connection to a socket on the server computer
SocketRead Reads a message sent by a socket
SocketDeny Refuses the connection requested by a client computer
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 7: Communication
Tome1_2.book Page 471 Vendredi, 28. mai 2010 5:50 17

471

17. MANAGING THE BLUETOOTH KEYS


17.1 Overview
Create a new type of application! With no contact dard.
between the PC and the mobile device, several processes • An application can automatically retrieve photos from
can be run on the PC by using the data found on the a cell phone.
mobile device. • An application can read the list of contacts found on a
Some examples: cell phone.
• An application on PC (or mobile device) can emulate • A PC can print the data found on a PDA.
services on a device that supports the bluetooth stan-

17.2 How do I proceed?


Several groups of functions enable you to communicate • The OBEXxxx functions: these functions let you
via bluetooth: manage file exchanges via the OBEX protocol.
• The Bluetooth functions (BTxxx): these functions let • The SocketConnectBluetooth and SocketCreateBlue-
you manage Bluetooth devices. You can for instance tooth functions, which allow you to manage sockets
list the services found on a device, and enable or disa- that use Bluetooth devices.
ble them. You can also authenticate toward a Blue-
tooth device and get information about the device.

17.3 Which keys should be used?


The functions used to handle the Bluetooth keys operate • (*) Belkin Bluetooth 2.0 Adapter - F8T012FR1 - 100-
with the keys that use a protocol stack issued by Micro- meter range (USB 2.0),
soft or Bluesoleil. BTStack enables you to find out the • TrendNet TBW-104UB - USB Bluetooth 2.0 Adapter,

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

17.4 The Bluetooth and OBEX functions


17.4.1 Bluetooth functions
The following functions are used to manage the Bluetooth devices:
BTAcceptConnection Enables you to find out whether a Bluetooth radio accepts (or not) the
requests for connection coming from the devices.
BTEnableService Enables a service provided by a Bluetooth device.
BTChangeConnectivity Enables you to configure a Bluetooth radio to accept (or not) the requests for
connection coming from the devices.
BTChangeVisibility Changes the visibility of a Bluetooth radio.
BTConnectDevice Allows you to be authenticated by a Bluetooth device.
BTDisconnectDevice Cancels the authentication beside a Bluetooth device.
BTDisableService Disables a service on a Bluetooth device.
BTIsVisible Enables you to find out whether a Bluetooth radio is visible.
BTInfoDevice Returns specific information about a Bluetooth device.
BTListDevice Returns the list of accessible Bluetooth devices.
BTListRadio Returns the list of Bluetooth radios connected to the computer.
BTListService Returns the list of services provided by a Bluetooth device.
BTOpenDeviceProperties Opens the window for the properties of a Bluetooth device.
BTStack Returns the Bluetooth stack currently used.
BTSelectDevice Opens a system window to select a Bluetooth device.
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).

17.4.2 OBEX functions


The following functions are used to manage file exchanges via the OBEX protocol:
OBEXConnect Enables you to connect to a device that supports the OBEX protocol.
Part 7: Communication

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

18. THREAD MANAGEMENT


18.1 Overview
WLanguage functions are available for advanced thread 18.1.1 From simple thread management to
management. complex thread management
The threads are used to run code (or processes) in paral- There are several ways to manage threads:
lel of the main application. Several processes can be run • Executing threads.
as background tasks without locking the main applica-
tion. • Managing semaphores in the threads, that is limit the
concurrent execution of a piece of code by one or more
The threads replace some types of timers. threads at a given time
An efficient thread is a thread that waits for an event such • Managing signals in order to perform a synchronization
as a user action, an incoming email, an incoming phone among several threads.
call, …
Examples for using threads: 18.1.2 Example
• Retrieving emails in background task while a new email WinDev comes with a tread management example:
is typed. WD Thread Pool.
• Communication application or site: manage incoming
calls, communication with sockets, …

18.2 Thread use principle


An application or a site is running. This application or site Caution: if a WLanguage function is running when the
runs in a main thread. thread is stopped, the thread will only stop after the exe-
This application can start a secondary thread at any time: cution of the function.
this thread runs in parallel to the application or site. This WLanguage functions
thread corresponds to a local or global procedure of the

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

1. Change the default thread management mode


a=i b=i (ThreadMode function).
a++ b++ 2. Manage the critical sections and the semaphores in
i=a i=b the code of the application or site.

18.3 Managing the semaphores in the threads


The semaphores are used to limit the concurrent execu- 2. Thread #1 runs the piece of code that is protected by
tion of some source code (procedure, code line, and so the semaphore.
on) to one or more threads at a given time. 3. While thread #1 runs the code protected by the sema-
For example: two specific threads are used in a banking phore, a thread #2 runs SemaphoreStart: since the code
application: protected by the semaphore is already running in thread
• a thread is used to credit the accounts, #1, thread #2 waits for the semaphore to unlock.
• a thread is used to debit the accounts. 4. Thread #1 runs SemaphoreEnd: no other thread is
At any given time, there can only be one account credit or executing the semaphore’s code.
one account debit. 5. Thread #2 can execute the code protected by the
semaphore.
18.3.1 Principle 6. Thread #2 runs SemaphoreEnd: no thread is running
The semaphore was created by SemaphoreCreate. the semaphore’s code.
1. Thread #1 runs SemaphoreStart: no thread is cur-
rently present in the semaphore.
Tome1_2.book Page 475 Vendredi, 28. mai 2010 5:50 17

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

18.4 Using signals to synchronize the threads


The signals can be used to synchronize the different • Code of Main Thread:
threads of an application. A thread may also wait for ano- IF Right(Edit1, 1) = " " THEN
ther thread to be run. ThreadSendSignal(…
Two management modes can be used to manage the "ThreadCorrection")
signals: END
• simple management: synchronization between two • Secondary thread code (ThreadChecker):
threads Loop
• advanced management: synchronization among more IF ThreadWaitSignal() = True then
than two threads StartCorrection()
End
18.4.1 Simple management of signals End
Two threads are run in parallel (a main thread and a WLanguage functions
Part 7: Communication

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

1. Create a signal (EventCreate). By default, this signal is


closed.
2. Wait for the signal (EventWait).
3. Synchronize the threads with EventChange: the signal
is opened. All the pending threads are unlocked, and the
signal is automatically closed (default behavior).
4. Destroy the signal (EventDestroy).
The functions for advanced management of signals
The following functions are used to manage the advanced
signals:
EventWait Locks the current thread while wai-
ting for the specified signal to be
opened
EventCreate Creates a signal
EventDestroy Explicitly destroys a signal
Implementation
The steps for implementing the advanced management EventChange Modifies the status of a signal
of signals are as follows:

18.5 Managing the opening of a WinDev window in a secondary thread


A secondary thread cannot directly open a window with • implement an event to manage the opening of the win-
the standard WLanguage functions such as: Open, Use, dow in the main thread.
… • trigger the secondary threads.
Nevertheless, you may want to display a window from a // Implement an event to
secondary thread. For example, if a thread is used to // manage the opening of the
manage some incoming calls, a window containing the //"chat" window
characteristics of the caller can be displayed by this gnEventID = Event(…
thread when an incoming call is detected. "OpenChat","*.*","StartChat")

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

thread is as follows: ferent parameters that must be passed to the window.


// Request for opening the The message is handled by the event defined in the ope-
// "chat" window ning code of the window. When the message occurs, the
PostMessage(… ChatOpening procedure is automatically run. This proce-
Handle(Main_Window),… dure is used to open the window.
"StartChat",CONTACT.CONTACTID,… The code of this procedure is as follows:
CONTACT.CONTACTID) PROCEDURE OpenChat(nParam,…
The "StartChat" message is sent to the main window nContact)
(identified by its handle). This message contains the dif- OpenSister(Window_Message,nContact)

18.6 Functions for managing the threads


The following functions are used to manage threads:
CriticalSectionStart Marks the beginning of a critical section: no other thread will be able to run the code as long
as the current thread does not exit the critical section
CriticalSectionEnd Marks the end of a critical section: another thread will be able to execute the code
SemaphoreCreate Creates a semaphore
SemaphoreStart Locks the current thread while waiting for the semaphore to open (I.e. waiting for an "availa-
ble" spot in the protected area)
SemaphoreDestroy Explicitly destroys a semaphore
SemaphoreEnd Allows one or more threads to exit from the section protected by the semaphore
EventWait Locks the current thread while waiting for the specified signal to be opened
EventCreate Creates a signal
EventDestroy Explicitly destroys a signal
EventChange Modifies the status of a signal
ThreadStop Stops a "secondary" thread
ThreadWait Waits for the end of execution of the specified "thread". A maximum time-out can be speci-
fied
ThreadWaitSignal The current thread is locked as long as no signal is received from another thread
Part 7: Communication

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.

19.2 Running procedures on a SOAP server


A set of SOAP functions lets you manage the execution of •check the header if necessary,
procedures on a SOAP server from your WinDev applica- •run the procedure,
tions or your WebDev sites. •send the procedure’s result or error to the current

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

19.2.2 The SOAP structure


The following structure is used to pass parameters to a
procedure executed on a SOAP server:
Variable Type Detail
SOAP.NameSpace Optional character string "NameSpace" of the parameter
SOAP.Name Character string Parameter name
SOAP.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.
SOAP.EncodingStyle Optional character string Encoding style ("EncodingStyle") of the parameter
SOAP.Type Constant Parameter type
SOAP.Value Any type Parameter value

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 Creating and installing a WinDev SOAP server application


The SOAP Server application is an application containing
all the procedures to run. These procedures are run by
the SOAP client application.

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

19.4 SOAP functions


The following functions are used to manage SOAP procedures:
SOAPAddHeader Adds a header to the next SOAP procedure to run
SOAPGetResult Returns the result of the last SOAP procedure successfully run
SOAPEncodeResult Enables you to configure the format of the value returned by the WinDev SOAP server to the
SOAP client program
SOAPError Returns the error for the last SOAP procedure that failed
SOAPRun Runs a procedure on a SOAP server
SOAPRunXML Runs a procedure on a SOAP server
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 7: Communication
Tome1_2.book Page 484 Vendredi, 28. mai 2010 5:50 17

484

20. .NET XML WEB SERVICES SERVER


20.1 Running procedures on a server of .Net services
20.1.1 Overview .Net XML Web services,
A set of .Net (DotNet) functions lets you manage the exe- •check the header if necessary,
cution of procedures on a .Net XML Web server from your •run the procedure,
WinDev applications or your WebDev sites. •return the result or the error of the procedure to the
current computer.
20.1.2 Principle 3.Check the result of the procedure.
The parameters required to run a procedure are specified The result of DotNetRun or DotNetRunXML is used to
in the documentation of the server of .Net XML Web servi- find out whether the connection was successfully
ces. established.
To run a procedure on a server of .Net XML Web services: If the connection was not established, ErrorInfo
1. Initialize the parameter structure of the procedure returns the error details.
to run (see the .Net structure). If the connection was established, check the result of
Note (WinDev only): to perform additional checks on DotNetGetResult:
the .Net XML Web server, add a procedure header ( •If the result is not an empty string (""), the proce-
DotNetAddHeader). dure was successfully run.
2. Run the procedure (DotNetRun or DotNetRun- •If the result is an empty string (""), the procedure
XML). The following operations are automatically was not run and/or an error was returned. DotNe-
performed: tError returns the error of the procedure.
•connect the current computer and the server of
.Net XML Web services,
•transmit the procedure parameters to the server of

20.2 .Net structure


Part 7: Communication

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

20.3 .Net functions


The following functions are used to manage a .Net services server:
DotNetAddHeader Adds a header to the next .Net procedure to run
DotNetDelegate Initializes a .NET delegate. This delegate will allow .NET to call back a WLanguage pro-
cedure or method in case of events or "callbacks".
DotNetGetResult Returns the result of the last .Net procedure that was successfully run
DotNetError Returns the error for the last .Net procedure that failed
DotNetRun Runs a procedure on a server for .Net XML Web services
DotNetRunXML Runs a procedure on a server for .Net XML Web services
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 7: Communication
Tome1_2.book Page 486 Vendredi, 28. mai 2010 5:50 17

486

21. J2EE XML WEB SERVICES SERVER


21.1 Running procedures on a server of J2EE services
21.1.1 Overview •transmit the procedure parameters to the server of
A set of J2EE functions let you manage the execution of J2EE XML Web services,
procedures on a J2EE XML web service server from your •check the header if necessary,
WinDev applications or from your WebDev sites. •run the procedure,
•return the result or the error of the procedure to the
21.1.2 Principle current computer.
The parameters required to run a procedure are specified 3. Check the result of the procedure.
in the documentation of the server of J2EE XML Web ser- The result of J2EERun or J2EERunXML is used to find
vices. out whether the connection was successfully esta-
To run a procedure on a server of .Net XML Web services: blished.
1. Initialize the parameter structure of the procedure If the connection was not established, ErrorInfo
to run (see the J2EE structure). returns the error details.
Note (WinDev only): to perform additional checks on If the connection was established, check the result of
the J2EE XML Web server, add a procedure header ( J2EEGetResult:
J2EEAddHeader). •If the result is not an empty string (""), the proce-
2. Run the procedure (J2EERun or J2EERunXML). dure was successfully run.
The following operations are automatically perfor- •If the result is an empty string (""), the procedure
med: was not run and/or an error was returned.
•connect the current computer and the server of J2EEError returns the procedure’s error.
J2EE XML Web services,

21.2 J2EE structure


The following structure i used to pass parameters to a procedure executed on a J2EE XML Web services server:
Part 7: Communication

Variable Type Detail


J2EE.NameSpace Optional character string "NameSpace" of the parameter
J2EE.Name Character string Parameter name
J2EE.XMLParam Optional character string Parameter structures expressed in XML format. The other
parameters (Value, Name, Type, NameSpace and Enco-
dingStyle) are ignored if this parameter is specified.
J2EE.EncodingStyle Optional character string Encoding style ("EncodingStyle") of the parameter
J2EE.Type Constant Parameter type
J2EE.Value Any type Parameter value

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

21.3 J2EE functions


The following functions are used to manage a J2EE services server:
J2EEAddHeader Adds a header to the next J2EE procedure to run
J2EEGetResult Returns the result of the last J2EE procedure successfully run
J2EEError Returns the error for the last J2EE procedure that failed
J2EERun Runs a procedure on a server for J2EE XML Web services
J2EERunXML Runs a procedure on a server for J2EE XML Web services
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 7: Communication
Tome1_2.book Page 488 Vendredi, 28. mai 2010 5:50 17

488

22. XML WEB SERVICES


WinDev and WebDev allow you to directly import XML Furthermore, WinDev lets you manage XML Web services
Web services of .Net and J2EE types in your WinDev using the SOAP technology directly from your WinDev
applications and your WebDev sites. applications.

22.1 Importing XML Web services


From the WSDL (Web Services Description Language) Note: when importing a XML Web service, the information
description of the imported service, WinDev/WebDev found in the WSDL file is automatically changed into
automatically generates a set of WinDev/WebDev proce- comments in the code of the set of procedures. These
dures. Each procedure found in this set corresponds to comments enable you to find out the role of the different
an operation of the XML Web service. procedures and the description of the parameters to
To use the XML Web service, use the procedures found in pass to the procedures.
this set in your applications. Special case: the XML Web service returns a result in a
type unrecognized by WinDev/WebDev
22.1.1 Importing an XML Web service into a
WinDev/WebDev project The types of variables available in WinDev/WebDev and
the ones available in a SOAP type XML Web service can
To import an XML Web service: differ.
1. Select "Workshop .. XML Web service .. Import a The simple types (boolean, integer, and so on) used in
service into this project". The wizard for importing the XML Web service are automatically converted into
XML Web services starts. WinDev/WebDev format (and conversely) when the ser-
2. Select the WSDL description of the service to vice is imported into a WinDev/WebDev project.
import. This description can be: The more complex types (classes, structure, composite
•loaded from an Internet address, variables, …) are processed as character strings in the
•loaded from an XML file found on the current WLanguage code. These character strings contain the
machine. XML code corresponding to the type of variable returned
3. Select the specific features of the XML Web ser- by the XML Web service and to its content.
Part 7: Communication

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

22.2 Generating an XML Web service


From the WinDev project corresponding to the XML Web •Delete elements:
service, WinDev will automatically create: The corresponding files and their dependencies will
• a WinDev library (.WDL file). This library will contain all be ignored in the library.
the procedures of your Web service. These procedures •Create the library from an existing library descrip-
can be used by any application that uses your XML Web tion (*.WDU file).
service. When creating a WinDev library, a ".WDU" file with
• a .XML file. This file contains the description of the XML the same name is automatically created. This file
Web service in WSDL format (Web Services Description contains all the references of the elements included
Language). in the library.
8. Validate ("Done" button) to start the generation
of the XML Web service.
To make your XML Web service available, these files (as
well as the necessary WinDev DLLs) must be installed on
a Web server. This server is a WinDev SOAP server. To test your XML Web service on the development compu-
ter:
1. Configure the Internet server installed on your
22.2.1 How do I implement an XML Web ser- computer for your WinDev application (configuration
vice? for Apache, IIS5 or Netscape iPlanet 4.1).
To implement this XML Web service, you must: 2. Configure the SOAP administrator (WDSOAPCon-
1. Generating an XML Web service. fig.EXE application in "Data" directory of WinDev).
2. Run the test of the XML Web service. 3. Restart your Web server.
3. Install the created files (.WDL and .XML files) on a 4. Run the test of your SOAP client application.
WinDev SOAP server. Note: to easily create a SOAP client application to
test the XML Web service, simply include this XML
To generate an XML Web service: Web service in an application. See ’Importing XML
1. Create a WinDev project. Web services’, page 508, for more details.
2. Create the global procedures. Each global proce-
dure can be run by the WinDev SOAP server. To install your application on a SOAP server:
Caution: the server application should not have any 1. Create the setup procedure of your application
interface (no windows, reports, trace windows or dia- ("Workshop .. Create the setup procedure"). The fol-
log boxes). This application is also limited by the

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

•Modify the XML document (XMLAddAttribute,


XMLAddChild, XMLInsertDocument, XMLInsertE-
lement, XMLModify, XMLRename, XMLDelete).
•Run an XPath query in an XML document (XMLExe-
cuteXPath, XMLPosition, XMLResult).
• Convert a character string in ANSI format to a cha-
racter string in XML format and vice versa (Text-
Closing tag ToXML or XMLToText).
4. Save the modifications (XMLBuildString and fSa-
XML code (or content) corresponds to: veText.

23.2 Functions for managing the XML documents


The following functions are used to manage XML documents:
TextToXML Converts a character string in ANSI format into a character string in XML format
TableToXML Creates an XML file from the data found in a table (browsing table or memory table)
XMLAddAttribute Adds an attribute to an XML element
XMLAddChild Adds a child tag to an XML document
XMLCancelSearch Cancels the search started by XMLFind
XMLBuildString Retrieves and formats the content of an XML document (created by XMLDocument and
modified by XML functions)
Tome1_2.book Page 493 Vendredi, 28. mai 2010 5:50 17

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

24. .NET ASSEMBLIES


24.1 Overview
24.1.1 Definition Some .NET assemblies (not created by WinDev) can also
The .NET technology corresponds to the new develop- be used in a WinDev and WinDev Mobile application or in
ment platform of Microsoft. This .NET platform greatly a WebDev site:
simplifies the development of distributed-object applica- • in a new application: specify use of .NET assemblies
tions whose modules communicate via Internet. directly in the wizard.
• in an existing application: select all the .NET assem-
This chapter only provides an overview of how to use the blies required.
.NET technology in WinDev. See a specific documenta-
tion for more details. This chapter presents:
• the conditions needed for working with a .NET assem-
24.1.2 WinDev and .NET bly.
You have the ability to create some .NET programs (or • the creation of a .NET assembly.
.NET assemblies) from a WinDev application. • the creation of a .NET assembly setup program.
These .NET assemblies are created from the WinDev clas- • how to use a .NET assembly in an WinDev application.
ses (with all the benefits from the code editor, the docu-
mentation editor, …). See the online help for more details about .NET assem-
blies (keyword: ".NET assembly").

24.2 Conditions for using a .NET assembly


To create and use a .NET assembly with WinDev, you Parameters .. Control Panel") and select "Adminis-
must: trative Tools".
• install the .NET Framework on your computer. 2. Select "Microsoft .NET Framework Wizards". The
• define the .NET security level. window of the .NET wizard is displayed.
Part 7: Communication

3. Click "Adjust the .NET security".


• make the DLLs required to run the .NET assembly 4. Select "Apply the modifications to this compu-
accessible. ter" and click "Next".
5. Select "My computer" and configure the security
24.2.1 Install the .NET framework to "Full trust".
To install the .NET framework on the current computer: Note: to run a .NET program available on the local
• Method 1: Use Windows Update network, select the "Local Intranet" icon and adjust
1. Open the control panel of Windows ("Start .. the security setting to "Full trust".
Parameters .. Control Panel") and select "Add/ 24.2.3 Making the DLLs required to run the
Remove Programs".
2. Click "Add new programs".
.NET assembly accessible
3. Click "Windows Update". To make the DLLs needed to run the .NET assembly
4. Find the setup of the .NET Framework. accessible:
5. Install the .NET Framework. 1. Copy (if necessary) the "WD150NET.DLL" library:
•to the creation directory of the .NET assembly.
• Method 2: Download from the Microsoft Internet site
1. Consult the Microsoft site. •into the "Assembly" sub-directory of the setup
2. In the "Microsoft Download Center" section, find directory of Windows.
the installation of the .NET Framework. 2. Copy (if necessary) the WinDev libraries:
3. Install the .NET Framework. •to the creation directory of the .NET assembly.
•into the PATH.
24.2.2 Define the .NET security level Reminder: the PATH list the directories where the
To define the .NET security level: executable (".EXE" files) and the libraries (".DLL"
1. Open the control panel of Windows ("Start .. files) are sought first.
Tome1_2.book Page 495 Vendredi, 28. mai 2010 5:50 17

495

24.3 Creating a .NET assembly from WinDev


Before creating a .NET assembly, all the elements requi- 6. If needed specify the information about the .NET
red by this assembly must have been developed in a Win- assembly: description, version, copyright, …
Dev project. The "Advanced" button enables you to define addi-
tional properties specific to the .NET assembly.
To create a .NET assembly: 7. Enter the name of the .NET assembly.
1. Open the WinDev project from which the .NET The "Compilation options" and "Advanced proper-
assembly must be created. ties" buttons enable you to access the advanced
2. Select "Workshop .. .NET assembly .. Generate a options of the .NET assembly. See "Advanced
.NET assembly DLL". The wizard for creating a .NET options" for more details.
assembly starts. 8. Validate ("Done" button).
3. Select the different WinDev elements (project,
windows, classes, and so on) that will be included in
the .NET assembly. Limitations: you cannot:
The "Add" button enables you to add an element to • rename an existing .NET assembly.
the .NET assembly: images, text files, … • include a component’s classes in a .NET assembly.
The "Remove" button enables you to delete an ele-
ment from the .NET assembly. The corresponding
files and their dependencies will not be included in Advanced options
the .NET assembly. The "Options" button enables you to select a specific C#
The "WDU" button enables you to display the ele- compiler and to specify additional compilation options.
ments found in a library that was previously created. The "Advanced properties" button lets you define
Note: if the WinDev project (".WDP" file) is selected:
whether the .NET assembly must be accessible from a
•the project analysis will be associated with the program using COM technology. In this case, you must :
.NET assembly.
• select the various classes accessible from this pro-
•the initialization process of the project will be run gram.
when the .NET assembly is initialized.
• create a strong-named .NET assembly. The assembly
•the ending process of the project will be run when will be authenticated and it will be possible to check its
the .NET assembly is closed.

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

24.4 Creating a .NET assembly accessible by COM


24.4.1 Overview • The class must have a constructor without argument
Before creating a .NET assembly, all the elements requi- (this is the only constructor that can be used by COM)
red by this assembly must have been developed in a Win- • The static members will not be accessible by COM
Dev project. • The overloaded methods are renamed in COM
24.4.2 Creating a .NET assembly accessible by
3. In the wizard for generating .NET assemblies, select
COM from a WinDev project the following options:
To create a .NET assembly accessible by COM, you must: • Check "Accessible by COM"
• Specify the location of the snk file that was previously
1. Create a ".snk" file. created.
The snk file contains the "public key/private key" pair
used to digitally sign the assemblies created by a com- 4. Copying the generated assembly into the directory of
pany. In most cases, the same snk file is used to sign al shared assemblies of Windows:
the products of a company.
• Copy the assembly into the C:\Windows\Assembly
This file must be kept secret in order to prevent a third directory
party from signing its own assemblies with the same
signature. • Copy the wd150net.dll library into the c:\Win-
dows\Assembly directory (otherwise the instantiation
To generate a ".snk" file, you must use the generator of the COM object will fail with a "file not found at the
supplied with the .NET SDK (sn.exe file). The following specified location" error)
command line must be used to generate a snk file:
"sn.exe -k MySNKFile.snk" • Check whether wd150vm.dll is found in the directory of
PATH
An example file is supplied with WinDev, in the "Pro-
grams\Data\Example.snk" directory of the setup direc-
tory of WinDev. This file is used to test the generation of To use an assembly in a C++ program
strong-named assemblies. These operations must be repeated whenever loading a
Note: since this file is distributed with WinDev, it does not GUID of interfaces:
uniquely identify the assemblies that you generate. 1. Import the assembly: "regasm MyAssembly.DLL /
tlb:MyAssembly.tlb".
2. Use the tlb file generated in the C++ project.
Part 7: Communication

3. Recompile the C++ project.


2. Modify the code of the classes found in the WinDev
project

24.5 Creating the setup program of a .NET assembly


The method for creating the setup program of a .NET See the online help for more details (keyword: "Setup of
assembly is identical to the method for creating the setup a WinDev application").
program of a standard WinDev application.

24.6 Using .NET assemblies in a WinDev application


To include some .NET assemblies in the current applica-
tion: The method for using a .NET assembly is identical to the
1. Select "Workshop .. .NET assembly .. Use a .NET method for using a WinDev class.
assembly in this project". Reminder: classes are visible in the "Project" pane and/
2. Select the .NET assemblies that will be included in or the "Code" pane.
the current application.
3. Validate ("OK" button).
Tome1_2.book Page 497 Vendredi, 28. mai 2010 5:50 17

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.

1.1 HyperFileSQL file management


This section explains how the HyperFileSQL files are index and memo files). If the file existed, it is ove-
managed: rwritten by a blank file (it is recreated).
•create a file, •HCreateIfNotFound to create a data file if it doesn’t
•automatic opening and closing of files, already exists or to open the file if it exists.
•key management, The data file and possibly the index and "memo" files
•record access. are created empty.
The management of xBase files is not discussed in this The file is created:
chapter, it has its own chapter, ’xBase format files’, page •Using the name (called "Name on disk") defined in
530. the analysis (except if HChangeName was called
Long names: before HCreation).
Long names are supported: you can create files with •In the directory defined in the analysis, except if
long names. HSubstDir or HChangeDir was called before HCrea-
To create files with long names, long names must be tion or HCreationIfNotFound.

Part 8: File management


supported by the environment where the program will When the file has just been created, it is empty: it only
run (or by the Web server environment where the pro- contains a header. This header contains information spe-
gram will run) and by the disk where the files will be cific to the file. It is used by WinDev/WebDev for mana-
created. ging the file, it is not accessible.
For example, long names cannot be used with some
networks that don’t support long names but can be used 1.1.2 Opening and closing files
with Windows 95 or Windows NT …
Files are opened and closed automatically. The automa-
1.1.1 Create a file tic file opening and closing mechanism is described for
information purposes only. The developer does not have
In order to access a file, it must already exits on the disk. to worry about it.
Otherwise, you need to create it. The physical file is crea-
ted: WinDev/WebDev manages the list of files used at a given
time by the program.
• by programming. When a function operates on a file, if the file is not in the
• If "Create the data files automatically if not found at list of files used, it is opened automatically.
opening" is checked (in the description window of the An unlimited number of files can be open at the same
project, "Project .. Project description", "Files" tab). time.
Note: the physical file is not created when the analysis is If a closed file is used later in the program, it will be reo-
created, or by the setup procedure. pened automatically the same way.
Two functions can be used to create a file: This is true for any new file used.
•HCreate to create an empty file (and possibly the
Tome1_2.book Page 500 Vendredi, 28. mai 2010 5:50 17

500

1.1.3 Management of the HyperFileSQL data 1.1.4 Key management


files over 2 GB An item can be defined as unique key, multiple key or not
By default, the HyperFileSQL engine allows you to a key when describing a file.
manage large data files (up to 2 gigabytes). If the item is described as key (unique or with duplica-
The files exceeding 2 gigabytes require a specific configu- tes), the item can be used as a search criteria for the file.
ration in the data model editor and in the hardware. Depending on the item type, the key can be a text key or a
Indeed, to manage the data files exceeding 2 gigabytes, numeric key.
you must use: General definitions
• An operating system that supports files exceeding 4
gigabytes. The following operating systems do not sup- • The text, date and time type items, when defined as
port files exceeding 4 gigabytes: Windows 95, Win- keys, are called text keys.
dows 98, Windows Me. • When they are defined as key, the integer (short, long,
• A file system that supports files exceeding 4 gigabytes etc.), real (simple, double, etc.), radio button, combo
(NTFS for instance in Windows) box and list box type items are called numeric keys.
• A composite key is a key made of text and/or numeric
WinDev: this configuration is required both on the com- items.
puter where the data files are installed and the compu- Note: a composite key can be made of the file identi-
ters that access these files. Therefore, a computer fier.
running Windows 98 cannot access a data file exceeding
2 gigabytes installed on Windows 2000. Unique key and duplicate key
WebDev: this configuration is required both on the Web Definitions
server and on the data server.
A key is unique when the value of the item is unique for
WinDev Mobile: since memory capacity is limited on a each record in the file.
Pocket PC, this option is not supported.
A key is called a duplicate key when the value of the item
Configuring the data files can be the same for several records in the file.
To manage the data files exceeding 2 gigabytes: Checking the uniqueness of a key
1. Display the description of the data file ("Structure When HSetDuplicates is enabled:
of files .. Description") • Automatically check the uniqueness of the key (WinDev
2. In the "Details" tab, select the "Manage files only). When a key with duplicates appears after adding
Part 8: File management

over 2 GB" option. or modifying a record, a message automatically comes


Attention: these data files can only be used from a com- up and offer the user to modify the item that’s causing
puter running an operating system that supports files a problem. This automatic management mode can be
exceeding 4 gigabytes. customized. See the online help for more details.
Using data files over 2 GB • Check by programming. Simply test the HErrorDuplica-
tes function after the function that may create duplica-
Dynamic description of data files tes.
During the dynamic description of a data file (via the // Add a record (WinDev)
HyperFileSQL properties and HDescribeFile), the Huge- FileToScreen
File property enables you to configure the management HAdd(CUSTOMER)
mode of the data file’s size. IF HErrorDuplicates() THEN
Info("A record exists""+…
WLanguage property "exists","It is not added")
End
HugeFile: the HugeFile property lets you configure the
maximum size of your data files. You can: // Add a record (WebDev)
• Find out whether a data file is configured to contain FileToPage
more than 2 GB of data (file defined in the data model HAdd(CUSTOMER)
editor or dynamically). IF HErrorDuplicates() THEN
• Modify the characteristics regarding the size of a data Info("A record exists""+…
file (file defined dynamically only). "exists","It is not added")
End
Caution: reindexing data files over 2 GB make take some
time. Note: if the modified or added key is not unique, the func-
tions that may create duplicates are as follows: HAdd,
HModify or TableSave.
Tome1_2.book Page 501 Vendredi, 28. mai 2010 5:50 17

501

Dupon hGeneric 8 True Dupon does not


If HErrorDuplicates is not called, error 10 (duplicates exist but the
error) will be generated with the next call to a file mana-
search is a gene-
gement function. This error cannot be ignored: all the files
ric search and
are closed and the program’s execution is canceled.
Dupond is found
Duplicate management is enabled by default. (among others).
If duplicates management is disabled, the checking of Dupon 8 False Dupon does not
the key uniqueness is not managed. exist.
If the management of referential integrity is enabled Montgo- 4 True Montgomery
(HSetIntegrity), duplicates management is automatically mery exists.
activated.
Identifier: WinDev/WebDev offers automatic file identi- Note: you can define specific search criteria when descri-
fier management (unique key). The identifier manage- bing the key in the data model editor. You can define
ment is discussed in the ’Identifier management’ whether the item will be:
chapter, page 539. • Case sensitive (uppercase/lowercase): for instance PC
SOFT would be different from PC Soft.
Search on text type keys • Accent sensitive: for instance, "été" would be diffe-
• The search criteria is the name of the key (item) used rent from "ete".
for the search. • Punctuation sensitive (coma, period, etc.): for ins-
tance, "C.E.O." would be different from "CEO".
• The search argument is the value sought for this key.
These various criteria will be applied when a search is
• The argument can be: performed on the key item.
- A complete value, it is called an exact-match search.
- A partial value, it is called a generic search. Search on numeric keys
• Example: When a generic search is perfomed on Numeric key encoding
"Martin" (NAME item), all the records whose Name Numeric items (int, long int, real, etc.) are stored in files
item starts with "Martin" will match the search. There- according to the binary format specific to the language
fore, the record containing "Martinez" will match the used.
search (HFound returns True). However, in index files, numeric keys are encoded diffe-
When an exact-match search is performed on rently (to simplify and speed up searches).
"Martin" for the NAME item, HFound returns True only

Part 8: File management


Example: if the encoding for an integer is the one from
for the records whose item exactly matches "Martin". the language, the negative value is "lexicographically"
greater than the positive value (the first bit, the sign bit,
is set to "1"). In the index file, the encoding restores the
right order, that is the encoding of a negative value will
be "lexicographically" lower than the encoding of a
positive value.
Numeric key management
Important: a search performed on a numeric
key is always performed as an exact-match
search, that is the search will be performed on
the item’s full length.
Example: a zip code can be a text item or a long integer
item. Therefore the key will either be a text type key or a
numeric type key. In the case of a text type key, you can
Value Options Cur- HFound Explanations search on a partial zip code - the first 2 characters for
sought rent returns example. This type of search will not be possible in the
rec case of a numeric type key.
Durand 1 True Durand exists.
Dupuis 1 False Dupuis does not
exist. Points to the
first higher value
(Dupont).
Tome1_2.book Page 502 Vendredi, 28. mai 2010 5:50 17

502

Tips ponents. No specific programming is required.


• Text type keys are easier to use than numeric keys but Adding a record containing a composite key into a linked
they take more room in the data file and in the index file
file.
When a record containing a composite key is added to a
• Real type numeric keys must be avoided. The rounding linked file, the value of the key must be built. Indeed, in
of values specific to real encoding in the language may the linked file, the composite key is not considered as a
mess up the search. composite key but as a binary key. Therefore, a value
must be assigned to it.
1.1.5 Composite key management This value can be assigned:
A composite key is a key item containing several other • directly. For example, a record was added to Customer
items. These items can be numeric or text type items. file. To add the value of the key into the linked file, just
A composite key simplifies the searches performed on perform a direct assignment:
several criteria at a time. Link.NameDate = Customer.NameDate
Composite keys are binary items. Their value cannot be • through HBuildKeyValue. This function enables you to
directly displayed (in a trace or a control). build the value of the composite key according to its
components.
Creating a composite key
Building the value of a composite key to implement a
A composite key is directly created in the data model edi- search or a filter
tor.
When a filter or a search is implemented on a composite
To create a composite key in a file description: key, the value of the composite key must be defined (to
1. Display the description of the file items ("File define the lower bound and the upper bound of the filter
Structure .. Items"). for instance).
2. Click . A screen used to build the composite
key is displayed. There are several solutions for building the value of a
3. The list of items found in the file is displayed in the composite key:
table on the left. Double-click the items that must be • Using HBuildKeyValue
used in the composite key. These items are displayed • Using an array of values
in the right-side table. • Using a syntax that is compatible with earlier versions.
4. If needed, reorganize the items containing the
composite key. Caution: the item order is very impor- Using HBuildKeyValue
Part 8: File management

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

Example: Example: the variable for the "CUSTNAME" item (custo-


MyCompositeKey = Complete(… mer name) of the "CUSTOMER" file is named CUSTO-
Customer.CustomerName, … MER.CUSTNAME
Dimension(Customer.Name,hMinVal + … Note: do not declare file variables. All the record’s varia-
Complete(Customer.FirstName, … bles are automatically described and defined by Win-
Dimension(Customer.FirstName),hMin- Dev/WebDev.
Val)
Composite keys case
Properties for managing composite A composite key can be read directly without going
keys through the item it is made of. Simply read the variable
The following properties are used to manage the compo- just like any item. This operation is not recommended.
site keys by programming: For example, NAMEDATE is a composite key made of the
NAME and DATE items.
Binary Identifies a binary item (composite Info(INVOICE.NAMEDATE)
key, binary string, binary memo) // Display the composite key value
CompositeKey Checks whether the specified item is Note: writing to a composite key has no effect. This is
a composite key because the composite keys are rebuilt for each write
operation.
Component Returns the name of the nth compo-
nent of a composite key Record pointed to and record loaded
into memory
KeyExpression Returns the expression of a compo-
site key The notions of record pointed to and record loaded into
memory are fundamental. It is important to understand
NbComponent Returns the number of components them well to properly use the file management functions.
in a composite key The record that is pointed to corresponds to the last
record read based on the specified key. The notion of
Composite keys can be used to perform: record being pointed to is relative to a key.
• exact-match searches, The record loaded in memory corresponds to the file
• generic searches, record whose values are currently loaded in the program
variables.
• filters.
At a given time, there can be only one record loaded in

Part 8: File management


See the online help for more details. memory for a file and only one record pointed to for this
same file.
1.1.6 Accessing file records However the record the index is pointing to and the record
File record and file variable loaded in memory can be different.
A file is made of items. The items are defined when the
file is described. Special case: when context management is activated in
In the programs, each item is handled through a variable windows or pages, each context lets you manage diffe-
(called file variable) that has a set name and type. rent records in the same file. There will be only one record
loaded in memory per context.
This variable name is made of the file’s logical name and
the item’s name Reading a record, automatically or on demand, initiali-
<FileName>.<ItemName> zes the different variables of the file with the record loa-
ded in memory.
Writing a record corresponds to writing the file variables
into the file when saving the record stored in memory.
Tome1_2.book Page 504 Vendredi, 28. mai 2010 5:50 17

504

File reading mechanism


Lets look at an example that illustrates how to read a file according to a key.
The "PEOPLE" file is made of two key items:
"CODE": customer number.
"FIRSTNAME": customer first name.
"PEOPLE" contains the following 8 records:
Record number CODE FIRSTNAME
1 17 Fabian
2 12 Edgar
3 18 Charlotte
4 05 Louis
5 01 John
6 20 Lara
7 09 Tommy
8 14 Mary
In this file, here is how the record loaded in memory and the record being pointed to change during the program’s
execution:
Functions Record pointing Record pointing to Record in memory
to CODE FIRSTNAME
Beginning of the program ? ? ?
HReadFirst(PERSON,CODE) rec.5 ? rec.5
HReadFirst(PERSON,NAME) rec.5 rec.3 rec.3
HReadNext(PERSON,CODE) rec.4 rec.3 rec.4
HReadNext(PERSON,CODE) rec.7 rec.3 rec.7
Part 8: File management

HreadNext(PERSON,NAME) rec.7 rec.2 rec.2


HreadNext(PERSON,NAME) rec.7 rec.1 rec.1
HreadNext(PERSON,NAME) rec.7 rec.7 rec.7
HReadNext(PERSON,CODE) rec.2 rec.7 rec.2
Etc. … … …
Tome1_2.book Page 505 Vendredi, 28. mai 2010 5:50 17

505

Notes index with HChangeKey after HRead: HReadNext and


• The following table shows the record on which the func- HReadPrevious can be used to browse through the file
tions that position a record operate: the record loaded using the key set by HChangeKey.
in memory or the record pointed to. The functions not 2. Read operation according to a key
listed in the table do not use a record.
HReadSeek, HReadSeekFirst,
Functions positioning Rec loaded in Rec. HReadSeekLast, HReadPrevious HReadNext, HRaed-
memory First, HReadLast read a record based on the key speci-
a record point
fied as parameter. A file can be read based on several
HAdd x keys.
HChangeKey x
HLast x Seeking a record
HWrite x
HRead x HReadSeek, HReadSeekFirst,
HReadLast x x HReadSeekNext, HReadPrevious, HReadNext, HSeek,
HSeekFirst, HSeekLast, HPrevious, HNext let you seek a
HReadPrevious x x record:
HReadFirst x x • HReadSeekXX (o HSeekXX) start the search.
HReadSeek x x
• HReadNext, HReadPrevious (or HNext, HPrevious)
HReadSeekLast x x access the next or previous record.
HReadSeekFirst x x If the record corresponding to the search is found,
HReadNext x x HFound returns True. Otherwise, it returns False.
HModify x When seeking a record according to a key, you need to
HPrevious x test HFound.
HFirst x
File browse
HSeek x
HSeekLast x 1. Principle
HSeekFirst x The notions of next record and previous record are rela-
HCross x tive to the record the index points to for a specific key.
HRestorePosition x In order to be able to read the next or previous record, the

Part 8: File management


HSavePosition x record the index points to must be initialized. Otherwise
HNext x error 19 will be generated. The following functions initia-
lize the record the index points to: HReadSeek,
HDelete x HReadSeekFirst, HReadSeekLast, HReadFirst, HRea-
dLast, HSeek, HSeekFirst, HSeekLast, HLast, HFirst,
Reading a record
HChangeKey.
1. Read functions The files are accessible through the values of the keys
HReadSeek, HReadSeekFirst, sorted in ascending order. However file can be browsed
HReadSeekLast, HReadFirst, HReadLast all read a in both directions (ascending, descending).
record. These functions load a record into memory and
point to a record in the index. Caution: the sort directions of the keys as well as the
search characteristics (accentuation, case and punctua-
HRead reads a record without pointing to it in the index. tion) specified in the analysis are taken into account.
HReadNext and HReadPrevious read a record if this
record has been pointed to by HReadSeek, HReadFirst or The first record of a file according to a key is the one (or
HReadLast. one of the ones) with the smallest value for the key. it is
Important: HRead lets you read a record based on its reached by using HFirst or HReadFirst.
record number, the record pointed to is not initialized. The last record of a file according to a key is the one (or
Therefore HReadNext and HReadPrevious cannot be cal- one of the ones) corresponding to the largest value forthe
led immediately after HRead. key. It is reached by HLast or HReadLast.
However, you can initialize the record pointed to in the
Tome1_2.book Page 506 Vendredi, 28. mai 2010 5:50 17

506

can replace the following algorithm:


N°. Last name First Position RecNum is int
Rec name // Store current. record # of
1 GONZALEZ Speedy //Customer
2 MOUSE Mickey RecNum=HRecNum(CUSTOMER)
3 TALON Achille first based on FIRST- // Move relatively to the key
NAME //CUSTNAME
HSeek(CUSTOMER,CUNAME,…
4 LAGAFFE Gaston
CUSTOMER.CUNAME)
5 DALTON Avrell first based on LAST- While not HOut() and …
NAME RecNum<>HRecNum()
6 VAILLANT Michel last based on LAST- HNext(CUSTOMER,CUNAME)
NAME End
7 ONO Yoko last based on FIRST-
NAME
8 MALTESE Corto 4. Browsing when there is duplicates
In case of equality on the value of a key (duplicates), the
The record before or after the record the index points to order of the records is not significant. The first record
are reached by the following functions: HReadNext, returned will be one of the records corresponding to the
HReadPrevious or HNext, HPrevious. sort argument.
Example of ascending browsing: HReadNext or HReadPrevious enable you to get all the
HReadFirst(CUSTOMER,Name) homonyms.
While Not HOut() Important: no hypothesis can be made as to the real
PrintLabel() location of the record. A HReadNext loop does not let you
HReadNext(CUSTOMER,Name) find out the order in which the homonyms were inserted
End in the case of a search value with duplicates
5. Browse using filter
2. Positioning outside the file You can define a filter to select records. This filter can:
If after one of the HReadLast, HReadPrevious, HRead- • browse through the file using set bounds and select
First, HReadSeek, HReadNext and HLast, HPrevious, the records corresponding to the filter. The bounds
HFirst, HSeek, HNext functions is run, the record the are set according to a file key.
Part 8: File management

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

Notes Before deleting or modifying a record, you need to initia-


• The filter can be used with external language (WinDev lize the record loaded in memory using HRead, HRead-
only). First, HReadLast, HReadNext, HReadPrevious or
• Only one filter can be defined per file at a given time. HReadSeek, HReadSeekFirst, HReadSeekLast, othe-
rwise an error is generated (see appendix).
• A filter is only active:
- on the search key on which it was defined, Important: In file tables, to delete a record, you need to
- on the search key returned based on the selection use TableDelete (and not HDelete). To write a record,
condition. you need to use TableSave (instead of HAdd, HModify,
…).
• If a filter is active, HFirst, HReadFirst, HReadFirstLock,
HReadFirstNoLock return: Note: HCopyRecord lets you copy the current record of a
- the first record corresponding to the filter, file into the current record of another file with the same
- HOut() set to True if no record corresponds to the fil- structure. See ’Managing aliases’, page 535, for more
ter. details.
In the case of a filter on a key with set bounds, the Assigning file variables and window or
current record is then the first record that has a key page controls
greater than <MinBound>, if it exists. Remember that the data from a file can be presented in a
• If a filter is active, HLast, HReadLast, HReadLastLock, window or a page:
HReadLastNoLock return: - in a form: one record per window or page
- the last record corresponding to the filter, - in a table: one record per row in the table
- HOut() set to True if no record corresponds to the fil-
ter. Form presentation
In the case of a filter on a key with set bounds, the If the controls found in a window or in a page are linked to
current record is then the first record that has a key items, the values of the controls can be assigned to the
greater than <MaxBound>, if it exists. file variables (or conversely) via a single function:
• If a filter is active, HNext, HReadNext, HReadNextLock, • ScreenToFile/ PageToFile assigns the value of the con-
HReadNextNoLock return: trols on the screen to the corresponding file variables
- the next record corresponding to the filter, • FileToScreen/FileToPage assigns the value of the file
- HOut() set to True if no more record corresponds to variables to the corresponding controls on the
the filter. screen.
In the case of a filter on a key with set bounds, the The file variables can also be assigned individually. For
current record is then the first record that has a key

Part 8: File management


example:
greater than <MaxBound>, if it exists.
NAME=CUSTOMER.NAME
• If a filter is active, HPrevious and HReadPrevious CUSTOMER.CITY=CITY
return:
- the previous record corresponding to the filter, Important
- HOut set to True if no more record corresponds to the • Assigning some file variables does not perform any
filter. modification in the file: the modification is only perfor-
In the case of a filter on a key with set bounds, the med when the record is written (using HAdd, HModify,
current record is then the first record that has a key …).
smaller than <MaxBound>, if it exists.
• If several controls are linked to the same file item, File-
Adding, deleting and ToScreen/FileToPage and ScreenToFile/PageToFile
modifying a record may behave randomly.
You can add, modify or delete a record from a file:
Table presentation
•HAdd adds a record,
ScreenToFile/PageToFile and FileToScreen/FileToPage
•HWrite writes a record, should not be used in file tables.
•HModify modifies a record, In tables, assigning table columns with the values of the
•HCross and HDelete delete a record. file items (or vice versa) is managed automatically.
HAdd, HModify, HCross and HDelete use the record loa- The management of files in tables, called "file tables" is
ded in memory special. It is explained in the online help.
Tome1_2.book Page 508 Vendredi, 28. mai 2010 5:50 17

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

1.2 FoxPro xBase format files


1.2.1 Overview leSQL functions’).
A module for Native xBase/FoxPro Access is available The management of the xBase/FoxPro files is similar to
with WinDev and WebDev. This Native Access allows you the management of the HyperFileSQL files except for the
to handle xBase files from a WLanguage program without specified limitations (see the online help)
using an external driver.
Required configuration 1.2.3 Importing the structure of the files
The following files are supplied with WinDev/WebDev: The import steps
WD150B.DLL. This file is required by the Native Access to
This import is performed in the data model editor via
the xBase/FoxPro files in order to operate with a HyperFi-
"Structure of files .. Import file/table descriptions". The
leSQL Classic analysis.
wizard starts.
1.2.2 Using the native xBase/FoxPro access 1. Select the database’s type: FoxPro/xBase. A con-
nection to the xBase/FoxPro database is automati-
To use the native xBase/Fox Pro access in your WinDev or cally established and associated with the files
WebDev applications: imported into the analysis. This connection will be
1. Import, if needed, the description of the xBase/ used to handle the xBase/FoxPro data file by pro-
FoxPro files into the WinDev or WebDev analysis. gramming.
2. Program with the "HyperFileSQLe" functions of
WLanguage (see ’Programming using the HyperFi-
Tome1_2.book Page 509 Vendredi, 28. mai 2010 5:50 17

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 :

Part 8: File management


model editor visa "Structure of files .. Synchronize the // LASTNAME, string of 20 characters
analysis with the external databases". A wizard starts, // FIRSTNAME, string of 20 characters
allowing you to: // AGE, integer on 3 digits
// BALANCE, real on 10 digits and
• analyze the differences for the imported tables // 2 decimals
• analyze the differences for the imported tables. // MARRIED, boolean
// DOB, date
1.2.4 Important programming points // INFO, text memo
Managing xBase files is similar to managing HyperFi- HDBDescribeFile("CUSTOMERDB","CD",…
leSQL files except for the points mentioned in this para- "C:\FILE\CUSTOMER.DBF")
graph. HDBDescribeField("LASTN,C,20")
HDBDescribeField("FIRSTN,C,20")
New features regarding the management of xBase: HDBDescribeField("AGE,N,3,0")
• Management of an automatic identifier HDBDescribeField("BALANCE,N,10,2")
• Ability to use HIndex. HDBDescribeField("MARRIED,L")
• Managing expressions in HFilter HDBDescribeField("DOB,D")
HDBDescriberField("INFO,M")
• Ability to use HChangeDir
HDBCreation()
• Using the native xBase access with non-latin character
sets. Opening files that were described dynamically
Management of FoxPro files: An xBase file is not automatically opened: you need to
open it using HDBOpen before it is first used unless it was
• Support of the VFP format created using HDBCreation (which opens and creates
• All the index formats are supported (including the the file).
indexes in VFP format corresponding to the .CDX exten-
sion). The indexes are read and modified.
Tome1_2.book Page 510 Vendredi, 28. mai 2010 5:50 17

510

Opening an index window is:


HDBOpen opens the data file but not the index file(s). //Read the orders
Therefore, you must open all the index files required for HReadFirst(ORDERS, Date)
using the data file with HDBIndex. IF HOut() = False THEN
If the index files are not opened, they will not be updated //Search for the corresponding product
after a deletion, a modification or an addition. HReadSeek(PRODUCT, ProdNum, …
ORDERS.ProdNum)
Links between xBase or FoxPro files FileToScreen
The links are not automatically managed. They must be END
managed by programming. Therefore, to access a record
in the linked file, you must find the corresponding record Using the native xBase/FoxPro access with non-latin
according to the link key (HReadSeek). character sets
Example: A window displays the customer orders, the To use the native xBase access with non-latin character
"ORDERS" file contains the product number, the "PRO- sets, a standard OEM/ANSI conversion must be perfor-
DUCT" file contains the product caption and the product med by the native access . To do so, specify the following
number. For example, the initialization process of the string in the extended information:
OEMTOANSI=WINDOWS;

1.3 Data files found on a Pocket PC


1.3.1 Handling a HyperFileSQL Mobile data- 1.3.2 Handling a CEDB database
base Overview
Overview The CEDB format is a database format for Pocket PC.
The HyperFileSQL Mobile format is the database format A CEDB database corresponds to a ".CDB" file. A CEDB
supplied with WinDev Mobile. This database format is database can contain several data files (also called
compatible with WinDev, WinDev Mobile and WebDev. It "tables").
is a freely distributable Relational DBMS. Two types of CEDB databases are available:
This format is identical to the HyperFileSQL format of Win- • the standard CEDB databases, that correspond to the
Dev (".WDD" file, data files, …). databases found by default on the Pocket PC. These
Part 8: File management

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

Part 8: File management


PC. This database can be handled by a WinDev applica-
tion for Pocket PC. 1.3.3 Functions for handling a CEDB database
If you own WinDev, you also have the ability to create a The following functions are used to manage a CEDB data-
WinDev application used to directly handle this standard base:
Pocket PC database.
cdbAdd Adds the record found in memory into a data file
cdbCancelSearch Cancels the current search criterion
cdbCol Returns information about a column found in the current record (value, type, identifier or
name)
cdbDateTimeToInteger Transforms a DateTime variable into a value compatible with a Date and Time column (unsi-
gned 8-byte integer)
cdbWriteCol Modifies the value of a column for a record in memory
cdbOut Enables you to find out whether the record on which you want to be positioned is outside the
file
cdbIntegerToDateTime Transforms the value of a Date and Time type column (unsigned 8-byte integer) into a Date-
Time variable
cdbClose Closes a database (".CDB" file) previously opened by cdbOpen
cdbListFile Returns the list of files found in a CEDB database
cdbRead Reads a record in a file according to a given record number
cdbReadLast Points to the last record of a file and reads this record
cdbReadPrevious Points to the previous record in a file and reads this record
Tome1_2.book Page 512 Vendredi, 28. mai 2010 5:50 17

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,

2.1 Alias management


The aliases are used to handle: To use the Customer2000.Fic file, you must "copy" the
• several physical files that have the same description in description of the CUSTOMER file from the analysis: sim-
the analysis, ply create an alias with HAlias. The line of code is as fol-
• several logical files described in the analysis that are lows:
using the same physical file. HAlias(Customer, Customer2000)

2.1.1 Several physical files with identical logical


description
For example, you can handle at the same time
• the Customer2000.fic, which contains the customer
backup for the year 2000.
• the Customer.fic file that contains the customer refe-

Part 8: File management


rences for the current year.
These two files have the same logical description in the
analysis: the CUSTOMER file. By default, the description
of the CUSTOMER file found in the analysis is linked to
the Customer.fic file.

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

HChangeDir Modifies the access path to a data file


slows down the execution considerably.
• Window or page editor: controls and tables cannot be
2.1.4 Create an alias on what? associated directly with items in file aliases. You need
You can create and use aliases for the following ele- to assign the controls one by one through program-
ments: ming.
• Data file described in the analysis Note: to redefine the links of the controls by program-
• Data file described dynamically ming, you can use either the FieldAlias function, or the
FileLink property.

2.2 Managing the NULL value in HyperFileSQL


WinDev and WebDev enable you to manage the Null 2.2.1 How to manage the Null value in your
value in the items found in the HyperFileSQL data files items?
and for all the other types of accesses (Native Access, Several methods allow you to manage the null value in
OLE DB, …). your files:
When calculations are performed on the file records, the • In the data model editor:
records containing a Null item will be ignored. For exam-
ple, if a query calculates the average grade of students •of the "NULL supported" option available in the
for the quarter, only the grades of the attending students "Info" tab of the file description. This option is used
will be taken into account. If a student is not attending, to specify whether the management of NULL is sup-
his grade will correspond to the Null value. ported by this file. In this case, the NULL value can be
managed for the different file items.
Tome1_2.book Page 515 Vendredi, 28. mai 2010 5:50 17

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

Part 8: File management


75205 or higher, sets the Null property to False, even if
the item has been set to Null by an application using Win- average grade of students for the 2003 French class. If
Dev. one of the grades corresponds to the NULL value, this
grade is ignored.
2.2.2 How can I use the NULL value in my SELECT Grades.Course AS Course,
applications? Grades.Date AS Date,
LEFT(Grades.Date,4) AS Year,
How do I save a NULL value in an item? AVG(Grades.Grade) AS
the_average_Grade
1. Check "NULL supported" when describing the file FROM Grades
in the data model editor ("File Structure .. Descrip- WHERE Grades.Course = ’French’
tion", "Info" tab). AND Grades.Grade IS NOT NULL
2. Generate the analysis. AND LEFT(Grades.Date,4) = ’2003’
3. if the user has not entered any value in a control GROUP BY Grades.Course, Grades.Date,
associated with an item: to assign NULL to this item LEFT(Grades.Date,4)
for the current record, you need to use the Null pro-
perty after ScreenToFile.
Example: the Grade edit control has the "NULL if empty"
Tome1_2.book Page 516 Vendredi, 28. mai 2010 5:50 17

516

2.3 File protection and encryption


2.3.1 The protection possibilities program can:
There are several ways of preserving data confidentiality • request the password from the user,
and security when storing the data files. These can be • include the password in the program or read it from a
applied to the different types of files: data files (.Fic), configuration file.
index file (.NDX), memo file (.MMO). You can:
We recommend giving a password with at least 4 charac-
• not encrypt the files,
ters. The size of a password is unlimited.
• encrypt the file on 128 bits; only the users that know
The password can be passed to the files according to two
the password will be able to access it in read and write
methods:
modes. The password is managed in the program at
the time the file is accessed. • by passing the password as a parameter to HOpen,
HCreate, HCreateIfNotFound.
The level of protection for the file is chosen at the time of • by using HPass before opening or creating the file.
the file description in the data model editor. It cannot be
modified by programming. When WinDev/WebDev interprets the HCreation or
If strong security is activated, the file’s password will be HCreationIfNotFound functions, the password must have
requested for each automatic data file modification. been sent by HPass if it is not specified in the functions’
parameters.
To modify the level of protection, you must modify the file
description. HPass(CUSTOMER, "Secret code")
If the password is invalid, HErrorPassword returns True.
To summarize, a file can be:
• not protected, Notes
• password protected with data encryption, • The files from an analysis can have identical or diffe-
rent passwords.
• password protected with index encryption,
• Each file is encrypted according to its own password.
• password protected with memo encryption.
• Caution: You cannot retrieve a "forgotten" password.
2.3.2 Managing encrypted files If the password is lost, the file cannot be accessed
anymore.
The password associated with a file must be sent right
before the creation or the opening of the data file. The
Part 8: File management

2.4 Managing an identifier


2.4.1 Automatic management You can manage your own identifier by programming,
Usually, each file record should contain one item that has without using the automatic identifier offered by WinDev/
a unique value for this file. This item, called identifier, WebDev.
enables you to identify the record in the file. This is a uni-
que key type item. 2.4.2 Manual management
The record number does not enable you to identify a Here is how to manage an identifier manually:
record. This is because it is not fixed; for instance, it can 1. When describing the file, if it does not have a uni-
be modified after a reindexing or compressing operation. que key, create an integer and unique key type item.
2. When adding a record, the value of this item is
WinDev/WebDev also lets you manage an automatic managed by a process: simply increase the value of
identifier: the identifier is chosen when describing the file the item for each record created.
in the data model editor.
In this case WinDev/WebDev takes care of everything: it Example of manual identifier management: this simple
creates the item automatically and assigns this item management can be used in a single-computer applica-
when adding the record into the file. tion for example. For more advanced examples, see the
chapter about replication.
Important: never modify the value of this identifier othe- HReadLast(INVOICE,INVNUM)
rwise you could compromise the records’ uniqueness. ScreenToFile
INVOICE.INVNUM=INVOICE.INVNUM+1
HAdd(Invoice)
Tome1_2.book Page 517 Vendredi, 28. mai 2010 5:50 17

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.

2.5 Automatic control of the referential integrity


The referential integrity consists in checking that: in the following paragraph.
• if a record is deleted from the parent (or owner) file, the • Referential integrity management must have been ena-
corresponding records are also deleted from the child bled in the project with HSetIntegrity (True) in the pro-
(or member) files, ject initialization code.
• if a record is added to a child file, a corresponding
record exists in the parent file, 2.5.2 Definitions
• if a record is modified in a parent file, the unique key is The definitions of the different types of links available are
not modified, presented in the ’Characteristics of the links defined in
•… an analysis’ chapter, page 73.

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

Part 8: File management


automatic check
• "CUSTOMER" containing the customer information.
The identifier is the customer number. The referential integrity automatic check can be used
only in WLanguage. It cannot be used:
• "ORDERS" is linked to "CUSTOMER" by the customer
number. • for xBase format files,
• "ORDERS" is linked to "PRODUCT" by the product • with external languages.
number. Enabling the integrity check mechanism
When deleting a customer from "CUSTOMER", if the By default, the referential integrity automatic check
orders corresponding to the customer are not deleted mechanism is disabled. It can be enabled:
what may happen? • at the project description level,
Customer 1000 is deleted (but not his or her orders) and • by programming.
this is the last one in the list. When adding a new custo-
mer with number 1000, this customer will have orders Activation at the project level
that don’t belong to him or her but belong to the pre- When describing the project in the window editor or the
viously deleted customer! page editor ("Project .. Project description"), you can
define whether the automatic integrity and/or duplicates
The referential integrity checks automatic whether inte- check must be enabled.
grity is preserved or not and therefore prevents inconsis-
tency in your databases . This choice does not require any additional lines of code
in your project.
To use the automatic referential integrity check feature:
• Links must be described in the data model editor or Activation by programming
using hDescribeLink. The referential integrity control mechanism can be ena-
• The link type must allow automatic referential integrity bled by HSetIntegrity (True) or disabled by HSetIntegrity
management. The different types of links are described (False).
Tome1_2.book Page 518 Vendredi, 28. mai 2010 5:50 17

518

Caution: Single computer example (automatic lock management


The activation of the referential integrity automatic and integrity management)
check mechanism implicitly enables the duplicates HSetIntegrity(True)
management mechanism (HSetDuplicates). // Delete the customer whose number is
You cannot disable the duplicate control mechanism if Num
the integrity control is enabled (HSetIntegrity (True)). HReadSeekFirst(CUSTOMER,IDCusto-
mer,Num)
Notes:
IF HFound() THEN
• The integrity control mechanism corresponds to sear- IF HDelete(CUSTOMER) then
ches performed into linked files when calling functions Info("Customer deleted")
that write into files (HAdd, HModify, HDelete, HCrss, Otherwise
TableSave, TableDelete). This mechanism does not IF HErrorIntegrity() then
modify the context (positioning) of the base file and Error("Cannot"+…
the linked files. "delete customer",…
• Referential integrity is not tested when overwriting a file ’there are still some
with HCreate. It is better to use HCreationIfNotFound orders")
in order not to overwrite files. End
Otherwise
Checking the integrity Error("Customer not found")
When the integrity control mechanism is enabled (HSe- End
tIntegrity (True)), HErrorIntegrity must be tested after
each function that writes to the file: HAdd, HModify, Network example
HWrite, HDelete, HCross, TableSave, TableDelete. HSetIntegrity(True)
HErrorIntegrity returns True if an integrity error occurred. HLockFile(CUSTOMER)
HErrorInfo returns the error detail: If HErrorLock() then
Info("Cannot lock file")
If HErrorIntegrity is not called, error 15 (Integrity error)
Otherwise
will be generated automatically during the next call to a
HReadSeekFirst(CUSTOMER,…
file management function. This error cannot be ignored: IDCustomer, Num)
all the files are closed and the program’s execution is IF HFound() THEN
canceled. IF HDelete(CUSTOMER) then
Info("Deletion OK")
Part 8: File management

Otherwise
Error(HErrorInfo())
End
End
End
Tome1_2.book Page 519 Vendredi, 28. mai 2010 5:50 17

519

Summary table of the integrity checks performed by WinDev/WebDev


The table below summarizes, for the functions requiring integrity control (HCross, HDelete, HAdd, HWrite and HMo-
dify), the integrity check performed by WinDev/WebDev depending on the link type.
Complement link Shared link Shared link Shared link Optional link Parallel link
(0,1) - (1,1) (x,n) - (1,1) (1,n) - (0,1) (0,n) - (0,1) (0,1) - (0,1) (1,1) - (1,1)
HCross 1 1 1 - - Dev.
HDelete
HAdd 2 2 Dev - - Dev
HWrite
HModify 3 and 4 3 and 4 5 - - Dev
Legend:
1: when deleting an owner, check there is no linked members
2: when adding a member, check the existence of a linked owner
3: when modifying a member, check the existence of a linked owner (in the case where the value of the linked key changes)
4: when modifying an owner, check there are no members linked to the old owner (in the case where the linked key changes
value)
5: when modifying a member, check there are no owners linked to the old member (in the case where the linked key changes
value)
- : no check is needed
Dev.: the developer is responsible for performing the check

2.6 Managing "memo" files

Part 8: File management


2.6.1 Text memo and binary memo Caution: HCross and HDelete have different actions on
"Memo" files can be managed in WLanguage. "memo" files and on data files:
"Memo" files complement the data files. They allow you • HCross delete the record from the data file but not
to associate things such as long texts, images, and from the memo file. Indeed, HFree does not free the
sounds with the data file’s records. crossed records from the "memo" files. We do not
A "memo" file is described and created at the same time recommend using HCross with "memo" files.
as the data file. • HDelete deletes the record from the data file and the
"memo" file. To delete a record in a "memo" file, you
To create a "memo" file: need to use HDelete.
1. Describe the file in the data model editor.
2. Create a "text memo" type item for long texts or a A function lets you activate the "memo" file manage-
"sound, image, binary" type item to store images or ment: HSetMemo
sounds. This function enables or disables the management of
3. Generate the analysis. memo type items. You can manage all the memos of a file
or just a specific memo item of a file. Memo management
In WLanguage, the data file and the "memo" file evolve is enabled by default.
in parallel:
• HCreation and HCreationIfNotFound create the data If a process on a file does not use the "memo" file, it is a
file, the index file and the "memo" file (<File- good idea to disable the "memo" file management to
Name>.MMO) empty, speed up the process.
• HAdd and HModify write in the data file and in the For example, when modifying the "TotalSales" item of
"memo" file, all the records in a "Customer" file, simply disable the
memo management before the process, then re-enable
• the read functions read the record from the data file it.
and from the "memo" file.
Note: Memo files can be encrypted and/or compressed.
Tome1_2.book Page 520 Vendredi, 28. mai 2010 5:50 17

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

Notes: •type of the memo,


• When an OLE file is modified through an OLE control, to •name, size, date and time of the original file,
assign the OLE file in a OLE binary memo item, you •free information provided when assigning the memo
need to: withHLinkMemo.
- save the OLE object with OLESave,

2.7 Reassigning files


2.7.1 Benefit by programming. It must be done before the file is crea-
The same file description can correspond to several phy- ted or opened.
sical files. The files have then:
2.7.2 Modifying the storage directory
• different physical names,
When the file is described in the data model editor, a
• the same name, but are stored in different directories. directory for storing data files and index files was selec-
You need to be able to modify either the name or the ted:
directory of the files. • either a hard coded directory,
The analysis files are described in a hard coded directory. • or the application’s directory.
In final use, the file setup drive could vary based on the
computer where the WinDev application is installed or The files can be stored in directories different from the
based on the server computer where the WebDev site is ones described in the analysis. Simply modify the name
deployed. You need then to be able to modify the file sto- of the directory in your program.
rage directory. HSubstDir or HChangeDir let you specify a directory dif-
The modification of the name and/or directory is done ferent from the one described in the data model editor.
Tome1_2.book Page 521 Vendredi, 28. mai 2010 5:50 17

521

The directory defined in the analysis is the requested file.


directory. This file is used by all the tools that handle the applica-
The directory of the file on the hard drive is the physical tion files or the site files, and mainly by the automatic file
directory. update, …
For example: Example: updating an application or a site with modifica-
// Files described on the tion of the analysis.
// C drive and installed on the S When updating a WinDev application or a WebDev site,
drive the automatic modification of the data files is automati-
HSubstDir("C:\Dir1",… cally run if the database’s structure is modified.
"S:\DataDirectory") This procedure uses the ".REP" file to locate the physical
HCreationIfNotFound(File1Name) files used by the application of by the site in order to
modify them.
2.7.3 Modifying the name of a file See ’ Automatic modification of the data files’, page 554
By default, a file is created with the name defined in the for more details.
data model editor.
Note: the .REP should not be modified "manually"
The file can be created with a different name. Simply except in exceptional cases, for example on the advice of
modify the name of the file by programming. the PC SOFT technical support.
HChangeName lets you specify a file name that is diffe-
rent from the one defined in the file description.
How is the .REP file managed in WinDev
The file name defined in the analysis is the logical name. Mobile?
The name of the file (or files) on the disk is the name on WinDev Mobile enables you to update a list of data files
disk (this name can be a long name if the operating sys- used by the application (equivalent to the .REP file in
tem supports long names). WinDev).
Note: the size of a file’s long name is 260 characters This list is saved in the Pocket PC registry, in the following
maximum (including the file path). key: "\HKEY_LOCAL_MACHINE\SOFTWARE\PC
SOFT\WD Mobile\15.0\<ApplicationName>\DATA".
2.7.4 Keeping trace of reassignments
The following details are stored for each data file used by
What is the .REP used for? the current application:
<MyProject>.REP is a file that contains the list of files • identifier (file GUID). This identifier can be found in the

Part 8: File management


used by the application or by the site (identifier, logical data model editor, in the file description window
name and full path of the physical file). ("Notes" tab).
The GUID of the analysis is the unique identifier of the • logical name.
analysis linked to the project, containing the description • full path of the physical file.
of the files. This identifier can be found in the data model This information is filled automatically by the HyperFi-
editor, in the analysis description ("Options" tab). leSQL Mobile engine.
The GUID of the file corresponds to the identifier of the For example:
logical file. This identifier can be found in the data model
editor, in the file description window ("Notes" tab).

This file is automatically created in the application or


site’s directory and it is filled by the HyperFileSQL engine.
The ".REP" file is used to easily locate the data files used
by the WinDev application or by the WebDev site.
The WinDev application or the WebDev site automatically
updates the ".REP" file but it seldom uses the ".REP"
Tome1_2.book Page 522 Vendredi, 28. mai 2010 5:50 17

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

2.8 Full-text search and index


2.8.1 Overview ".FTX" extension).
HyperFileSQL enables you to easily search for character Notes
strings in the data. This search (called "full-text") is used • To directly create a full-text index from a text item or
to search for a word or a set of words. from a text memo item, select the item in the descrip-
The text found in a HyperFileSQL database can be tion window of the items and click the link named
indexed without programming. These texts can be found "Create a full-text index on the item".
in "Text" items or in "Text memo" items. • The full-text indexes can be managed in the data files
An index can index one or more different items. The crea- described by programming: just use a FullText index
tion of the index can take the formatted texts into account description variable to describe the index, then HDes-
(RTF, HTML): the tags of these formats will be ignored cribeFullTextIndex to validate the creation of the index.
during the indexing. This gives you the ability to perform • The composition of an existing full-text index can be
searches on words stored in RTF or HTML documents. modified at any time: just click the "Edit index" button
The results of the full-text indexing are proposed accor- in the left part of the item description in the data model
ding to a relevance order ("ranking"). editor.
Caution: "Full-text" search is not a simple "contains" • To create a Full-text Index item, a generation of the
type search; punctuation is not taken into account. analysis and an automatic modification of the data are
required.
2.8.2 How do I perform a "full-text" search?
To perform a "full-text" search, you must: 2.8.4 How do I perform a full-text search?
1. Create a full-text index in the data files affected by The full-text searches are performed via queries: queries
this search. created in the query editor or queries created in SQL
2. Create a query to perform the full-text search. code. The search condition is entered when creating the
3.Analyze and display the query’s result. query.

2.8.3 How do I create a full-text index? Full-text search: Query editor


To create a query performing a full-text search, all you
The creation of a full-text index is performed in the data
have to do is add a "Full-text index" item to the query.
model editor.
The description window of a full-text search is automati-

Part 8: File management


To create a full-text index: cally displayed.
1. In the data model editor, display the description
This window is used to indicate:
of the items from the relevant file ("Item Descrip-
tion" option in the popup menu). •The search value. This value can be entered directly
2. Click the icon . The window for defining the (a wizard is used to build the sought string) or it can
full-text index is displayed. Select the items taking correspond to a parameter. See "Syntax of the
part in the composition of the full-text index. Only the search value" for more details.
"Text" items and the "Text memo" items found in •the sort options of the result.
the file description are proposed. Validate. When this window is validated, the "full-text" item is
3. The "Full-text index" item is displayed in the list of automatically added to the elements of the query. A con-
items. dition was automatically defined: only records whose
4. Select the item and if needed modify its characte- relevance is greater than 0 will be displayed in the query
ristics: result.
•in the list of items, you have the ability to modify
the name of the full-text index. Full-text search: Query in SQL code
To create a query that performs a full-text search in SQL
•in the right section of the window, select the para-
meters of the full-text index: minimum size of the code, use the syntax MATCH (<Index>) AGAINST <Condi-
indexed words, RTF tag management, HTML Tag tion> where:
management, case management, accent manage- <Index> corresponds to the list of items found in the
ment. index separated by commas (the order of the items is not
5. Validate the description window of the items. important).
6. Save and generate the analysis. When generating <Condition> corresponds to the sought string. See "Syn-
the analysis, the description of the data files is modi- tax of the search value" for more details.
fied and the full-text index is created (file with a
Tome1_2.book Page 524 Vendredi, 28. mai 2010 5:50 17

524

Example: Example with pertinence:


In this example, EDT_Search is an edit control and SELECT
IDConnectedUser is a variable.. MATCH(XX, YY, ZZ) AGAINST …
MyQuery is string = [ ({ParamFullText}) AS …
SELECT * FROM Contact FullTextPertinence
WHERE MATCH(Contact.LastName, … FROM
Contact.FirstName, … TABLE
Contact.HTMLComment, WHERE
Contact.RoughTextComment,… <Parameters>
Contact.Comments, .. AND PertinenceFullText > 0
Contact.Phone, … ORDER BY
Contact.Office,… PertinenceFullText DESC
Contact.Cell, Contact.Email,…
Example with pertinence:
Contact.MSN,_…
Internet_site, Contact.Country, … SELECT
Contact.FaxNum, Contact.City) *
AGAINST (’ FROM
] MyQuery = MyQuery + … TABLE
EDT_Search + [ WHERE
’) <Parameters>
AND Contact.UserID = AND MATCH(XXX, YYY, ZZZ)
] AGAINST({ParamFullText }) > 0
MyQuery = MyQuery + … Syntax of the search value
IDConnectedUser + [
ORDER BY LName DESC
The search value can contain the following elements:
] Element Meaning
HExecuteSQLQuery(QRY_SRCH, … A single word The specified word will be
hQueryDefault, MyQuery) sought. The relevance will be
FOR EACH QRY_SRCH increased if the text con-
TableAddLine… tains this word.
(Contact_Table_by_… Example: "WinDev" find the
word "WinDev
Part 8: File management

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

Part 8: File management


Tome1_2.book Page 526 Vendredi, 28. mai 2010 5:50 17

526

2.9 The transactions


2.9.1 What is a transaction? For instance, in an application or a banking site, a wire
A transaction is a set of indissociable operations: either operation consists in a debit for one account and a credit
all the operations in the transaction are performed, or for a second account. These two operations must be
none are performed. Managing the transactions is the managed in a single transaction in order to avoid any
best way to ensure the consistency of a set of indissocia- incoherence (in case of a power outage during the opera-
ble write operations performed on HyperFileSQL files. tion for example).
Part 8: File management

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

Special cases HTransactionInterrup- Enables you to find out whether


• Program error, the transaction is automatically cance- ted a transaction was interrupted
led. (the transaction was neither
• Call to EndProgram, the transaction is automatically validated nor canceled). Power
canceled. outage case.
• Canceling a test from the editor, the transaction is HTransactionFree If a record found in the speci-
automatically canceled. fied data file is considered as
• Power failure or sudden stop of the application or Web being in transaction but does
server (through the task manager for instance) : not belong to any current tran-
When the application or the server is restarted, the saction, it is automatically
integrity of the database can be restored: freed
•using the WDTRANS tool,
Handling the records during a transaction: the rules to
•during the first call to HTransactionStart,
follow
•by HTransactionCancel.
• The records modified during the transaction can be
• See the ’Managing special cases’ paragraph, page read before or after the start of the transaction: they
550, for more details about restoring data integrity. will always be taken into account in the transaction
logs.
2.9.4 Handling the transactions by program-
ming • Managing the transactions does not exclude managing
the locks for the records in transaction.
Implementing the management of transactions Indeed, the records handled during the transaction are
1. If your files are password-protected, open all the automatically locked in write mode.
files used during the transaction before the transac- In a WinDev network application, if the user tries to
tion starts. modify a record in transaction, a message will ask him
If the files are not password-protected, the files used to retry the operation.
after the call to HTransactionStart will automatically Therefore, the transaction must be as short as possi-
belong to the transaction. ble to avoid locking the users.
2. Start the transaction with HTransactionStart. This
function can also be used to define the name of the Errors specific to the management of transactions
transaction log. • 70031: Operation not allowed in transaction
3. Perform your operations. All the write operations Attempt to use a function not allowed during a transac-

Part 8: File management


performed on the files in transaction are automati- tion. For instance, HTransactionStart is used in the
cally saved in the transaction file. Caution: the pro- middle of a transaction.
cesses performed are relatively slower (since each • 70034: The last transaction failed
operation is recorded in a specific file). Attempt to use a record that belongs to a failed tran-
4. Cancel (if necessary) the operations performed saction (power outage, …). The program is restarted
during the transaction (HTransactionCancel). but the transaction is not canceled. In this case, we
5. Specify the end of the transaction with HTransac- recommend that you cancel the transaction that failed
tionEnd. The transaction is validated. (see below).
Summary table of the WLanguage functions used (for a
HyperFileSQL database) 2.9.5 Managing the special cases
Power failure
HSetTransaction Turns transaction manage- If a breakdown (power outage, reboot, and so on) occurs
ment on or off during a transaction, the data files may become corrup-
(transaction management is ted: the transaction was neither validated nor canceled.
enabled by default) The transaction file is still found on the computer.
HTransactionStart Starts the transaction In this case, the integrity of the database will be restored:
HTransactionEnd Validates the transaction • the first time HTransactionStart is called,
• with HTransactionCancel,
HTransactionCancel Cancels the current transaction
• with the WDTrans distributable tool.
HTransactionCancel Cancels a transaction that
failed (power outage for ins- Caution: restoring the integrity of the database may take
HTransactionStart some time.
HTransactionEnd tance)
WDTRANS
Tome1_2.book Page 528 Vendredi, 28. mai 2010 5:50 17

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

Part 8: File management


date. file. Caution: you can-
• Find the author, the date and time of an operation per- not find out the value of
formed on a specific backup. the record before and
after the modification.
• Keep a file’s use history (to calculate statistics for ins-
tance). Write-to- All the addition, modifi- <File
file log + cation and deletion Name>.JNL.fic
Examples: History of operations are recorded JournalOpéra-
• The last backup was done a month ago. You made a accesses in this log. tion.fic
mistake while using the file. Thanks to the log, you can The HyperFileSQL com-
retrieve all your data, without loosing the ones from the JournalIdentifi-
mands used to access cation. fic
last month of work! the file will be stored as
• A user entered the orders of last week instead of the well.
orders of this week during the entire morning. To avoid When to choose this
losing a large amount of data, we advise you to restore option?
all the analysis files to their previous status (yesterday To find out:
evening). - who modified the file,
The operation is straightforward. The person in charge - what modification was
of the maintenance will restore the data files that were performed,
previously saved by WDLog. Via the log, WDLog can - what are the opera-
rebuild the files, operation by operation, from the last tions performed on the
backup up to the chosen time. file.
Tome1_2.book Page 530 Vendredi, 28. mai 2010 5:50 17

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.

Part 8: File management


2.11 Automatic modification of the data files
2.11.1 Principle If the application or the site is updated without perfor-
The automatic modification of the data files is used to ming any automatic data modification, the application or
update the description of the data files found on the user the site may:
computers or on the server computers. • no longer operate properly,
Indeed, if the structure of one or more files has evolved • generate programming errors.
on the development computer (addition, deletion or
Caution: in the case of a network update with automatic
modification of items), these modifications must be modification of the data files, the installation of the
applied to the end-user computers or the data servers update on the user computers must be required (WinDev
when the application or the site is updated. only).
Tome1_2.book Page 532 Vendredi, 28. mai 2010 5:50 17

532

2.11.2 When is the automatic data modifica-


tion required?
The automatic data modification is required in the fol-
lowing cases:
Development computer End-user computers/Data server
Case 1 : The application/site uses The application/site uses data files in HyperFileSQL 7 format.
Modifying the struc- data files in HyperFileSQL These modifications must necessarily be applied when the
ture of the data files in 7 format. application or the site is updated. The files structure will be iden-
HyperFileSQL 7 format The structure of the data tical to the one on the development computer.
files was modified (addi-
tion or deletion of items,
…).
Case 2 : The application/site uses The application/site uses data files in Hyper File 5.5 format
Migration of Hyper File data files in HyperFileSQL (WinDev 5.5/WebDev 1.5).
5.5 data files (WinDev Classic format. The files must be migrated from Hyper File 5.5 to HyperFileSQL
5.5 or WebDev 1.5) to Classic when the application or the site is updated. The files
HyperFileSQL Classic structure will be identical to the one on the development compu-
ter.
Case 3 : The application/site uses The application/site uses data files in Hyper File 5.5 format
Modifications of the data files in Hyper File 5.5 (WinDev 5.5/WebDev 1.5)
structure of Hyper File format (WinDev 5.5/Web- These modifications must necessarily be applied when the
5.5 data files (WinDev Dev 1.5). application or the site is updated. The files structure will be iden-
5.5/WebDev 1.5) The structure of the data tical to the one on the development computer.
files was modified (addi-
tion or deletion of items,
…)..

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

Forcing the automatic file modification


Default Configuration of Setup Program
On the development computer as well as on the deploy-
ment computer, an automatic data file modification can If the application is associated with an analysis, by
be performed at any time. default, the setup program offers to perform the automa-
tic modification of the data files. The user or the site
Indeed, in some cases, the automatic data modification manager can access the configuration options of the
cannot be performed properly: data files located on a automatic modification by clicking the "Advanced" but-
laptop not connected to the network at the time of the ton.
update, faulty update, ... You need to force the automatic
data file modification to be able to use the application or Saving the data files
the site. The WDModFic tool lets you force an automatic The data files of the application or the site are automati-
data file modification. cally saved before the automatic modification is perfor-
med. The backup directories are named:
2.11.4 Notes • "Backup of Auto Modif (<DateAutoModif> <TimeAuto-
Running the automatic modification of the data files Modif>)" for an automatic modification of data files
several times without migration
The automatic modification will have no effect on the • "Files before conversion (<DateAutoModif>
application or the site if it is performed on data that is <TimeAutoModif>)" for a migration of data files from
already updated. Hyper File 5.5 to HyperFileSQL 7.

2.12 Creating dynamic (or temporary) files


In WLanguage, you can describe temporary HyperFileSQL (HDescribeLink).
files by programming. To describe a temporary file a HyperFileSQL analysis
To describe temporary files, you need to: must be associated with the current project.
1. Declare the "File description", "Item descrip-
tion" and "Link description" variables (if neces- Notes:
sary). • A dynamic file can be linked to a window, a page, a
These types are described starting page 192. report or a control through the WLanguage properties.
2. For each file: • Dynamic files can be modified by the automatic file
modification.

Part 8: File management


•describe the characteristics of the file using the
HyperFileSQL properties, • A dynamic file can be reindexed by WDTool or by HIn-
•describe the characteristics of the items using the dex.
HyperFileSQL properties, • The functions used to describe temporary files cannot
•validate the description of each item (HDescri- be used in external language. They do not let you
beItem), modify a file described in the WinDev/WebDev editor
•validate the description of the file (HDescribeFile). (temporary file).
3. Describe, if needed, the characteristics of the • Specific xBase functions are available for creating tem-
links via the HyperFileSQL properties. porary xBase files.
4. Validate (if necessary) the description of each link
Tome1_2.book Page 534 Vendredi, 28. mai 2010 5:50 17

534

2.13 Retrieving the structure of the HyperFileSQL files from an analysis


You can retrieve the structure of the files found in an ana- HRetrieveItem Returns the content of the spe-
lysis. This enables a tool such as the WDMAP file viewer cified item for the current
to be created for instance. record
The functions that allow you to retrieve the structure of
the files are as follows (they cannot be used with xBase HToItem Writes the content of the speci-
files). fied item for the current record

HCloseAnalysis Closes an analysis opened by


HOpenAnalysis Notes:
• The HOpenAnalysis function accepts as parameter an
HListAnalysis Returns the name of the analy- optional password if a password has been set when
ses and the drive where they
are installed describing the analysis (WDMAP password). This pas-
sword protects the access to the analysis by program-
HListKey Returns information about the ming.
keys of an analysis • To use HListFile, HListItem and HListKey, you do not
HListFile Returns the name of the files of need to open the analysis with HOpenAnalysis.
an analysis • To retrieve the structure of the data files of an analysis, if the ana-
lysis is associated with the project, you do not need to open the
HListItem Returns the structure (items) of analysis with HOpenAnalysis. The description file of the
a file analysis (WDD) must be installed in the project library
HOpenAnalysis Open an analysis to access its (WDL) or in the analysis directory.
data files

2.14 Speeding up processes and optimizing an application/site


Part 8: File management

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.

2.14.1 Management of transactions 2.14.4 Managing the ".REP"


Transaction management lets you keep the integrity and The ".REP" file contains the physical name and directory
coherence of a database, regardless of the operation of the HyperFileSQL data files for an application or a site.
Tome1_2.book Page 535 Vendredi, 28. mai 2010 5:50 17

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-

2.15 ODBC driver for HyperFileSQL


2.15.1 Overview 3. Click the "Add" button.
The ODBC driver for HyperFileSQL lets you access a 4. Select the "HyperFileSQL" driver.
HyperFileSQL database from a third-party database that 5. Click the "Done" button.
supports ODBC accesses. 6. Enter the name of the HyperFileSQL data source.
This name will be used to identify the HyperFileSQL
The HyperFileSQL data can be accessed in read and write database in the external programs.
mode then. 7. Click "Details".
Setup 8. Select the WDD file corresponding to the analysis
When installing WinDev/WebDev on the development ("Browse" button).
computer, you have the ability to install the ODBC driver 9. In the list of analyses, select the requested analy-
on HyperFileSQL. sis and the directory of the data files ("Browse" but-
ton). All the HyperFileSQL data files corresponding to

Part 8: File management


Furthermore, the setup of the ODBC driver for HyperFi- the selected analysis are grouped in this directory.
leSQL can be included when configuring the setup pro- Caution: you need to select a file directory for each
gram of your applications or your sites. analysis.
10. Validate ("OK" button).
2.15.2 Configuration
To use the ODBC driver on HyperFileSQL: The database can be used in read and write mode from
1. Start the ODBC data administrator external programs via the ODBC driver on HyperFileSQL.
(ODBCAD32.EXE) on your computer or on the server See the online help for more details about the ODBC dri-
computer. Use for example the "Start .. Run" Win- ver for HyperFileSQL Classic.
dows option and enter "ODBCAD32.EXE".
2. Select the "User Database" tab.

2.16 ODBC on HyperFileSQL via J++ and JDBC


2.16.1 Overview • Visual J++ or the JDK of Sun.
The ODBC driver for HyperFileSQL lets you access a Caution: The following limitations apply when using the
HyperFileSQL database from a third-party database that ODBC drivers on HyperFileSQL via J++ and JDBC:
supports ODBC accesses. This gives you the ability to use To prevent the other programs from modifying your Hyper-
the ODBC driver on HyperFileSQL 7 via J++ and JDBC. FileSQL data, the driver is read-only. The ODBC driver on
You must use: HyperFileSQL is a level 2 ODBC driver. See a specific
• the JDBC driver of Microsoft or Sun documentation for more details.
Tome1_2.book Page 536 Vendredi, 28. mai 2010 5:50 17

536

2.16.2 Setup 2.16.4 Use


The ODBC driver on HyperFileSQL can be installed when To use the ODBC driver for HyperFileSQL from your Java
WinDev or WebDev is installed on the development com- program, you must:
puter. 1. Define the driver used. For example, use the fol-
lowing code line:
Furthermore, when configuring the setup program of your // using the JDBC driver from
WinDev applications, you have the ability to include the // Microsoft
setup of the ODBC driver on HyperFileSQL. Class.forName("com.ms.jdbc.odbc.Jdb-
cOdbcDriver");
2.16.3 Configuration // Using the JDBC driver from Sun
Class.forName("sun.jdbc.odbc.JdbcO-
To use the ODBC driver on HyperFileSQL, the ODBC driver
dbcDriver");
must be configured:
1. Start the ODBC administrator (ODBCAD32.EXE) 2.Define the URL on the system ODBC connection
on your computer. Use for example the "Start .. ("hfodbc" for example):
Run" Windows option and enter "ODBCAD32.EXE". String jURL = "jdbc:odbc:hfodbc";
2. Select the "User Database" tab. //Connection
3. Click the "Add" button. Connection Contact = …
4. Select the "HyperFileSQL" driver. DriverManager.getConnection(jURL,…
5. Click the "Done" button. "<user>", "<pass>");
6. Enter the name of the HyperFileSQL data source.
This name will be used to identify the HyperFileSQL 3. Interrogate the HyperFileSQL database in SQL.
database in the external programs. For example:
7. Click "Details". // Create a query
8. Click "Browse" to select the WDD file correspon- Statement jQuery = …
ding to the analysis. Contact.createStatement();
9. In the list of analyses, select the requested analy- // Run the query
sis and the directory of the data files ("Browse" but- // and retrieving results …
ton). ResultSet Result = …
All the HyperFileSQL data files corresponding to the jQuery.executeQuery(…
selected analysis are grouped in this directory. "SELECT * FROM CUSTOMER");
Caution: you need to select a file directory for each int jColumn = 5;
Part 8: File management

analysis. int jRow = 3;


10. Validate ("OK" button).
The database can be used in read-only mode from
the external programs via the ODBC driver on Hyper- ResultSetMetaData jMetaData= …
FileSQL. Resultat.getMetaData();
for (int i=0;i<jLine;i++)
Result.next();
System.out.println("Column Name : " +
jMetaData.getColumnLabel(jColumn));
System.out.println("Value : " +
Result.getString(jColumn));
Result.close();
jQuery.close();
Contact.close();

Note: the ODBC driver on HyperFileSQL does not let you


access an encrypted HyperFileSQL database.
Tome1_2.book Page 537 Vendredi, 28. mai 2010 5:50 17

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

3.2 SQL Language and HyperFileSQL


3.2.1 Overview 3.2.2 SQL commands that can be used with
WLanguage offers two functions to query a HyperFileSQL HyperFileSQL
database using SQL queries (HExecuteQuery, HExecu- The following SQL commands can be used on HyperFi-
teSQLQuery). leSQL files:
The HyperFileSQL files can be queried:
• ADD_MONTH • ALL
• Through queries created by the query editor.
See the "Query and report generator" manual for • AND • ANY
more details about creating queries and using the
• AS • ASC
query editor.
• By SQL queries entered directly in the code editor • ASCII • AVG
(HExecuteSQLQuery). • BETWEEN • BIN
• Using the ODBC driver for HyperFileSQL provided with
WinDev/WebDev, from an application or a site develo- • BOTTOM • CEILING
ped using WinDev/WebDev.

Part 8: File management


• CHAR_LENGTH • CHARACTER_LENGTH
• COALESCE • CONCAT
• COUNT • DECODE
• DELETE • DESC
• DISTINCT • EXISTS
• FROM • FULL OUTER JOIN
• GROUP BY • HAVING
• HEX • IN
• INNER JOIN • INTO
• INSERT • INSTR
• IS NULL/IF NULL • LAST_DAY
• LEFT • LEFT OUTER JOIN
• LEN • LENGTH
• LIKE • LOWER
• LPAD • LTRIM
• MAX • MID
Tome1_2.book Page 538 Vendredi, 28. mai 2010 5:50 17

538

• MIN • MONTHS_BETWEEN 3.2.3 Functions for running queries


Queries created with the query editor will be initialized by
• NEXT_TIME • NEXT_DAY HExecuteQuery.
• NOT • NVL Queries in SQL language will be initialized by HExecuteS-
QLQuery. To retrieve the content of an SQL query, you
• OCT • OCTET_LENGTH
need to have a data source available (or a file table con-
• ON • OR trol, ... linked to the query).
• ORDER BY • OUTER Important: a "data source" type variable must always be
declared as global to the window, page or project. Othe-
• PATINDEX • POSITION rwise, it could not be used to fill table for instance, since
its lifespan would be too short.
• REPLACE • RIGHT If a "data source" type variable is declared as a LOCAL
• RIGHT OUTER JOIN • ROUND variable, a warning will be generated.
• RPAD • RTRIM Sample queries from the query editor (the query is called
EditorQuery.WDR here):
• SELECT • SET SrcQuery is data source
• SOME • SOUNDEX IF not HExecuteQuery(SrcQuery,…
EditorQuery) THEN
• SOUNDEX LIKE • SOUNDEX2 Error(HErrorInfo())
• SOUNDEX2 LIKE • SUBSTR ELSE
HReadFirst(QuerySource)
• SUBSTRING • SUM While Not HOut()
// Browse the result of the query
• SYSDATE • TOP
HReadNext()
• TRANSLATE • TRIM END
END
• TRUNC • UNION
Example of query in SQL language:
• UPDATE • UPPER SrcQuery is data source
• VALUES • WHERE IF Not HExecuteSQLQuery(…
SrcQuery,"SELECT CustomerName, "+…
Part 8: File management

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

Behavior specific to queries that update the database


(UPDATE, DELETE, INSERT, …)
Since these queries are not meant to return a selection of
records, a data source is not required to run them. HExe-
cuteQuery and HExecuteSQLQuery can be called using a
query name instead of a data source name.
Tome1_2.book Page 539 Vendredi, 28. mai 2010 5:50 17

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.

3.3 SQL language and other databases


3.3.1 Overview 3.3.3 Query created by programming
WinDev/WebDev lets you query a third party database: Here are the steps for creating a query on a third-party
• through WLanguage (HExecuteSQLQuery) database:
• through a query created in the query editor. 1. Declare the connection in the data model editor.
2. Two methods are available for programming:
3.3.2 Query created in the query editor Method 1:

Part 8: File management


Here are the steps for creating a query on a third-party •Declare a data source.
database: •Use HExecuteSQLQuery.
1. Importing the tables from the third-party data- Method 2:
base (description of the structure) in the project ana-
lysis. •Open the connection with HOpenConnectione.
This operation is performed by "File structure .. •Execute the query with HExecuteSQLQuery.
Import/export file/table description". The wizard •Read the query’s result with the HReadXXX func-
allows you to connect to a server or to a database tions.
and to select the tables to import. •Close the connection with HCloseConnection.
2. Create the queries with the query editor.
Declaration of the connection
In the data model editor, select "Analysis .. Connec-
tions".
Programming
The following code lets you execute an SQL query on a
database accessible via the connection described in the
analysis.
Tome1_2.book Page 540 Vendredi, 28. mai 2010 5:50 17

540

Note: all the SQL commands specific to the third-party


database can be used.
// Declaring the data source
CustomerFromCA is data source
// Find customer in California
// SalesManagement : name of the
// connection in the analysis
IF NOT …
HExecuteSQLQuery(CustomerFromCA,…
SalesManagement,…
hQueryBreakable,…
"SELECT * FROM"+…
" CUSTOMER WHERE STATE "+…
"LIKE ’CA%’) then
Error(HErrorInfo()) //error
RETURN
END
// Retrieve the result
FOR EACH CustomerFromCA
CalculateStats()
END
Part 8: File management
Tome1_2.book Page 541 Vendredi, 28. mai 2010 5:50 17

541

4. MANAGING FILE LOCKS


4.1 Lock overview WD WebDev

4.1.1 File locking 4.1.2 What is a lock?


A lock consists in locking a file or part of a file to tempora-
Why lock the files? rily forbid access to the file (or to part of the file) by ano-
In Windows several programs running on the same ther program. A lock can be:
machine or on machines connected through a network • in write mode only, in this case the file (or part of the
can work on the same data file at the same time. file) can be read by another program while the lock is
active
WB In an Internet/Intranet application,
each user starts a session of the Web- • in read and write modes, in this case the file (or part of
Dev application: several sessions run- the file) remains totally inaccessible to other pro-
ning on the server can work on the grams.
same data file at the same time.
4.1.3 When should you lock and what should
you lock?
WDMobile In an application for Pocket PC, lock
management is only available for Here are some basic rules to manage locks by program-
HyperFileSQL Client/Server data files. ming:
1. Each record that is going to be modified, deleted
Therefore file management implies managing concurrent or rewritten must be read and locked first, by a loc-
accesses. Specifically, you need to prevent several pro- king read function.
grams from modifying the same record at the same time, The record is unlocked automatically by the modifi-
by locking the file or the record. cation, deletion or rewrite operations.
WLanguage lets you manage the locking of a file or of a 2. When a record is locked by a locking read function
file record. and is not unlocked by a modification, deletion or
rewrite operation, it must be unlocked by a unlocking
Locking files through programming

Part 8: File management


function.
WLanguage functions are available to lock files or records 3. When several records must be unlocked, they can
and get status report on the lock. be unlocked in one operation by closing the file.
These functions let you choose to lock: 4. Only the program that locked the records and the
• only the record read in write mode, files can unlock them.
• the entire file in write mode, 5. When a file is locked, you do not have to read the
record with the locking read functions. Simply use a
• the entire file in read and write mode. "simple" read function.
Of course they allow the locked files or records to be 6. As soon as a file is not needed in the program
unlocked. anymore, at least for some time, it is better to close
it. This way it can be accessed by other programs.
Tome1_2.book Page 542 Vendredi, 28. mai 2010 5:50 17

542

4.1.4 WLanguage and locks reports. The files cannot be shared.


WLanguage offers two lock management modes. The • Multiuser mode: any opened file can be shared with
developer chooses the lock mode according to the final other programs and other computers. The developer
use of the application or site that’s being developed and manages the locking of the files and records as well as
its programming. the lock status reports. He decides which actions to
Here are the lock modes: perform in each cases.
• Single-user mode: each opened file is automatically The Single-user mode is the default lock mode of WinDev.
locked in read and write mode. This way, you do not The Multiuser mode is the default lock mode of WebDev.
have to manage the locks or check the lock status

4.2 Lock management WD WebDev

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

The P1 and P2 processes become : • P2 cannot lock F1.


Program P1 Program P2 • P1 locks F2.
• P2 waits for F1 to be released.
LOCK(F1) LOCK(F1)
• Process 1 is being executed.
LOCK(F2) LOCK(F2) • P1 unlocks F1.
<Process 1> <Process 2> • P1 unlocks F2.
UNLOCK(F1) UNLOCK(F1) • P2 locks F1.
UNLOCK(F2) UNLOCK(F2) • P2 locks F2. …
A dead lock is avoided!
In this case:
• P1 locks F1.

4.3 The available lock modes WD WebDev

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.

Part 8: File management


A file that has been locked when opened is automatically
WB This name is kept for compatibility unlocked when closed:
with WinDev. It should not be used in
a WebDev site. •by the HClose function, if called,
WebDev 1.5 user: this mode corres- •in order to be able to open another file when the
ponds to the HModeAuto function of maximum number of files that can be open is rea-
WebDev 1.5. ched (automatic file closing).
Notes
When should this mode be used?
• If the file is unlocked by HClose (or HUnlockFile, HUn-
The Single-user mode is used to develop easily programs lockEntireFile) or by the automatic closing, in the rest
whose files are not shared by several computers or pro- of the program,
grams at the same time.
With the Single-user mode, file locks don’t need to be it will be locked again when it is reopened by a func-
managed by programming, the files are locked as soon tion.
as they’re opened for reading or writing. The files cannot • In Single-user mode, the file is locked as long as it is
be shared. open. Therefore we recommend you keep a file locked
for the least amount of time possible. It is better to
Important close a file as soon as it is not used anymore.
• The Single-user mode does not suit programs running How to share data in Single mode?
on a network.
If a program developed in Single-user mode is run In Single-user mode, files cannot be shared. However, in
several times on the same computer or is run on a some analysis, two programs can run at the same time,
network, an error message will come up indicating that one modifying the files, the other only reading the files. In
the Single-user mode is not appropriate for this type of such a case, programs in Single-user mode can access
behavior. data at the same time.
Tome1_2.book Page 544 Vendredi, 28. mai 2010 5:50 17

544

If a program (modifying files) developed in Single-user - TableSave- TableDelete


mode is run several times on the same computer or is run
on a network, an error message will come up indicating Basic rules of the Single-user mode
that the Single-user mode is not appropriate for this type To properly manage the locking of files/records we
of behavior recommend you follow these rules:
Let’s assume two programs for example: • The Single-user mode must be used when the files are
- P1 reads the "ORDERS" file, shared by several programs.
- P2 modifies the "ORDERS" file. • The Single-user mode is not meant for program running
P1 uses the following algorithm: over a network.
// display order list Summary
ResOpen = HOpen(ORDERS, hORead)
In single-user mode, each time a file is opened by a func-
if ResOpen = False then
tion (except HOpen(hORead/hOReadWrite)), it is auto-
Info ("file not found")
matically locked for reading and writing.
else
HReadFirst(ORDERS, NUM)
The file is automatically unlocked when it is closed.
While Not HOut()
It will be locked again when calling a function (except
Display_Order
HOpen(hORead/hOReadWrite)).
HReadNext(ORDERS,NUM) HOpen(hORead/hOReadWrite) opens the file without
End locking it, whether it is already locked by another pro-
End gram or not.
P2 uses the following algorithm: The single-user mode is well suited for programs that do
not share files.
// Delete the orders
//containing the PdtCode product Calling the single-user mode
PdtCode = Enter_prouct_code The Single-user mode is the default lock mode of WinDev.
HReadSeek(ORDERS, CODE, PdtCode)
While not HOut()
Note: you can switch between the single-user and mul-
HDelete(ORDERS)
tiuser mode in your program.
HReadNext(ORDERS,CODE) Example in single-user mode
End
The following example illustrates the locking an unlocking
If P2 is started first then P1 second, then: mechanism of the single-user mode. The functions used
Part 8: File management

• 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

Part 8: File management


• Direct Mode: hModeDirect constant (default); imple- The records can be locked while in use without the file
ment priority locks (on modification for example). being entirely locked.
Therefore, a record on which several read operations The following functions enable you to lock a record:
are performed will not be modified but the locks are HRead, HReadSeekFirst, HReadSeekLast, HReadLast,
faster. HReadFirst, HReadNext, HReadPrevious
• Reservation mode: hModeReservation constant;
implement non-priority locks. After each function, you need to test HErrorLock to make
This method enables you to immediately modify a sure the record did get locked.
record on which several read operations are perfor- Caution: at the end of the process, remember to unlock
med. This method is slower than the hModeDirect the locked records using: HUnlockFile, HClose, HEndNo-
method. Modif, HUnlockNumRec, HAdd, HModify, HWrite,
HCross, HDelete, TableDelete, TableSave.
Summary
The multiuser mode lets you share one or more files Note: locking a record using the "HRead…" functions
among several programs. has no effect if the file has been previously locked by the
The developer manages the file locks by programming. "HLock…" functions, the function is equivalent to
He must also check HErrorLock after all the HyperFi- "HRead…".
leSQL functions.
Tome1_2.book Page 546 Vendredi, 28. mai 2010 5:50 17

546

4.4 Assisted management of HyperFileSQL errors


The HyperFileSQL engine enables you to manage various 4.4.2 Standard operating mode
types of errors by programming: Duplicate error
• Duplicate error • Cause of the error
• Integrity error The user adds a record for which the value of a unique
• Password error key is already found.
• Error of modification conflict and error of modification For instance, the name of the city is defined as unique
status conflict key for the Customer file in the analysis. Adding a city
• Lock error with an already used name triggers a duplicate error.
• Default assisted management (WinDev and WebDev)
• Error on mandatory input
If a duplicate error is detected, a window or a page
• Reindex in progress comes up, asking the user to modify the value of the
HOnError is used to customize the assisted management record that caused the error.
of errors or to disable this management. For each type of • Processing the error (WinDev Mobile)
error, you can: Test HErrorDuplicates after each call to a HyperFileSQL
• manage this error via a specific window or procedure, function that may trigger a duplicate error (HAdd or
HModify for instance). The text of the error is returned
• disable the assisted management and manage the by HErrorInfo.
error by programming (like in WinDev 5.5).

4.4.1 Principle Integrity error


To simplify the programming of the data file manage- • Cause of the error
ment, the most common types of errors are automatically The user tries to add a record without respecting the
managed by the HyperFileSQL engine. integrity constraints defined between the files in the
This automatic management helps the user process the analysis.
error. In most cases, the error is caused by a problem For example, the files named CEDEX, STATE and
involving the data entered. REGION are linked between themselves. These links
comply with the relational integrity constraints. An inte-
This automatic management is proposed by default and grity error occurs when adding a state without creating
it can be customized or disabled. the corresponding region.
Part 8: File management

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:

Part 8: File management


Tome1_2.book Page 548 Vendredi, 28. mai 2010 5:50 17

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

• Processing the error (WinDev Mobile) reindex operation.


For modification conflict errors, test HErrorModifica- • Processing the error (WinDev Mobile)
tion after each HyperFileSQL function that may trigger The error number associated with this problem is
this error (HModify for example). The text of the error is 70720: reindex in progress.
returned by HErrorInfo. These error numbers are returned by HError.
For modification status conflict errors, test HErrorSta-
tusModification after each HyperFileSQL function that 4.4.3 Customization
may trigger this error (HModify for example). The text of The different solutions
the error is returned by HErrorInfo. WinDev, WebDev and WinDev Mobile enable you to cus-
tomize the management of HyperFileSQL errors.
Lock error
You can use custom procedures.
• Cause of the error
In a network application or in a site, a record or file can A specific procedure of your application is automatically
be locked (to perform specific operations for instance. run when a HyperFileSQL error occurs.
A lock error occurs when a computer tries to access a Note: you can define a procedure for each file or each
locked record. type of error.
• Default assisted management (WinDev or WebDev)
When a lock error occurs, the management of the locks WinDev and WebDev enable you to use custom windows
(checking whether the file is locked, processing the or pages: the standard windows/pages of the HyperFi-
lock) is automatically performed by the HyperFileSQL leSQL engine are replaced by windows/pages from your
engine. application.
A window or a page comes up, notifying the user that Note: you can define a window/page for each file and
the file or record is locked and allowing the user to retry each type of error.
or cancel the operation. In case of cancelation, the
Tome1_2.book Page 549 Vendredi, 28. mai 2010 5:50 17

549

Implementation opRelaunchPro- Ends the application and automati-


To implement the assisted custom management of gram cally restarts the application
HyperFileSQL errors, simply:
1. For each type of error, create the procedure, the Note: customizing the modification errors:
window or the page used to customize the error. The
same window, page or procedure can manage seve- If the window, page or procedure called during a modifi-
ral types of errors. This window, page or procedure cation conflict returns the opRetry constant without
must return a specific constant depending on the doing anything else, the values are written into the file
process to perform (see the paragraph below). without triggering a new modification conflict.
2. Define the error customization with HOnError.
4.4.4 Disabling the assisted management
Examples of windows or pages that can (WinDev and WebDev)
easily be included (WinDev and Web- WinDev and WebDev let you entirely disable the automa-
Dev) tic error management system. In this case, the different
The windows/pages used by default and presented in the error cases that may occur must be checked in the appli-
previous paragraphs are provided (with their WLanguage cation. A WLanguage error occurs and the application
code) as examples. stops if this test is not run.
These windows are available in the "\Pro- Implementation
grams\Data\Preset windows\HyperFileSQL - Automatic
help windows" subdirectory of the WinDev setup direc- To entirely disable the automatic error management, use
tory. HOnError and specify an empty string as the window or
procedure’s name.
These pages are available in the "\Programs\Data\Pre-
set pages\HyperFileSQL - Pages for automatic assis- In this case, a test must be run after each HyperFileSQL
tance" subdirectory of the WebDev setup directory. function that may trigger an error, with one or more of the
following functions:
These windows/pages can be included in your projects,
customized and passed as parameter to HOnError. HErrorLock Checks whether a lock error
occurred.
Constants used to customize the errors
HErrorDuplicates Checks whether a duplicate
The window, page or procedure used to customized the error occurred.
error must return one of the constants presented in the
table below. HErrorIntegrity Checks whether an integrity

Part 8: File management


The corresponding process will be run according to the error occurred.
constant returned. HErrorPassword Checks whether an error caused
opRetry The function that triggered the error by a wrong password occurred.
is re-run. The text of the error is returned by HErrorInfo.
OpCancel The function that triggered the error You can re-enable the assisted management with HOnEr-
returns an error and the code conti- ror.
nues to run. Note: for the other errors (modification, mandatory input,
OpEndProcess The function that triggered the error reindex in progress) no test is needed. The error numbers
returns an error and the current pro- associated with these problems are:
cess stops. Equivalent to the fol- • 70700: Modification conflict
lowing code line: • 70710: Mandatory item value
IF NOT <HyperFileSQL Function> • 70720: Reindex in progress on file
THEN ReturnToCapture() These error numbers are returned by HError.
OpEndProgram The function that triggered the error
returns an error and the program
stops.
Equivalent to the following code line:
IF NOT <HyperFileSQL Function>
THEN EndProgram()
Tome1_2.book Page 550 Vendredi, 28. mai 2010 5:50 17

550

5. THE HYPERFILESQL VIEWS


5.1 Overview of HyperFileSQL views
A "view" is a set of records selected according to a A view’s records are "virtual" records. A virtual record is
selection condition. These records come from a HyperFi- made of some items or all the items from a file.
leSQL file and are loaded in memory. Creating a view is a file read operation.
A view is a "snapshot" taken at a given time of a part of It can come with a lock operation of the records read if
the database. these records must be modified.
A HyperFileSQL view can be compared with a "virtual" You can cancel all the modifications performed on a view.
HyperFileSQL file stored in memory. This file is not physi- The modification performed on a view are not immedia-
cally stored on the disk but it can be used almost like a tely applied to the HyperFileSQL file. To update a HyperFi-
"real" Hype FileSQL file. leSQL file according to a view, you need to explicitly give
A view can contain records from a HyperFileSQL file the order using a WLanguage function.
selected according to some criteria.

5.2 Benefits of views


Views bring: of data.
• More flexibility and power to all the applications or • A speed gain
sites that use HyperFileSQL files A view is the result of a query. Therefore it is a client/
The ability to filter and sort is improved for views. server type interaction that is especially adapted to
A view lets you read a file using a filter based on any networks where it is the number of interaction and not
item and not just key items. the size of the interaction that slows down communi-
cation.
• An additional security level
Views enable you to limit access to a selected subset
Part 8: File management

5.3 Handling views


Once created, views are handled the same way as Hyper- HExecuteView Executes a previously created view.
FileSQL files. The view has a name, which can be used in Used to refresh the view’s data with the
most HyperFileSQL type functions. You have the ability to: last modified data in the corresponding
• read a view (HReadFirst, HReadNext, etc.), HyperFileSQL file
• add records to a view (HAdd), HMergeView Creates a HyperFileSQL view from two
• set up filters on the view’s records (HFilter), views (previously created by HCreate-
• modify records (HModify), View. A large number of operations can
•… be performed when merging views.
The following functions are used to manage views: HSortView Sorts a view by creating an index based
on one of the view’s items
HCreateView Creates a view on a HyperFileSQL file
HViewToFile Saves the modifications performed in a
HCreateView_ Creates a view in WinDev 5.5/WebDev view (by HModify, HDelete or HCross)
55 1.5 format (compatibility only) into the corresponding HyperFileSQL
HDeleteView Destroys a view that was previously file
created FileToMemo- Displays the content of a view in a
ryTable memory table
See the online help for more details about these func-
tions.
Tome1_2.book Page 551 Vendredi, 28. mai 2010 5:50 17

551

See the online help to check the availability of these WinDev Mobile).
functions in the different products (WinDev, WebDev,

5.4 Creating HyperFileSQL views


As we mentioned before, a view contains "virtual" Some items of the file
records coming from a HyperFileSQL file.
To select only some items from the file, use the following
To create a view several steps are needed: syntax:
1. Choose the items that make up the view. <Result> = HCreateView(<View Name>,…
2. Choose the view’s sort item (if needed). <File Name>, <Item Name>)
3. Select the records found in the view. • <View Name> is the name of the created view.
4. Creating the view.
5. Perform union operations if needed. • <File Name> is the logical name of the view’s base file.
6. Display the view’s records if needed. • <Item Name> is the list of items to include in the view.
The items are separated by a comma in this character
The following paragraphs detail each of these steps. string.
Note: you can keep the behavior of views as in WinDev Example:
5.5/WebDev 1.5 (with management of a view identifier). Extern MyView1
Simply use HCreateView_55. MyFile is string="CUSTOMER"
ItemView is string= …
5.4.1 Choosing a view’s items "LASTNAME,FIRST-
To create a view, the first step consists in figuring out NAME,ADDRESS"
which items must be in the view. Each view is attached to // View containing the records
a HyperFileSQL file: the view file. // for the LastName, FirstName and
The view can contain: Address items
•all the items of the file, HCreateView(MyView1, FileName,
ItemView)
•some items of the file.
All the items of the file 5.4.2 Choosing the initial sort item of the view
When creating a view, you can specify the view item that

Part 8: File management


In order for the view to contain all the file’s items, use will be used for sorting. All the view’s items can be used
the following syntax: to sort.
<Result> = HCreateView(<View Name>, <File
Once created, the view can be resorted at any time using
Name>)
HSortView.
• <View Name> is the name of the created view. To specify the initial sort, use the following syntax:
• <File Name> is the logical name of the view’s base file. <Result> = HCreateView(<View Name>, …
Example: <File name>,…
Extern MyView1 <Item Name>, <Sort Item>)
MyFile is string="CUSTOMER"
• <View Name> is the name of the created view.
// View with all the records • <File Name> is the logical name of the view’s base file.
// of all the file items
HCreateView(MyView1, FileName)
• <Item Name> is the list of items to include in the view.
• <Sort Item> is the name of the item used for sorting.
This string contains:
•The sort direction, with the "+" (increasing, by
default) or "-" (decreasing).
•The name of the sort item or its creation index.
Tome1_2.book Page 552 Vendredi, 28. mai 2010 5:50 17

552

Example: • <Condition> is the selection condition. This condition


Extern MyView1 is found in a character string using a syntax in the fol-
FileName is string="CUSTOMER" lowing format:
ItemsView is string "CustomerName > ’Smith’ and
ItemSort is view (ZipCode=94102 or ZipCode=94103)"
ItemsView=…
5.4.4 Union operations between several views
"LASTNAME,FIRST-
NAME,ADDRESS,ZIP" When creating views, you can perform a large number of
ItemSort = "-LASTNAME" selection operations on the records.
//OR ItemSort="-1" However these operations may not be enough in some
cases. A view can be created from other existing views.
// View containing the records
// for the LastName, FirstName and To do so, you can use the main union type operations:
Address items union, exclusive union, intersection, subtraction.
// as well as the zip code item of the The following syntax must be used:
file <Result> =HMergeView(<View Name>, <View Name1>,
// Originally sorted in …
// reverse LastName order <View Name2>,…
HCreateView(MyView1, FileName,… Operation, SortAndComparisonItem)
ItemsView, ItemSort)
• <View Name> is the name of the created view.
5.4.3 Selecting records from the view • <View Name1> is the name of the first view.
When creating a view, you can specify a selection condi- • <View Name2> is the name of the second view.
tion for the records. • <Operation> is one of the constants used to set the
The condition is applied to each record before including it type of operation to perform :
in the view. •hViewUnion: union of all the rows found in view A
To specify a selection condition in a view, the syntax to and view B
use is as follows: •hViewUnionEx: union of all the non-common rows
<Result> = HCreateView(<View Name>, <File found in view A and view B
Name>, <Item Name>, <Sort Item>, <Condition>) •hViewIntersection: rows common to A and B
•hViewJoin: rows common to A and B
Part 8: File management

• <View Name> is the name of the created view.


• <File Name> is the logical name of the view’s base file. •hViewSubtraction: rows of A - common rows found
in B
• <Item Name> is the list of items to include in the view.
• <SortAndComparisonItem> is a string containing the
• <Sort Item> is the name of the item used for sorting. subscript of the comparison item between the two
views. This item is also the initial sort item of the crea-
ted view.
Important: the file of the view generated by an union
operation on two other views is the file of the first view
passed as parameter to HCreateView.
Note: the union operations enable you to create proces-
ses that are faster than some selection conditions. For
instance, it is better to use union instead of OR in the
condition of HCreateView.
Tome1_2.book Page 553 Vendredi, 28. mai 2010 5:50 17

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.

6.2 How to create and handle triggers?

Part 8: File management


6.2.1 Functions for handling the triggers HListTrigger Returns the list of triggers applied to
The following functions are used to manage triggers: one or more data files
HActivateTrigger Re-enables a trigger previously disa- See the online help for more details about these func-
bled by HDisableTrigger tions.
See the online help to check the availability of these
HDescribeTrigger Adds or modifies a server trigger on
functions in the different products (WinDev, WebDev,
a HyperFileSQL file WinDev Mobile).
HDeactivateTrig- Disables a trigger. This trigger can The functions for handling triggers on the server are
ger be re-enabled by HActivateTrigger identical and have the word "Server" in their name.
HDeleteTrigger Destroys a trigger. This trigger can-
not be used anymore
HSetTrigger Enables or disables the manage-
ment of triggers
Tome1_2.book Page 554 Vendredi, 28. mai 2010 5:50 17

554

6.2.2 Handling triggers "Before", and "P" for a trigger "after".


• h.TriggerFunction: string that contains the name of
Creating a trigger the HyperFileSQL function that started the trigger,
A "before" trigger or an "after" trigger is created with only if integrity management is turned off.
HDescribeTrigger, in the project initialization code. • h.ToDo: during the execution of a before trigger:
The trigger can be created on one or more files of the ana- •cancel the execution of the Hyper File function by
lysis and for one or more HyperFileSQL functions that assigning "A" to the Hyper File state variable:
handle records. H.ToDo = "A". In this case, the action is not perfor-
med and the function (HAdd, HModify, and so on)
Each time the trigger is executed, a specific procedure is returns True (no error).
executed. •cancel the execution of the Hyper File function by
To create a trigger, use the following syntax: assigning "E" to the Hyper File state variable:
<Result> = HDescribeTrigger
H.ToDo = "E". In this case, the action (HAdd, HMo-
(<FileName>, <HFFunctionName>,… dify, and so on) is not performed and it returns
<ProcedureName>, <Type>) False. The error message is as follows:"The action
• <FileName> corresponds to the logical name of the on XXX file was interrupted by the trigger".
files affected by a process managed by trigger. Enable/Disable a trigger
• <HFFunctionName> corresponds to the name of the
WLanguage functions that trigger the trigger. It is possible at any time to start a process for enabling or
disabling a check performed by a trigger.
• <ProcedureName> corresponds to the associated pro-
cedure called by the trigger. To temporarily disable a specific trigger, use the fol-
lowing syntax:
• <Type> lets you determine the trigger’s type ("before" <Result>=HDeactivateTrigger([<List of HF Files>
or "after"). [, <List of HF Function>]] [, <Type>])
Creating a procedure called by a trigger
Deleting a trigger
A trigger type procedure does not take any parameter.
HDeleteTrigger lets you delete one or more triggers
However, a number of HyperFileSQL state variables are through the following syntax:
positioned before each call: <Result>=HDeleteTrigger([<List of HF Files> [,
• h.filename: string containing the logical name of the <List of HF Functions>]] [, <Type>])
Part 8: File management

file whose trigger is activated.


• h.action: character initialized to "A" for a trigger
Tome1_2.book Page 555 Vendredi, 28. mai 2010 5:50 17

555

7. THE DATA REPLICATION


7.1 Overview of the replication
7.1.1 Overview base.
The replication of data is a powerful feature. Replication Type of replication
is the operation that allows you to keep remote databa- Two types of replication can be implemented:
ses of identical structures updated. Each one of these
databases evolves independently. • Unidirectional replication:
This type of replication consists in performing an
Via replication, operations performed on each one of the update from the "Master" database to the "Subscri-
databases are applied to all the other databases.
ber" databases or from a "Subscriber" database to
WinDev and WebDev enable you to easily perform these the "Master" database.
operations.
• Bidirectional replication:
WinDev/WebDev offers two types of replication: This type of replication consists in performing an
• The logged replication (based on the log process). This update from the "Master" database to the "Subscri-
type of replication is used to replicate the HyperFileSQL ber" databases and from the "Subscriber" databases
databases between themselves. This type of replica- to the "Master" database.
tion can be implemented by the WLanguage functions Files created during a replication
or by WDReplic. The universal replication uses several types of files:
• The universal replication that is used to replicate any •.RPM file: file used to describe a master database as
type of database (a HyperFileSQL database with an well as the databases that subscribe to it.
Oracle database for instance). Universal replication
can be implemented using the assisted universal repli- •.RPL file: file used to describe a subscriber data-
cation. base. A RPL file is created for each subscriber data-
base. This file is found on the subscriber computer.
We shall only present the universal replication. •.RPA file: log file containing the replication informa-
tion. This file is exchanged between the master data-

Part 8: File management


7.1.2 Vocabulary specific to the replication base and the subscriber database.
Databases •.SYN file: file containing information about the situa-
The replication distinguishes between two types of data- tion on the remote database. This file is used to opti-
bases: mize the size of the synchronization files. This file is
• master database found on the master computer and on each subscri-
This is the reference database. All the updates are per- ber computer.
formed on this database:
- modifications performed by the application run on 7.1.3 Note
this computer. To implement the universal replication on databases
- modifications performed on the remote computers other than HyperFileSQL ones, a DateTime item must be
and transmitted by the replication created in each file . This item will be updated by the
• the replica database or subscriber database application when a record is modified or added. If the
This remote database is identical to the "Master" databases use different time zones, we recommend that
database. The modifications performed by the remote you use a universal format (GMT date and time for ins-
computer are applied to this database. The replication tance).
transmits these modifications to the "master" data-
Tome1_2.book Page 556 Vendredi, 28. mai 2010 5:50 17

556

7.2 Implementing the universal replication


7.2.1 Activation This code line creates the MasterReplica.RPM file on
To enable the universal replication, use HSetReplication disk. Then, all you have to do is write the subscribers into
associated with the rplReplicationUniversal constant . this file.
This function is used to disable the standard replication 7.2.3 Declaring the subscriber databases
mode (if it was enabled) and to enable the universal
replication. This operation must be performed once only for each
subscriber database. This operation must be performed
7.2.2 Declaring the master database on the master database.
This operation must be performed once only on the mas- HCreateSubscriberReplica enables you to declare a new
ter database. subscriber. This function creates a subscriber (RPL file)
with the specified name. This functions also returns a
HCreateMasterReplica enables you to declare the mas- subscriber number.
ter database.
Note: If data can be stored in the current directory, the Note: HCreateSubscriberReplica uses specific parame-
following code line can be used: ters for the universal replication. See the help for the
function for more details.
HCreateMasterReplica("")

7.3 Replication between heterogeneous databases


HCreateMoveableReplica creates a log file (.RPA file).
HRplFilterProcedure Used to specify a specific filter
This file is transmitted and run by HSynchronizeReplica. procedure when a given file is
replicated.
Caution: By default, the master has priority when the
synchronisation is performed (HSynchronizeReplica): if Notes:
a replication is performed from the subscriber to the
master, the data found in the master database will not be •The exchanges of ".RPA" files are not always symme-
updated. We recommend that you use another constant trical: it is possible to create and execute several logs
in one direction without creating or executing a single
Part 8: File management

(rplMostRecentFirst for instance).


log in the other direction. However, to improve perfor-
Two specific functions can also be used: mance, you should avoid performing exchanges
always in the same direction.
HRplDeclareLink Used to specify to the replication
engine that a link was found •The replication respects the filters applied to the
between two files. The engine will tables or to the files (except for links, to respect the
follow the link to get the list of integrity).
records that must be replicated in
the second file. •A filter can be set up on the master side: the subscri-
bers will receive a subset of the data from the master
HRplManageFile Defines the options used for database. In this case, there is no need to implement
the universal replication of a a filter for the subscriber database.
file. If, due to the filter, a record is not "visible" anymore
on the master database, this record will be conside-
HRplManageItem Defines the options used for red as being deleted. It will be automatically deleted
the universal replication of an from the subscriber computer.
item.
Tome1_2.book Page 557 Vendredi, 28. mai 2010 5:50 17

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.

Part 8: File management


Tome1_2.book Page 558 Vendredi, 28. mai 2010 5:50 17

558

8. MANAGING "BACK OFFICE" FILES WebDev


8.1 Overview
Most interactive site available on the Internet are meant To build the features of the Back Office, the use of the
to run in parallel with so called traditional applications, WinDev IDE is recommended.
usually running on Windows.
WebDev offers several possibilities to manage the "Back
For an e-commerce site, for instance: Office":
• the "Front Office" will be on the Internet side, and will • update by email,
consist of the product description and order taking. • remote access to HyperFileSQL
• the "Back Office" will manage the orders placed: pac- • the replication.
king list, invoice, return form, statistics, past due
payments, …

8.2 Update by email


The operation consists in synchronizing two databases, The Front Office application sends an email at each
the database of the Back Office application and the modification of the database.
database of the Front Office application, through a set of The Back Office application automatically reads emails
emails and a procedure for reading emails. at regular time intervals in order to update the main data-
base.

8.3 Remote access to Hyper File


8.3.1 Definition 8.3.2 Details of the three use modes
Part 8: File management

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).

8.4 The data replication


8.4.1 Overview In this example:
The replication of data is a powerful feature. Replication • the "Orders" file:
is the operation that allows you to keep remote databa- •located on the Web server only contains orders ente-
ses of identical structures updated. Each one of these red by customers using the Internet site.
databases evolves independently: different operations •located at the company’s headquarters only contains
are performed on these databases. the orders entered by the sales people.
Via replication, operations performed on each one of the The database at the headquarters must be updated with
databases are applied to all the other databases. the orders taken on the site.
Data replication can easily be applied to a WebDev site.
In this case, the replication allows the following to be • the "Product" file:
kept up to date: •located on the Web server must contain all the pro-
• the database located on the Web server, used by the duct references.
WebDev site. •located at the company’s headquarters can evolve,
• the databased located at the company’s headquarters taking new products into account.
and used by a WinDev Back office application for ins- Therefore the database of the WebDev site must be
tance. updated with the new products.
Let’s look at a classic use example of data replication: Thanks to the replication, the WebDev site located on the
A company offers two ways for taking orders: Web server and the WinDev application located at the
company’s headquarters both have their own complete
• directly from the company’s web site: customers enter
database.
their orders, specifying their information and the pro-

Part 8: File management


ducts ordered. The database of the WebDev site (or Replica) is identical
• by sales people, who use an order taking application in to the "master" database, during its initialization.
Windows. This application is used at the company’s Regularly, a "Synchronization" of these databases is
headquarters, as a Back Office application. used to take into account the modifications performed
on each one of the different databases.

8.4.2 Implementing the replication


See the ’Data replication’ chapter, page 578, and the
online help for more details.
Tome1_2.book Page 560 Vendredi, 28. mai 2010 5:50 17

560

9. ACCESSING THIRD-PARTY DATABASES


9.1 Overview
There are several execution modes for SQL queries accor- type of access. The HyperFileSQL functions (HReadxxx,
ding to the type of access to the database. …) cannot be used.
• Access to a HyperFileSQL database (free distribution • ODBC access via the OLE DB provider:
with your WinDev applications and your WebDev sites): This type of access uses a specific OLE DB provider.
No setup constraint. This type of access is not recommended because it is
The SQL and HyperFileSQL functions (HReadxxx, and slower than access via an ODBC driver. Indeed, the per-
so on) can be used with this type of access. formance is not as good as with a direct ODBC driver
• Access via a native access: Native Oracle, SQL Server, because the access is performed both via the ODBC
AS/400 access, … driver and the OLE DB provider.
For each type of native access, you must have the cor- The HyperFileSQL (HReadxxx, …) and SQL functions
responding additional module. Contact the sales office can be used with this type of access.
about availability for your database. You must define the characteristics of the connection
With Oracle or SQL Server, a client layer must be instal- to the database in the ODBC administrator of Win-
led on the user computer . dows. The provider as well as MDAC 2.6 (or later) must
The SQL and HyperFileSQL functions (HReadxxx, and be installed on the computer.
so on) can be used with this type of access. This type of • Access via an OLE DB provider:
access is faster than accesses via ODBC or via an OLE This type of access uses an OLE DB provider. The provi-
DB provider. der as well as MDAC 2.6 (or later) must be installed on
• Access via direct OLE DB driver the computer.
The characteristics of the connection to the database The SQL and HyperFileSQL functions (HReadxxx, and
must be defined in the ODBC administrator of Win- so on) can be used with this type of access.
dows. Only the SQL functions can be used with this

9.2 Specific features


Part 8: File management

• xBase access possible via HyperFileSQL: • INI files:


Specific xBase functions can be used in addition to the Use the WLanguage functions specific to INI files (Ini-
standard HyperFileSQL functions (HDBOpen , …). Read, IniWrite , …).
• ASCII Files : • Management of the registry:
Use the WLanguage functions specific to external files Use the WLanguage functions specific to the registry
(fOpen, fRead, fWrite, …). (RegistryQueryValue , RegistrySetValue).

9.3 Functions for managing the external databases


See the online help for more details about the functions to the database, execution of a query, record locking,
to use for managing a third-party database (connection etc.)
Tome1_2.book Page 561 Vendredi, 28. mai 2010 5:50 17

561

10. HYPERFILESQL FUNCTIONS


The following functions are used to manage HyperFileSQL files:
ScreenToFile Automatically initializes the memory value of the file items with the value of the win-
dow controls
WithSpace Adds or removes the spaces found on the right of a text item when reading it
FileToScreen Automatically initializes the controls of a window with the values of the associated
items found in the current record (loaded in memory) of the HyperFileSQL file
FileToPage Automatically initializes the controls of a page with the values of the associated items
found in the current record (loaded in memory) of the HyperFileSQL file
HActivateFilter Enables the filter that was previously created for the specified file
HActivateAutoFilter Enables an automatic filter on the linked files when browsing an XML file
HActivateTrigger Re-enables a trigger previously disabled by HDisableTrigger
HAdd Adds the record found in memory to the data file
HAlias Creates a logical alias of a file or cancels all the existing aliases
HCancelAlias Cancels an alias previously declared by HAlias
HCancelDeclaration Deletes a declaration previously performed by HDeclare, HDeclareExternal or HDes-
cribeFile
HCancelSeek Cancels the current search criterion
HLinkMemo Enables you to associate a file with a binary memo item
HForward Moves several records forward from the current position in the file, according to a spe-
cified item
HLockFile Locks a file and restricts the access to this file for all the other applications or sites
HLockRecNum Locks a record and restricts the access to this record for all the other applications or
sites
HChangeKey Changes the search key

Part 8: File management


HChangeConnection Changes the connection to a database used for a file. This change will be taken into
account the next time the file is opened
HChangeLocation Modifies the search mode of the data files
HChangeName Modifies the physical name of a data file
HChangeDir Modifies the access path to a data file
HChangeLogDir Modifies the access path to a log file (JournalOpération file and JournalIdentification
file)
HChangeRplDir Modifies the location of the description of the subscriber replica (RPL file). This func-
tion must be used on the subscriber computer
HConnect Redefines one or more parameters of a connection using native access or using OLE
DB access on a specific table or a set of tables
HConnectRemoteAccess Opens an analysis in HyperFileSQL 7 format via remote access
HBuildKeyValue Builds the value of a composite key to create a filter or to perform a search
HBuildKeyValueANSI Allows you (on a Unicode platform, Pocket PC for instance) to build the value of a com-
posite key in order to store this composite key in a HyperFileSQL data file
HConvert Converts a numeric value into a binary string in order to perform a search on a numeric
key
HCopyRecord Copies the content of the current record (loaded in memory) to the current record of
another file
HCreation Creates an empty data file (".FIC" extension) with the index file and the memo file if
necessary
HCreationIfNotFound Creates an empty data file (if the file does not exist) or opens a file (if the file exists)
HCreateSubscriberReplica Creates the description file of a subscriber replica (ReplicaAbonne.RPL file)
Tome1_2.book Page 562 Vendredi, 28. mai 2010 5:50 17

562

HCreateMasterReplica Creates the description file of a master replica (MasterReplica.RPL file)


HCreateMoveableReplica Creates a file that can be used to replicate the data from the current database toward
a remote database (for sending via email or CD for instance)
HCreateView Creates a HyperFileSQL view
HRecordDate Returns the date and time of the last write operation performed on a record in a Hyper-
FileSQL file
HUnlockFile Unlocks a file previously locked by HLockFile
HUnlockRecNum Unlocks a record
HDeclare Declares a file description (found in another analysis) in the current project
HDeclareExternal Temporarily imports into the current analysis the description of a file from an existing
HyperFileSQL file
HDescribeConnection Describes a temporary connection
HDescribeFile Describes a temporary data file
HDescribeFullTextIndex Describes a full-text index in a data file created by programming.
HDescribeLink Describes a temporary link between two files
HDescribeItem Describes an item found in a temporary data file
HDescribeTrigger Not available in this version
HLast Points to the last record of a file
HDeactivateFilter Temporarily disables the filter on a file (view or query)
HDeactivateAutoFilter Disables an automatic filter on the linked files when browsing an XML file
HDeactivateTrigger Disables a trigger
HDeleteTrigger Destroys a trigger
HDeleteView Destroys a view that was previously created
HWrite Writes a record into a data file without updating the indexes corresponding to all the
keys used in the file
HOut Enables you to find out whether the record on which you want to position is outside the
file, the filter, the view or the query
HRecordToXML Retrieves the structure and the value of the current record and exports them to a cha-
Part 8: File management

racter string in XML format


HError Returns the number of the last error triggered by the HyperFileSQL engine
HErrorLock Enables you to find out whether a lock error occurred
HErrorDuplicates Enables you to find out whether a duplicate error occurred
HErrorStatusModification Returns the status of a record during a modification conflict
HErrorInfo Returns detailed information about the last error triggered by the HyperFileSQL engine
HErrorIntegrity Enables you to find out whether an integrity error occurred
HErrorModification Returns the value of an item during a modification conflict
HErrorPassword Enables you to find out whether a password error occurred on this file
HState Enables you to find out the state of a record
HExecuteQuery Initializes a query created by the query editor and declares this query to the HyperFi-
leSQL engine
HExecuteSQLQuery Initializes a query written in SQL language and declares this query to the HyperFileSQL
engine
HExecuteView Runs a view that was previously created
HExportXML Exports the records from a file (HyperFileSQL or OLEDB), view or query into an XML file
HExtractMemo Extracts the content of a binary memo item in a file
HClose Closes a file or all the opened files
HCloseAnalysis Closes the current analysis
HCloseConnection Closes a connection to a database
HFileExist Enables you to find out whether a file exists
HFilter Defines and enables a filter on a file, view or query
Tome1_2.book Page 563 Vendredi, 28. mai 2010 5:50 17

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

Part 8: File management


replica (".RPL" extension)
HNoModif Prevents from modifying a file. The records can be accessed in read-only
HLogInfo Inserts some comments when logging an operation
HLogRecreate Enables you to recreate an empty log. This function is used to reset the log to 0 for ins-
tance after a backup or a replication. The content of the existing files is lost
HLogRestart Restarts the log process on a file. This log operation was stopped by HStopLog
HLogStop Stops the log process on a file. The operations performed in the logged file are not
saved anymore
HFree Transforms the crossed records into deleted records
HFreePosition Deletes a position stored by HSavePosition
HListAnalysis Returns the list of analyses available in a given directory
HListKey Returns the list of keys found in a file recognized by the HyperFileSQL engine
HListConnection Returns the list of connections defined in the application or in the site (connections
defined in the analysis and/or dynamically defined)
HListFile Returns the list of files found in the current analysis or in a specific analysis recognized
by the HyperFileSQL engine
HListFullTextIndex Returns the list of full-text indexes for a file (a query or a view) recognized by the Hyper-
FileSQL engine
HListLink Returns the list of links (Merise type) found in the current analysis or in a specific ana-
lysis
HListQueryParameter Returns the list of parameters for a query created in the query editor
HListProvider Returns the list of OLE DB providers installed on the computer
HListREP Returns the list of assignments for the files found in an analysis
Tome1_2.book Page 564 Vendredi, 28. mai 2010 5:50 17

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

HOpenAnalysis Opens an analysis in HyperFileSQL format


HOpenConnection Establishes a connection to a database
HPass Defines the password used to create or open a file
HGetCurrentPosition Returns the approximate position of the current record in the file
HSetPosition Points to a record from the approximate position of one of its items (the record is read)
HPost Stores a unique computer ID number in order to use network logging and transactions
HPrevious Points to the previous record in the file (the record is read)
HFirst Points to the first record of a file (the record is not read)
HPrepareSQLQuery Initializes a query written in SQL language and declares this query to the database ser-
ver in order to optimize the next executions of this query
HPriority Enables you to find out and modify the priority of the calling application.
HPriorityClient Modifies the priority of a client application.
HCross Crosses a file record
HReset Initializes one or more variables of the file items with their default values
HSeek Points to the first file record whose value for a specific item is greater than or equal to
a sought value
HSeekLast Points to the last file record whose value for a specific item is less than or equal to a
sought value (the record is not read)
HSeekFirst Points to the first file record whose value for a specific item is greater than or equal to
a sought value
HBackward Moves backward several records from the current position in the file, according to a
specified item
HRetrieveRecord Returns the content of the current record
Tome1_2.book Page 565 Vendredi, 28. mai 2010 5:50 17

565

HRetrieveItem Returns the content of an item for the current record


HRegenerateFile Regenerates a file from its log
HIndexingInProgress Indicates that a data file is currently re-indexed and returns the percentage of the file
already re-indexed
HIndex Rebuilds the index of a file
HRestorePosition Restores a file context that was previously saved
HRplDeclareLink Declares a (1,1) (0,n) link between two tables
HRplFilterProcedure Defines the WLanguage procedure that will be called whenever a replication operation
is performed on a given file
HSavePosition Stores the current context of a file
HSecurity Enables or disables the security mechanism
HStatCalculate Performs some statistical calculations on the keys of a file
HStatDate Returns the date of the last update for the index statistics
HStatTime Returns the time of the last update for the index statistics
HStatNbDuplicates Returns the number of duplicates for a given item
HStatNbRec Returns the number of entries for a given item
HStatNbRecRange Returns an estimate regarding the number of entries for an item within an interval of
values
HSubstDir Replaces the logical name of the data directory (specified in the analysis) by a physi-
cal name
HNext Points to the next file record (the record is not read)
HDelete Deletes a record from a file
HDeleteSet Deletes a set of stored procedures from a HyperFileSQL server.
HDeleteAll Deletes all the records from a file or from a query.
HOnError Customizes error management
HSynchronizeReplica Synchronizes a master replica and a subscriber replica
HTransactionCancel If a transaction is in progress, cancels all the operations performed on the files in
transaction since the start of the transaction.

Part 8: File management


If no transaction is in progress, restores the database’s integrity and cancels the
transaction that failed (case of a power outage for instance)
HTransactionStart Starts a transaction on HyperFileSQL files, and creates the transaction file
HTransactionEnd Validates the current transaction:
• the modifications performed on the data file since the start of the transaction
(HTransactionStart) are validated
• the transaction file is deleted (if the transaction is the last transaction in progress
for a network application)
• the records locked in read-only by the transaction are unlocked
HTransactionInterrupted Enables you to find out whether a transaction was interrupted (the transaction was
neither validated nor canceled). The characteristics of the interrupted transaction are
returned by HyperFileSQL variables
HTransactionFree Transforms all the records "in transaction" into "normal" records if these records do
not belong to a current transaction. If a record found in the specified data file is consi-
dered as being in transaction but does not belong to any current transaction, it is auto-
matically freed
HSortView Sorts a view by creating an index based on one of the view’s items
HFound Checks whether the current record corresponds to the current filter or to the current
search
HCheckIndex Checks whether the data found in the index file (.NDX file) properly references the
data found in the data file (.FIC)
Tome1_2.book Page 566 Vendredi, 28. mai 2010 5:50 17

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

11. HYPERFILESQL PROPERTIES


The following properties are associated with HyperFileSQL files:
Abbreviation Returns the abbreviation of the file defined in the data model editor when describing
the file
Access Enables you to find out and modify the type of access for a connection
Charset Enables you to find out the character set used by a HyperFileSQL file
Year Retrieves or modifies the year in a Date item
Database Enables you to find out and modify the database associated with a connection
Binary Identifies a binary item
MaxValue Retrieves the upper bound of the current filter (defined by HFilter) for a data file, a
view or a query
MinValue Retrieves the lower bound of the current filter (defined by HFilter) for a data file, a view
or a query
MaxLinkedCardinality Configures the maximum cardinality for the linked item in a link
MinLinkedCardinality Configures the minimum cardinality for the linked item in a link
MaxSourceCardinality Configures the maximum cardinality for the source item in a link
MinSourceCardinality Configures the minimum cardinality for the source item in a link
CompositeKey Identifies a composite key item
LinkedKey Returns or modifies the item of the linked file used in the link
SourceKey Returns or modifies the item of the source file used in the link
SQLCode Returns a string containing the SQL code of a query created in the query editor.
Component Configures the components of a composite key
Compression Configures the compression for the data of a connection.
MmoPackMethod Configures the compression mode of the MMO file associated with the data file
FilterCondition Returns the selection condition implemented by HFilter on a data file, a HyperFileSQL

Part 8: File management


view or a query
Connection Enables you to find out the connection currently associated with a data file
CryptMethod Enables you to manage the type of encryption for the communication between the
Client computers and the HyperFileSQL server
FicCryptMethod Configures the encryption mode of the data file
MmoCryptMethod Configures the encryption mode of the memo file associated with the data file
NdxCryptMethod Configures the encryption mode of the index file associated with a data file
CtAccess Manages the type of access to the file during the OLE DB connection to a specific
table (takes into account the modifications performed by HConnect)
CtDescribedAccess Manages the type of access to the file during the OLE DB connection to a specific
table (ignores the modifications performed by HConnect)
CtDatabase Manages the OLE DB data source during the OLE DB connection to a specific table
(ignores the modifications performed by HConnect)
CtDescribedDatabase Manages the OLE DB data source during the OLE DB connection to a specific table
(ignores the modifications performed by HConnect)
CtExtendedInfo Enables you to find out the additional information inserted into the string for connec-
ting to the database
CtInitialCatalog Enables you to identify the default database defined for the access
CtDescribedCaption Configures the caption of the connection to the OLE DB data source
CtDescribedPassword Defines the password used to open the file during an OLE DB connection (file defined
dynamically only)
CtCursorOptions Enables you to find out the type of cursor used during a connection to an external
database
Tome1_2.book Page 568 Vendredi, 28. mai 2010 5:50 17

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

Memo Identifies a memo item


Millisecond Retrieves or modifies the milliseconds or the number of milliseconds in a Date item
("Date and Time" or "Duration" format)
Minute Retrieves or modifies the minutes or the number of minutes in a Date item ("Date and
Time" or "Duration" format) or in a Time item
Month Retrieves or modifies the month in a Date item ("Simple Date" or "Date and Time"
format)
Password Enables you to define the password of the user who is using the connection
WDD55Password Gives the password to use to handle a file in Hyper File 5.5 format
NbComponent Returns the number of components in a composite key
NbArrayElement Configures the number of elements in an array item
NbItem Returns the total number of key items (including composite keys) found in a record for
a file described in the data model editor, defined dynamically, or a HyperFileSQL view
or query
NbKeyItem Returns the total number of key items (including composite keys) found in a record for
a file described in the data model editor, defined dynamically, or for a HyperFileSQL
view or query
NbMemoItem Returns the total number of memo items found in a record of a file described in the
data model editor, a file described dynamically, a HyperFileSQL view or a query
NbThumbnail Returns the number of thumbnails generated for the item
NbDescribedThumbnail Returns the number of thumbnails described for the item
Name Manages the name of the different HyperFileSQL objects
Name55 Manages the logical name of a file in Hyper File 5.5 format
DescribedName Manages the logical name of a data file
PhysicalName Manages the physical name of a data file
DescribedPhysicalName Manages the physical name of the HyperFileSQL files (ignores the name changes per-
formed by HChangeName)
NewRecord Enables you to find out whether a record was just entered in the data file.
Null Enables you to manage the NULL value in the items of the HyperFileSQL files

Part 8: File management


NullSupported Enables you to manage the NULL value in a HyperFileSQL file
Numeric Identifies a numeric item
GenerationNumber Defines the generation number of the physical file associated with the specified logi-
cal file
CursorOptions Enables you to manage the type of cursor used during a connection (HyperFileSQL
Client/Server, OLE DB, …).
Date Retrieves and modifies the date in a Date item ("Date and Time" format)
DecimalPart Enables you to find out and modify the number of decimal digits found in a numeric
item
IntegerPart Enables you to find out and modify the number of digits found in the integer part of a
numeric item
Time Retrieves and modifies the hour in a Date item ("Date and Time" format)
PasswordProtected Enables you to find out whether a file is password-protected
Provider Enables you to manage the type of a connection (HyperFileSQL Client/Server, OLE
DB, …).
ModificationRule Manages the modification rule (management of integrity) used in a link
DeletionRule Manages the deletion rule (management of integrity) used in a link
Directory Manages the physical directory of HyperFileSQL files (takes into account the directory
changes performed by HChangeDir or HSubstDir)
DescribedDirectory Manages the physical directory of HyperFileSQL files (ignores the directory changes
performed by HChangeDir or HSubstDir)
LogDirectory Manages the directory of the log file described in the analysis
Tome1_2.book Page 570 Vendredi, 28. mai 2010 5:50 17

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

12. SQL FUNCTIONS


The following SQL functions can be used on the queries • phonetic - SOUNDEX
written in SQL code (classified by theme): - SOUNDEX LIKE
• extracting characters: - LEFT
- SOUNDEX2,
- RIGHT
- SOUNDEX2 LIKE
- MID, SUBSTR and
SUBSTRING • managing the dates - ADD_MONTH
- LAST_DAY
• deleting characters: - LTRIM
- MONTHS_BETWEEN
- RTRIM
- NEW_TIME
- TRIM
- NEXT_DAY
• substituting characters: - REPLACE
- ROUND
- TRANSLATE
- SYSDATE
• merging strings: - CONCAT
- TRUNC
• string completion: - LPAD
• managing the null value - COALESCE
- RPAD
- IF NULL
• modifying the case of a cha- - LOWER - IS NULL
racter string: - UPPER - NVL
• length of a character string: - LEN and LENGTH • Conditional statement -DECODE
-CHARACTER_LENGTH
- CHAR_LENGTH See a specific documentation about the SQL language
- OCTET_LENGTH for more details.
To find out all the SQL commands (functions, clauses,
• position of a character string: - INSTR operators, and so on) that can be used in an SQL query
- PATINDEX manage by HyperFileSQL, see the online help.

Part 8: File management


- POSITION
Notes:
• number of records in a file: - COUNT • These statements can be used:
• calculating numeric values: - AVG •In the SQL code of the queries created in the query
- MAX editor. These queries will be run by HExecuteQuery.
- MIN •in the SQL code of the queries run by HExecuteSQL-
- SUM Query.
• selecting the first n records or - BOTTOM • Unless stated otherwise, these functions can be used
the last n records: with all types of data sources (Oracle, Access, SQL Ser-
- TOP
ver, …).
• ASCII code: - ASCII
Tome1_2.book Page 572 Vendredi, 28. mai 2010 5:50 17

572

12.1 Function details


12.1.1 LEFT Example: the following SQL code extracts the third and
LEFT extracts the left part (i.e. the first characters): fourth characters from the customer name:
• of a file item’s content, SELECT MID(CUSTOMER.Name, 3, 2)
• of a character string. FROM CUSTOMER
Use format: SUBSTR
LEFT(… The SUBSTR function can only be used with an Oracle
CharacterString or Item, … type data source.
NbCharactersToExtract) Use format:
Example: the following SQL code lists the first 2 digits of SUBSTR(…
the customers’ zip codes: CharacterString or Item, …
StartPosition,…
SELECT LEFT(CUSTOMER, ZipCode, 2)
NbCharactersToExtract)
FROM CUSTOMER
Example: the following SQL code extracts the third and
12.1.2 RIGHT fourth characters from the customer name:
RIGHT extracts the right part (i.e. the last characters): SELECT SUBSTR(CUSTOMER.Name, 3, 2)
• of a file item’s content, FROM CUSTOMER
• of a character string.
Use format: SUBSTRING
The SUBSTRING function can only be used on an SQL ser-
RIGHT(…
CharacterString or Item, …
ver type data source.
NbCharactersToExtract) Use format:

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

Use format: • the content of an item,


// Del. spaces found to the left • a character string.
LTRIM(CharacterString/Item)
// Del. list of characters
Use format:
LTRIM(… // Del. spaces on the left
CharacterString or Item,… RTRIM(CharacterString or Item)
CharactersToDelete) // Del. list of characters
Example: the customer’s name is preceded by a title RTRIM(…
("Mr.", "Mrs." or "Ms."). The following SQL code is CharacterString or Item,…
used to: CharactersToDelete)
• delete the title from each name ("M", "r" and "s" let- Example: the following SQL code deletes the ’E’, ’U’ and
ters as well as the period character), ’R’ characters located to the right of the customer name:
• delete the space character found in front of the name
SELECT RTRIM(CUSTOMER.Name, ’EUR’)
(space character found between the title and the
FROM CUSTOMER
name).
// Delete the characters In this example:
SELECT LTRIM(CUSTOMER.Name, ’Ms.’)
FROM CUSTOMER
If the name of the customer The returned string is:
// Delete the space character
is:
SELECT LTRIM(CUSTOMER.Name) ’DUVALEUR’ ’DUVAL’
FROM CUSTOMER ’DRAFUREUR’ ’DRAF’
In this example: ’Galteur’ ’Galteur’
If the name of The returned string is: ’FOURMALTE’ ’FOURMALTE’
the customer is: ’BENUR’ ’BEN’
’Ms. DOE’ ’DOE’
’Mr. CLARK’ ’CLARK’
12.1.6 TRIM
TRIM returns a character string:
’Mrs. Davis’ ’Davis’
• without the space characters on the left and on the

Part 8: File management


right.
12.1.5 RTRIM
• without a character string found at the beginning or at
The RTRIM function returns a character string: the end of the string.
• without the space characters on the right, • without a character string found at the beginning of the
• without a list of characters. string.
The characters are deleted from the right to the left. • without a character string found at the end of the
This deletion is case sensitive (uppercase/lowercase). string.
This deletion stops when a character that does not
belong to the specified list is found. The characters are deleted from the right to the left. This
The deletions of specific characters cannot be perfor- deletion is case sensitive (lowercase/uppercase charac-
med on an Access or SQL Server data source. ters). This deletion stops when a character that does not
belong to the specified string is found.
The character string passed as parameter to the function
corresponds to:
Tome1_2.book Page 574 Vendredi, 28. mai 2010 5:50 17

574

Use format: replace has no corresponding character, this character is


deleted.
// Del. spaces on the left and on the
right The replacement is performed from the right to the left.
TRIM(Initial expression) This replacement is case sensitive (uppercase/lowercase
// Del. character string characters).
// at the beginning and the end of the Use format:
string
// Replacing the characters
TRIM(Initial expression, …
TRANSLATE(Initial expression, …
String to delete)
Characters to replace, …
// Del. spaces on the left and on the
New characters)
right
TRIM(Initial expression)
// Del. character string
12.1.9 CONCAT
// at the beginning and the end of the CONCAT concatenates several strings together.
string Use format:
TRIM(Initial expression, …
String to delete) CONCAT(String 1, String 2 [, …
// OR , String N])
TRIM(BOTH String to delete FROM Ini- CONCAT is not supported by Sybase.
tial expression)
// Del. string at the beginning of 12.1.10 LPAD
the string
TRIM(LEADING String to delete FROM
LPAD returns a string whose length is defined. To reach
Initial expression)
the requested length, the string is completed to the left:
// Del. string at the end of the • by space characters.
string • by a given character or string.
TRIM(TRAILING String to delete FROM Use format:
Initial expression)
// Completion with space characters
12.1.7 REPLACE LPAD(Initial expression, Length)

REPLACE returns a character string:


Part 8: File management

// Completion with a character


• by replacing all the occurrences of a word found in cha- LPAD(Initial expression, Character)
racter string by another word. // Complete with a
• by replacing all the occurrences of a word found in a // character string
string. LPAD(Initial Expression, …
Character string)
The replacement is performed from the right to the left.
This replacement is case sensitive (uppercase/lowercase
characters). This replacement stops when a character 12.1.11 RPAD
that does not belong to the specified string is found. RPAD returns a string whose length is defined. To reach
Use format: the requested length, the string is completed to the right:
• by space characters.
// Replace all the
// occurrences of a word by another • by a given character or string.
word Use format:
REPLACE(Initial expression, …
// Completion with space characters
String to replace, New string)
RPAD(Initial expression, Length)
// Delete all the
// Completion with a character
// occurrences of a word
RPAD(Initial expression, Character)
REPLACE(Initial expression, …
// Complete with a
String to delete)
// character string
RPAD(Initial expression, …
12.1.8 TRANSLATE Character string)
TRANSLATE returns a character string by replacing all the
specified characters by other characters. If a character to
Tome1_2.book Page 575 Vendredi, 28. mai 2010 5:50 17

575

12.1.12 LOLOWER data source.


The LOWER function converts to lowercas: Use format:
• the content of an item, LENGTH(…
• a character string. CharacterString or Item)

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

Example: the following SQL code converts to lowercase 12.1.15 INSTR


the customers’ firstname:
The INSTR function returns the position of a character
SELECT LOWER(CUSTOMER.FirstName) string. This character string can be sought i:
FROM CUSTOMER • the content of an item,
• a character string.
12.1.13 UPUPPER The INSTR function can only be used on an Oracle type
The UPPER function converts to uppercase: data source that supports the SQL-92 standard.
• the content of an item, Use format:
• a character string.
INSTR(…
The UPPER function cannot be used on an Access type CharacterString or Item, …
data source. StringSought, …
Use format: StartPosition, Occurrence)
UPPER(CharacterString or Item) Example: the following SQL code returns the position of
Example: the following SQL code converts the customers’ the first occurrence of the letter "T" in each customer’s
cities into uppercase: city nam:
SELECT INSTR(CUSTOMER.CITY, ’T’, 1,
SELECT UPPER(CUSTOMER.City)
1)
FROM CUSTOMER

Part 8: File management


FROM CUSTOMER

12.1.14 LEN and LENGTH


12.1.16 PATINDEX
The LEN and LENGTH functions return the size (the num-
ber of characters) of an expression. PATINDEX returns the position of the first occurrence of a
character string corresponding to a specified value (with
This size includes all the characters, including the space wildcard characters).
characters and the binary 0.
LEN The authorized wildcard characters are:
The LEN function can be used with all types of database, • ’%’ : represents zero, one or more characters.
except the Oracle type data sources. For Oracle type data • ’_’ : represents a single character.
sources use the LENGTH function. These generic characters can be combined.
Use format:
This character string can be sought in:
LEN(CharacterString or Item) • the content of an item,
Example: the following SQL code lets you obtain the size • a character string.
of the customers’ names: The PATINDEX function cannot be used with a HyperFi-
SELECT LEN(CUSTOMER.Name) leSQL 7 or SQL Server type data source.
FROM CUSTOMER Use format:
PATINDEX(ValueSought, …
LENGTH CharacterString or Item)
The LENGTH function can only be used on an Oracle type
Tome1_2.book Page 576 Vendredi, 28. mai 2010 5:50 17

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

Part 8: File management


FROM CUSTOMER, ORDERS (based on an English-language algorithm).
WHERE CUSTOMER.Customer- Use format:
Num=ORDERS.CustomerNum
GROUP BY CustomerName // ASCII code of a character
ORDER BY TotalIncTax DESC ASCII(Character)
// ASCII code of the first character
Note: we recommend using the BOTTOM function on a // in a string
sorted query. Otherwise, the records returned by BOTTOM ASCII(Character string)
will be selected according to their record number.
Note: the SOUNDEX function used on different databases
12.1.24 TOP (HyperFileSQL, Oracle, MySQL, and so on) can return dif-
The TOP function returns the first n records of the query ferent results depending on the database used.
result. SOUNDEX LIKE is not supported by Oracle, MySQL, Pro-
The TOP function cannot be used on an Oracle type data gress or Informix. SOUNDEX is not supported by Informix.
source.
12.1.27 SOUNDEX2, SOUNDEX2 LIKE
Use format:
SOUNDEX2 returns the phonetic representation of a cha-
TOP NbrOfFirstSelectedRecord racter string (based on an algorithm close to French).
Example: the following SQL code lists the 10 best custo- Use format:
SOUNDEX2(String)

SOUNDEX2 and SOUNDEX2 LIKE are not supported by


Oracle, SQL Server, MySQL, Progress, Informix or DB2.
Tome1_2.book Page 578 Vendredi, 28. mai 2010 5:50 17

578

12.1.28 ADD_MONTHS Use format:


ADD_MONTHS lets you add several months to a speci- ROUND(Date, Format)
fied date.
Use format: ROUND is not supported by Progress, DB2 and Sybase.

ADD_MONTHS(Date,Number of months) 12.1.34 SYSDATE


ADD_MONTHS is not supported by SQL Server, MySQL, SYSDATE is used to find out the current date and time.
Informix, DB2 or Sybase. Use format:
SYSDATE
12.1.29 LAST_DAY
LAST_DAY gives you the date of the last day of the speci- SYSDATE is not supported by Informix and Sybase.
fied month.
Use format: 12.1.35 TRUNC
TRUNC is used to truncate the date to the specified for-
LAST_DAY(Date) mat.
LAST_DAY is not supported by Informix, DB2 or Sybase. Use format:
TRUNC(Date, Format)
12.1.30 MONTHS_BETWEEN
MONTHS_BETWEEN is used to find out the number of TRUNC is not supported by SQL Server, MySQL, Progress,
months between two specified dates. DB2 and Sybase.
Use format:
12.1.36 COALESCE
MONTHS_BETWEEN(Date1, Date2) COALESCE is used to find the first not-null expression
MONTHS_BETWEEN is not supported by MySQL, Infor- among its arguments.
mix, DB2 or Sybase. Use format:
COALESCE(Param1, Param2, …)
12.1.31 NEW_TIME
NEW_TIME is used to find out a date after converting its COALESCE is not supported by Progress or Informix.
time zone.
12.1.37 NVL, IF_NULL, IS_NULL
Part 8: File management

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])

DECODE is not supported by SQL Server, MySQL, Pro-


gress, Informix, DB2 and Sybase.
Tome1_2.book Page 579 Vendredi, 28. mai 2010 5:50 17

579

13. HYPERFILESQL CLIENT/SERVER


13.1 Overview
WinDev enables you to create applications that access computers) and in storing the databases and the proces-
the HyperFileSQL Client/Server databases. ses on a server. This operating mode makes response
A HyperFileSQL Client/Server application consists in run- times faster and more reliable, and simplifies the mainte-
ning the application on different computers (called client nance of the database.

Part 8: File management

WinDev enables you to: • modify an existing application into a HyperFileSQL


• create a HyperFileSQL Client/Server application from Client/Server application.
scratch.

13.2 Implementing a Client/Server application


The steps for implementing a HyperFileSQL Client/Server 4. Use the application.
application are as follows:
1. Configure the server used. See the online help for more details about HyperFileSQL
2. Connect the client computers to the server. Client/Server.
3. Configure the data files on the server.
Tome1_2.book Page 580 Vendredi, 28. mai 2010 5:50 17

580

14. HYPERFILESQL CLIENT/SERVER FUNCTIONS


The following functions are used to manage the HyperFileSQL Client/Server engine:
HActivateServerTrigger Re-enables a server trigger previously disabled by HDeactivateServerTrigger.
HAddGroup Adds a group of users
HAddLink Adds an integrity rule between two files on the server
HAddTask Adds a scheduled task on the server defined by the connection.
HAddUser Adds a user to a database
HCancelBackup Cancels a backup in progress.
HStopServer Stops a server
HLoadParameter Reads a parameter that was previously saved from a stored procedure by HSave-
Parameter.
HCopyFile Copies a HyperFileSQL file
HDisconnectClient Displays a message on the client computers and disconnects the application
HDescribeServerTrigger Adds or modifies a server trigger.
HStartServer Used to start a server (uses MantaManager)
HDeactivateServerTrigger Disables a Hyper File Client/Server server trigger. This trigger can be re-enabled
by HActivateServerTrigger.
HDeleteServerTrigger Destroys a server trigger. This server trigger cannot be used anymore.
HSendMessageToClient Displays a message on the client computers
HServerStatus Used to find out the status of a server
HExecuteProcedure Runs a stored procedure or function.
HEndNoDatabaseAccess Re-authorizes the access to one or more databases accessible by a connection
HSetCache Enables you to configure the management of caches in the HyperFileSQL Client/
Server engine
HSetServer Used to modify some parameters of the server.
Part 8: File management

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

HListDatabase Lists the Client/Server databases associated with a connection


HListStoredElement Returns the list of elements stored on a Hyper File server (sets of procedures, sto-
red procedures or queries).
HListGroup Returns the list of groups of users defined for a connection
HListParameter Returns the list of parameters saved from the stored procedures on the server.
HListTask Returns the list of scheduled tasks found on a server.
HListServerTrigger Returns the list of available triggers on a connection or on one of the files of the
connection.
HListUser Returns the list of users defined for a connection
HListConnectedUser Returns the list of users currently connected to one or more files handled by a
Client/Server connection
HRefreshSet Creates or updates a set of procedures on a Hyper File server
HRefreshQuery Creates or updates a query on a Hyper File server
HModifyDatabaseRights Modifies the rights granted to a user or to a group for a HyperFileSQL Client/Ser-
ver database
HModifyFileRights Modifies the rights granted to a user or to a group for a HyperFileSQL Client/Ser-
ver data file
HModifyServerRights Modifies the rights granted to a user or to a group on a HyperFileSQL server
HModifyGroup Modifies the group information according to the elements found in the correspon-
ding group management variables
HModifyDatabaseProperty Modifies the properties of a database found on a HyperFileSQL server
HModifyFileProperty Modifies the properties of a HyperFileSQL file found on a server
HModifyServerProperty Modifies the properties of a HyperFileSQL server
HModifyTask Modifies a scheduled task on the server defined by the connection. This task is
found in an advanced variable of hScheduledTask type.
HModifyUser Modifies the user information according to the elements found in the correspon-
ding user management variables
HPriority Used to find out and modify the priority of the calling application.
HPriorityClient Modifies the priority of a client application

Part 8: File management


HClearWorkingDir Clears and destroys the temporary directory previously created during the execu-
tion of HServerWorkingDir.
HResetClient Initializes the structure for managing the client computers (HClient structure)
HResetGroup Initializes the group management variables with the default values
HResetUser Initializes the user management variables with the default values
HReconnect Performs a reconnection to the server for all the interrupted connections.
HRetrieveLog Retrieves from a file the server logs performed between two given dates
HServerWorkingDir Returns the path of a temporary directory on the server. This directory is automati-
cally created on the server. The stored procedures run on the server will have the
rights to write into this directory. This directory will be automatically cleared and
destroyed during the disconnection of the client.
HRestoreBackup Enables you to restore a backup performed by HBackup (or via the HyperFileSQL
Control Center).
HBackup Saves the content of a Hyper File server: all the server’s databases, one or more
databases, or or more files. This backup can be performed while one or more
databases are currently used.
HSaveParameter Saves a persistent value from a stored procedure. This value can be read by HLoa-
dParameter.
HDeleteDatabase Deletes a database found on a HyperFileSQL server
HDeleteSet Deletes a set of stored procedures from a Hyper File server.
HDeleteFile Deletes the HyperFileSQL files (.fic, .ndx and .mmo files if they exist) from the ser-
ver
HDeleteGroup Deletes (from the server) a group of users associated with a connection
Tome1_2.book Page 582 Vendredi, 28. mai 2010 5:50 17

582

HDeleteLink Deletes an integrity rule between two files on the server


HDeleteParameter Deletes a parameter that was previously saved by HSaveParameter.
HDeleteQuery Deletes a query from a Hyper File server.
HDeleteBackup Deletes a backup previously performed by HBackup. The backup is physically
deleted from the disk.
HDeleteTask Deletes a scheduled task from a Hyper File Client/Server server.
HDeleteUser Deletes (from the server) a user associated with a connection
HOnServerCall Customizes the management of message display on the client computer and the
management of disconnection from a client computer
HTransactionList Returns the list of current or interrupted transactions found on the server for the
specified connection
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 583 Vendredi, 28. mai 2010 5:50 17

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

1. TOOLS PROVIDED WITH WINDEV, WEBDEV


AND WINDEV MOBILE

1.1 Tools for managing HyperFileSQL data files


1.1.1 WDMAP les,
WDMAP is a tool used to view and handle a data file •check the description files of an analysis,
when developing an application or a site. •run the other WinDev/WebDev tools (WDMAP,
WDMAP can be used for instance to: WDConver, …),
• quickly check the content of a record, •start WinDev/WebDev,
• quickly check an application or a site using realistic •…
data. Notes:
The data file used can be in HyperFileSQL format or can - Important: WDTool only works on file in HyperFileSQL
be accessed via an OLE DB provider, an ODBC driver or a format.
Native Access. You can also use an alias of a HyperFi- - WDTool cannot be installed at your customer’s (with
leSQL file. the application). Its use is reserved to development.
- WDTool cannot be installed on the Web server where
your site is deployed. Its use is reserved to develop-
WDMAP can be run: ment.
• directly from a data file (double-click a ".FIC" file), - In order for WDTool to work, the analysis description
• select "Edit .. Edit the file with WDMAP" in the data file (<AnalysisName>.WDD) must be found in an
model editor, accessible directory.
• select "Tools .. WDMAP - HyperFileSQL viewer",
• double-click "WDMAP.EXE".
1.1.3 WDOptimizer
WDOptimizer is an independent tool used to optimize
Note: if WDMAP is started from the data model editor: access to HyperFileSQL files.
• The physical file corresponding to the description of This tool can also be used to fix damaged files or indexes,
the selected file will be created if necessary. after a hardware problem for example (damaged disk
• To take into account the modifications performed on cluster, power outage, etc.).
the file description, we recommend you generate the
Part 9: Appendices
The different operations that can be performed by WDOp-
analysis ("Analysis .. Generate") before viewing the timizer are as follows:
file’s content. • Check the index of the data files
The coherence between the index and the data files is
Use conditions: WDMAP cannot be redistributed: checked.
• WDMAP cannot be installed with the applications • Calculate the statistics on the data files
developed with WinDev. Optimizes the indexes by calculating statistics on the
• WDMAP cannot be installed on the Web server where indexes. These statistics are used to optimize the
the site is deployed. HyperFileSQL filters, queries and views.
Note: the more the file is modified, the less the statis-
To use WDMAP, WinDev/WebDev must be installed on tics represent the content of the HyperFileSQL file. The
the current computer. more records the file contains, the less the modifica-
tion of a single record impacts the overall statistics.
1.1.2 WDTool: HyperFileSQL tools • Reindexing the data files
WDTool allows you to: Optimize the access to the data file’s records and
•index a data file (equivalent to HIndex), recalculates the statistics. All the crossed out records
•display information about a data file and its associa- are automatically deleted.
ted index, • Complete revision of the data file (including index and
•modify, delete and add the file assignments stored in memos).
the ".REP" file, Optimize the entire data file, its index and its memos.
Advanced options are available.
•determine the version of the WinDev/WebDev modu-
Tome1_2.book Page 586 Vendredi, 28. mai 2010 5:50 17

586

• Viewing the log


WDOptimizer can be freely distributed. WDOptimizer can Enables you to view the information saved in the log
be installed along with the applications developed using file. Searches can also be performed in the log.
WinDev. The WinDev or WebDev user license is fully enfor-
ced. Note: when modifying the analysis, the log file will be
When creating the setup procedure, WDOptimizer is automatically saved at the time of the automatic modifi-
automatically supplied with your applications. cation of the data files. The log file will be cleared later.
Reminder: the setup procedure can be created from the Use conditions: WDLog can be redistributed. WDLog can
wizard ("Workshop .. Create setup procedure"), or from be installed along with the applications developed with
the setup editor ("Tools .. WDINST"). WinDev or on the Web servers of the WebDev sites. The
WinDev or WebDev user license is fully enforced.
1.1.4 WDConver WDLog can be included in your applications when crea-
WDConver is a tool for converting to HyperFileSQL Classic ting the setup procedure.
the data in a file:
• in Hyper File 5.5 format (WinDev 5.x or WebDev 1.5),
1.1.6 WDTrans
• in text format, WDTrans is a tool used to cancel transactions.
• in XML format, Reminder: a transaction is used to ensure that updates
performed on one or more data files have completed pro-
• of a database accessed via an OLE DB provider or an perly. If an error or an incident (power outage for exam-
ODBC driver (Excel, Access, Oracle, SQL Server, …), ple) occurs during transaction operations, WDTrans
• in a database accessed via WinDev or WebDev native automatically restores the files to their initial status
access (SQL Server, Oracle or AS/400). before the start of the transaction.
Caution: WDConver only converts the data from a file. To See ’Transactions’, page 548, for more details.
perform this conversion, you must first convert the struc- The following operations can be performed by WDTrans:
ture of the data files. To convert the structure of a data • Cancel the operations performed on a transaction file
file, select "File Structure .. Import/Export file/table des- • Free the records in transaction
criptions" from the data model editor. Transforms all the records "in transaction" into "nor-
Use example: after a large update to the data of an exter- mal" records if these records do not belong to a cur-
nal file, WDConnect lets you reimport all the data into a rent transaction. If a record found in the specified data
WinDev or WebDev database. file is considered as being in transaction but does not
belong to any current transaction, it is automatically
WDConver can be redistributed. WDConver can be ins- freed.
talled along with the applications developed in WinDev Caution: this is an advanced feature. This feature must
and WebDev. be used when the unsuccessful transactions cannot be
The WinDev or WebDev user license is fully enforced. canceled (deleted transaction files for instance).
Part 9: Appendices

Use conditions: WDTrans can be redistributed. WDTrans


When creating the setup procedure, WDConver can be
can be installed along with applications developed in
supplied with your applications. WinDev and on the Web servers of the WebDev sites. The
Reminder: the setup procedure can be created from the WinDev or WebDev user license is fully enforced.
wizard ("Workshop .. Create setup procedure"), or from When creating the setup procedure, WDTrans can be sup-
the setup editor ("Tools .. WDINST"). plied along with your applications.
1.1.5 WDLog 1.1.7 WDSQL
The different operations that can be performed by WDLog WDSQL enables you to:
are as follows:
• create and run SQL queries on a database from the
• Saving the HyperFileSQL data files linked to a WinDev developer computer (as well as from the end-user com-
application or a WebDev site
puter),
Used to create a backup of the data files. If a problem
occurs, these data files can be restored. • check the validity of the connection settings and its
operating mode,
• Restoring the data files that were previously saved
Used to restore a backup of HyperFileSQL data files • Convert the structure of a HyperFileSQL database into
that was previously created by WDLog. an SQL script. This script can then be run later on an
SQL database to create the database corresponding to
• Updating the data files from a log
the HyperFileSQL analysis.
Used to apply all the operations found in a log to a data
file.
Tome1_2.book Page 587 Vendredi, 28. mai 2010 5:50 17

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.

1.2 Other tools


1.2.1 WDZIP, archive manager •generate a setup menu.
WDZip is a tool used to compress and group your files See the online help for more details.
into archives. Notes:
By default, an archive is a ".WDZ" type physical file. • The setup editor for a WinDev Mobile application is cal-
Archives enable you to, for example: led WPInst.
•save your files on a regular basis while reducing the • The setup editor for a WebDev site is called WWInst.
storage space,
•simplify the transmission of your files over Internet/ 1.2.3 WDXView
Intranet, WDXView enables you to:
•create self-extracting archives,.. •view the information relative to an ActiveX,
An optimized compression allows your files to take less •Test an ActiveX and its features.
disk space and to be easily transfered to different media To start WDXView, directly start the "WDXView.EXE" pro-
(diskettes, CD, Internet, …). gram in the Windows explorer.
To start WDZip:
•from "Tools .. WDZIP - Archive Manager", 1.2.4 WDTest
•directly by double-clicking an archive file (".WDZ" WDTest is a tool that allows you to record and automati-
cally run application test scripts (for WinDev or not).
Part 9: Appendices
file) from Windows explorer.
A test script (also called "macro") contains mainly the
WDZIP cannot be installed: different operations performed on an application (mouse
• with applications developed using WinDev. movement, mouse click and keyboard entry).
• on the Web server where your site is deployed. Once recorded, the test script can be run as many times
as necessary. When a script is executed, a result script is
1.2.2 WDInst - Setup editor automatically generated. The differences between the
The setup editor (WDInst) is used to create the setup pro- two scripts (initial script and result script) are highlighted.
gram for your application. This program can be generated This feature enables you to check whether your WinDev
on various media (CD, diskettes, …). applications operate properly between two updates.
This program offers a larger choice of setup options than WDTest automates application test procedures.
the setup wizard accessible by "Workshop .. Create the Important: To successfully perform a test, you need to
setup procedure". use the exact same configuration:
On top of the options accessible through "Workshop .. • on the computer where the test is created,
Create the setup procedure", WDInst also allows you to: • on the computer where the test is run.
•specify for each installed file: WDTest may not be redistributed.
- the directory where the file will be installed,
- if the file is compacted or not.
Tome1_2.book Page 588 Vendredi, 28. mai 2010 5:50 17

588

1.2.5 WDTestSite APIs.


WDTestSite is used to run different tests on a WebDev WDAPI will not train you on how to use the 1,600 Win-
site. dows APIs but it will help you tremendously in the genera-
tion step of the code. In fact, the API function that was
WDTestSite cannot be redistributed. selected in WDAPI can be used in your code.
Here are the tests that can be performed with WDTest- Note: the list of Windows APIs provided with WDAPI is
Site: NOT exhaustive.
• Stress test: Use conditions: WDAPI cannot be redistributed. WDAPI
The stress test consists in simulating the connection of cannot be installed with the applications developed with
several Web users to a WebDev site. Each Web user WinDev.
runs a set of operations (scenario) simultaneously. To use WDAPI, WinDev must be installed on the current
• Regression test: computer.
The regression tests consist in checking the behavior of
a WebDev site between two updates. The regression 1.2.8 WDStatistics
test consists in checking that a scenario run on a pre- WDStatistics is a tool used to calculate traffic statistics
vious version of the site operates properly once the site for your dynamic WebDev sites.
has been updated. These statistics are calculated from the log files (".LOG"
• Running the test of a site in multi-user mode: extension) generated by the WebDev engine. These files
The test of a site in multi-user mode is used to check can be saved for all the sites or for a specific site.
whether concurrent accesses to the data files are
managed properly. This test consists in simulating the Some examples of statistics automatically calculated by
simultaneous connection of several Web users to a WDStatistics:
WebDev site. Each Web user runs a set of operations • List of connections
(scenario) simultaneously. Details of all the connections to the Web server: IP
• Comparing different servers : address, date and time, browser used, operating sys-
WDTestSite is used to compare the speed of different tem, …
servers. To do so, run the same scenario on different • Connections per site
servers and compare the execution time of this scena- Number of connections per WebDev site and duration.
rio. • List of pages visited by a Web user.
• Optimizing the processes created in WLanguage: • Number of connections per type of browser (Internet
WDTESTSITE is used to compare the execution time of Explorer, …).
a scenario before and after the WLanguage code was • Number of connections per time slot.
optimized.
• Number of connections per operating system.
Part 9: Appendices

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

1.2.9 Control Centers • User Control Center:


A control center gives you a global view of the correspon- This control center enables you to manage the applica-
ding area, during the development phase, on a deployed tions deployed on a company network. From this con-
site or for the maintenance and the evolution of the appli- trol center, the users will be able to install their
cations. dedicated applications.
Several control centers come with WinDev, WebDev and • Control Center for the HyperFileSQL engines and data-
WinDev Mobile: bases (network and Client/Server).
This control center is used to manage the HyperFileSQL
• Project monitoring center: databases (Network, Mobile, Client/Server) found in
This control center is used to manage the development the company.
tasks performed by a team of developers. You can fol-
low the entire project, resource sharing, quality control, See the online help for more details about the Control
tests, performance and documentation. Centers.

1.3 Tools specific to WinDev Mobile


1.3.1 WDExplorer (.cdb format) available on a Pocket PC, a SmartPhone, …
WDExplorer is a tool for viewing files and directories See the online help for more details.
found on a Pocket PC, SmartPhone, …
See the online help for more details. 1.3.4 WDRegistry
WDRegistry is a tool for viewing the registry of a Pocket
1.3.2 WDCapture PC, Smartphone, …
WPCapture is used to perform screen shots of the con- See the online help for more details.
nected Pocket PC or SmartPhone. You can also save
videos. 1.3.5 WDSynchro
See the online help for more details. WDSynchro is a configuration tool for HyperFileSQL
Mobile synchronizations via ActiveSync.
1.3.3 WDCEDB See the online help for more details.
WDCEDB is a tool for accessing the standard databases

Part 9: Appendices
Tome1_2.book Page 590 Vendredi, 28. mai 2010 5:50 17

590

2. EXTENSIONS OF THE WINDEV FILES


The table below presents the main extensions of the files Note: to optimize the management of the developer grou-
created and supported by WinDev. To make this docu- pware, the ’$’ character may come up in front of the file
ment easier to read, these extensions are sorted by name.
alphabetical order.
Extension Description Theme Must not be
deleted
.BKC Archive file of a WinDev class (created when the class is saved Archive
for the first time)
.BKE Archive file of a WinDev report (created the first time the report is Archive
saved)
.BKG Archive file of a set of WinDev procedures (created the first time Archive
the set of procedures is saved)
.BKH Archive file of a WinDev help system (created the first time the Archive
help system is saved)
.BKP Archive file of WinDev project (created the first time the project Archive
is saved)
.BKR Archive file of a WinDev query (created the first time the query is Archive
saved)
.BKW Archive file of a WinDev window (created the first time the win- Archive
dow is saved)
.DEP List of dependencies for a WinDev project (created with WDVer- WinDev tools
sion for instance)
.DIC Description of the WinDev dictionary WinDev editors X
.ENV Parameters for the WinDev editor environment and for the pro- WinDev editors
jects used
Part 9: Appendices

.ERR Error message of each component WinDev editors X


.EXE Executable file Execution
.FIC HyperFileSQL data file HyperFileSQL X
.GAB Description for the control styles WinDev editors X
.LST File containing the name of the HyperFileSQL files to save (crea- WinDev 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
Tome1_2.book Page 591 Vendredi, 28. mai 2010 5:50 17

591

.NET WDUpdate.NET (end-user computers) WinDev tools


File containing the references of the different applications to
check during a network setup and, for each one of them, the
characteristics of the check to perform
This file is created by WDADMINEXE
.RAD RAD information about the analysis Analysis X
.REP Correspondence between the logical files and the physical files HyperFileSQL
used by an application
See ’What is the .REP for?’, page 543, for more details
.RPL Description of the subscriber replicas WinDev tools X
.RPM Description of the master replicas WinDev tools X
.SQL Query saved by WDSQL WinDev tools X
.SRP Scenario created and used by WDReplic to perform a replication WinDev tools X
.TKC Archive file of a WinDev class (created whenever the class is Archive
saved)
.TKE Archive file of a WinDev report (created whenever the report is Archive
saved)
.TKG Archive file of a set of WinDev procedures (created each time the Archive
set of procedures is saved)
.TKH Archive file of a help system (created each time the help system Archive
is saved)
.TKP Archive file of WinDev project (created whenever the project is Archive
saved)
.TKR Archive file of a WinDev query (created whenever the query is Archive
saved)
.TKW Archive file of a WinDev window (created whenever the window is Archive
saved)
.TRS Archive file of a WinDev query (created whenever the query is Archive Part 9: Appendices
saved)
.TRX Archive file of a WinDev window (created whenever the window is Archive
saved)
.WBC List of identifiers of the WinDev classes Compilation
Caution: in WinDev 5.5, this extension corresponded to the com-
pilation information of a class.
.WBE List of identifiers of the WinDev reports Compilation
Caution: in WinDev 5.5, this extension corresponded to the com-
pilation information of a report.
.WBG List of identifiers for the sets of WinDev procedures Compilation
.WBP List of identifiers of a WinDev project Compilation
Caution: in WinDev 5.5, this extension corresponded to the com-
pilation information of a project.
.WBW List of identifiers of the WinDev windows Compilation
Caution: in WinDev 5.5, this extension corresponded to the com-
pilation information of a window.
Tome1_2.book Page 592 Vendredi, 28. mai 2010 5:50 17

592

.WCC Compilation information of a WinDev class (recreated after each Compilation


compilation)
.WCE Compilation information of a WinDev report (recreated after Compilation
each compilation)
.WCG Compilation information of a set of WinDev procedure (recreated Compilation
after each compilation)
.WCP Compilation information of a WinDev project (recreated after Compilation
each compilation)
.WCW Compilation information of a WinDev window (recreated after Compilation
each compilation)
.WDA Description of the analysis and description of the HyperFileSQL WinDev editors X
files (in edit mode) for the data model editor
.WDC WinDev class WinDev editors X
.WDD Description of the analysis and description of the HyperFileSQL WinDev editors X
files (in execution)
.WDE WinDev report WinDev editors X
.WDF Parameter file for a project’s custom setup WinDev editors X
.WDG Set of WinDev procedures WinDev editors X
Caution: in WinDev 5.5, this extension corresponded to the file
containing the list of files used by WDInst.
.WDH Description of the WinDev help system WinDev editors X
.WDI Description of a WinDev component (only for developing appli- WinDev compo- X
cations) nent
.WDK File containing all the elements of a WinDev component WinDev compo- X
nent
.WDL WinDev library Execution
.WDM Error messages found in the different DLLs of WinDev WinDev editors/ X
Part 9: Appendices

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&quot: 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&quot: 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

3. EXTENSIONS OF THE WEBDEV FILES


The table below presents the main extensions for the files Note: to optimize the management of the developer grou-
created and managed by WebDev. To make this docu- pware, the ’$’ character may come up in front of the file
ment easier to read, these extensions are sorted by name.
alphabetical order.
Extension Description Theme Must not be
deleted
.BKC Archive file of a WebDev class (created the first time the class is Archive
saved)
.BKE Archive file of a WebDev report (created the first time the report Archive
is saved)
.BKG Archive file of a set of WebDev server procedures (created the Archive
first time the set of procedures is saved)
.BKH Archive file of a WebDev page (created the first time the page is Archive
saved)
.BKN Archive file of a set of WebDev browser procedures (created the Archive
first time the set of procedures is saved)
.BKP Archive file of WebDev project (created the first time the project Archive
is saved)
.BKR Archive file of a WebDev query (created the first time the query is Archive
saved)
.CSS HTML style sheets (Cascading Style Sheet) WebDev editors
.DEP List of dependencies for a WebDev project (created with WDVer- WebDev tools
sion for instance)
.DIC Description of the WebDev dictionary WebDev editors X
Part 9: Appendices

.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

.WCE Compilation information of a WebDev report (recreated after Compilation


each compilation)
.WCG Compilation information of a WebDev server set of procedures Compilation
(recreated after each compilation)
.WCH Compilation information of a WebDev page (recreated after each Compilation
compilation)
.WCN Compilation information of a WebDev browser set of procedures Compilation
(recreated after each compilation)
.WCP Compilation information of a WebDev project (recreated after Compilation
each compilation)
.WDA Description of the analysis and description of the HyperFileSQL WebDev editors X
files (in edit mode) for the data model editor
.WDC WebDev class WebDev editors X
.WDD Description of the analysis and description of the HyperFileSQL WebDev editors X
files (in execution)
.WDE WebDev report WebDev editors X
.WDG WebDev server set of procedures WebDev editors X
.WDI Description of a WebDev component (only for developing sites) WebDev compo- X
nent
.WDK File containing all the elements of a WebDev component WebDev compo- X
nent
.WDL WebDev Library Execution
.WDM Error messages found in the different DLLs of WebDev WebDev editors/ X
This file is generated by WDInt (tool for translating the error mes- WebDev tools
sages)
.WDN WebDev browser set of procedures WebDev editors X
.WDO List of the different elements supplied with a WebDev component WebDev compo- X
Part 9: Appendices

(data files, .INI files, …). nent


.WDP WebDev project WebDev editors
.WDR WebDev query WebDev editors X
.WDU Name and full path of the elements included in a WebDev library WebDev editors
.WDV Description of the file conversions (generated by WDConver or by WebDev tools X
the data model editor)
.WDZ Archive file (created by WDZip for instance) WebDev editors X
.WEP Compilation errors of the project Compilation
Tome1_2.book Page 597 Vendredi, 28. mai 2010 5:50 17

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&quot: 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

4. EXTENSION OF THE WINDEV MOBILE FILES


The table below presents the main extensions of the files Note: to optimize the management of the developer grou-
created and managed by WinDev Mobile. To make this pware, the ’$’ character may come up in front of the file
document easier to read, these extensions are sorted by name
alphabetical order.
Extension Description Theme Must not be
deleted
.BKC Archive file of a WinDev class (created when the class is Archive
saved for the first time)
.BKG Archive file of a set of WinDev procedures (created the first Archive
time the set of procedures is saved)
.BKP Archive file of WinDev project (created the first time the pro- Archive
ject is saved)
.BKR Archive file of a WinDev query (created the first time the Archive
query is saved)
.BKW Archive file of a WinDev window (created the first time the Archive
window is saved)
.DEP List of dependencies for a WinDev project (created with WinDev tools
WDVersion for instance)
.DIC Description of the WinDev dictionary WinDev editors X
.ENV Parameters for the WinDev editor environment and for the WinDev editors
projects used
.ERR Error message of each component WinDev editors X
.EXE Executable file Execution
.FIC HyperFileSQL Mobile data file HyperFileSQL X
Mobile
.MCD Description of Conceptual Data Model (CDM) Analysis X
.MDE Procedures of the RAD models RAD X
Part 9: Appendices

.MDL Description file of the RAD patterns RAD X


.MLD Description of Logical Data Model (LDM) Analysis X
.MMO HyperFileSQL Mobile memo file HyperFileSQL X
Mobile
.NDX HyperFileSQL Mobile index file HyperFileSQL X
Mobile
.RAD RAD information about the analysis Analysis X
.STY Description for the control styles WinDev editors X
.TKC Archive file of a WinDev class (created whenever the class is Archive
saved)
.TKG Archive file of a set of WinDev procedures (created each time Archive
the set of procedures is saved)
.TKP Archive file of WinDev project (created whenever the project Archive
is saved)
.TKR Archive file of a WinDev query (created whenever the query Archive
is saved)
.TKW Archive file of a WinDev window (created whenever the win- Archive
dow is saved)
.WBC List of identifiers of the WinDev classes Compilation
Tome1_2.book Page 599 Vendredi, 28. mai 2010 5:50 17

599

.WBE List of identifiers of the WinDev reports Compilation


.WBG List of identifiers for the sets of WinDev procedures Compilation
.WBP List of identifiers of a WinDev project Compilation
.WBW List of identifiers of the WinDev windows Compilation
.WCC Compilation information of a WinDev class (recreated after Compilation
each compilation)
.WCG Compilation information of a set of WinDev procedure Compilation
(recreated after each compilation)
.WCP Compilation information of a WinDev project (recreated after Compilation
each compilation)
.WCW Compilation information of a WinDev window (recreated Compilation
after each compilation)
.WDA Description of the analysis and description of the HyperFi- WinDev editors X
leSQL Mobile files (in edit mode) for the data model editor
.WDC WinDev class WinDev editors X
.WDD Description of the analysis and description of the HyperFi- WinDev editors X
leSQL Mobile files (in execution)
.WDE WinDev reports WinDev editors X
.WDG Set of WinDev procedures WinDev editors X
.WDI Description of a WinDev component (only for developing WinDev compo- X
applications) nent
.WDK File containing all the elements of a WinDev component WinDev compo- X
nent
.WDL WinDev library Execution
.WDM Error messages found in the different DLLs of WinDev WinDev editors X
.WDO List of the different elements supplied with a WinDev compo- WinDev compo- X
nent (data files, …). nent
.WDR WinDev query WinDev editors X
.WDU Name and full path of the elements integrated to a WinDev WinDev editors
library

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&quot: 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

• "EXCEPT.wl": most common exception codes (to retrieve


with ExceptionInfo(errCode)).
• "KeyConst.wl&quot: standard Windows constants used
for all the keyboard keys. These constants can be used by
KeyPressed, in the "Key Down" or "Key Up" optional pro-
cesses with the _EVE.wParam variable.
.WPF Statistical file saved and handled by the performance profi- WinDev editors X
ler.
.WPP WinDev project WinDev editors X
.WPW WinDev window WinDev editors X
.WRC List of references for the WinDev classes 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
Part 9: Appendices
Tome1_2.book Page 601 Vendredi, 28. mai 2010 5:50 17

601

5. LIMITS OF WINDEV AND WINDEV MOBILE


5.1 Limits regarding the project

Windows per project: Maximum number Unlimited


Project languages: maximum number 20
Procedures per project: Maximum number 5,000 procedures for each project element (win-
dow, report, set of procedures, …)
Classes per project: Maximum number 8,000 classes
Variables of a project (global or local variables): maximum num- 65,500 variables
ber
Processes of a project: Maximum number of lines 65,500 lines

5.2 Limits regarding the windows

Maximum dimensions 32,000 x 32,000 pixels


Maximum number of controls per window Greater than 5,000
This limit can be less depending on the operating
system used.
Logical name of a window: maximum number of characters 255 characters
Languages selected for a window: Maximum number 20
Windows opened simultaneously at runtime: maximum number In Windows 95, 98, or Me: limited by Windows
graphic resources
In Windows NT, 2000 and XP: unlimited
Limit may vary according to the available memory
Part 9: Appendices
and to the number of controls found in each win-
dow.
Variables of a window (global or local variables): maximum num- 65,500 variables
ber
Window process: maximum number of lines 65,500 lines
Tome1_2.book Page 602 Vendredi, 28. mai 2010 5:50 17

602

5.3 Limits regarding the different types of controls

Control: maximum dimensions 32,000 x 32,000 pixels


Logical name of a control: Maximum number of characters 255 characters
Control process: maximum number of lines 65,500 lines
Edit control: maximum number of characters 2 billions (2GB) characters
In Windows 95, 98 and Me, this limit is set to
32,000 characters.
Multiline edit control: maximum number of lines 2 billions (2GB) of lines and 2 billions (2 GB) cha-
racters
In Windows 95, 98 and Me, this limit is set to
10,000 lines and to 32,000 characters.
Static control: maximum number of characters If the static control caption is entered in the edi-
tor: 2 billion characters (2GB),
If the caption is assigned by programming: varia-
ble limit according to the available memory.
Image control: maximum dimensions Unlimited
In Windows 95, 98 and Me, dimension limited to
16 millions of pixels.
Image control: maximum number of images that can make up an Width x Height (in pixels) of the reference image
animated image
Check box or radio button: maximum number of options 256 options
List or combo box: maximum number of elements 5 millions elements
Memory table: maximum number of rows 5 millions rows
Change according to the available memory.
Table (memory or browsing table): maximum number of columns 1 million columns
Table (memory or browsing table): maximum number of cells Dozens of millions of cells
Table (memory or browsing table): maximum number of charac- 2 billions (2 GB) characters maximum per row (for
Part 9: Appendices

ters in a line all the columns)


Columns in a table (memory or browsing table): maximum width 32,000 pixels
Text column in a table (browsing or memory table): maximum 2 billions (2GB) characters
number oc characters
TreeView: maximum number of elements 32,000 elements

5.4 Limits for the menus

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

5.5 Limits for processes

Maximum number of lines in : 65,500 lines


• the process of an element (project, window, control, …)
• a procedure (local or global)
Maximum number of languages selected for the code 20
Program line: maximum number of characters 1,000 characters
Procedure Maximum number of parameters 255 parameters
Procedure Name: maximum number of characters 255 characters
Nested loop Maximum number 140 nested loops
Class Maximum number per project 8,000 classes
Class Maximum number of members 65,500 members
Class Name: maximum number of characters 255 characters
Variable (global Maximum number in a project 65,500 variables
or local)
Variable (global Maximum number in a window 65,500 variables
or local)
Variable (global Maximum number in a process 65,500 variables
or local)
Variable Name: maximum number of characters 255 characters
Variable String type: maximum number of characters Limit depending on the available
memory
Variable Fixed string type: maximum number of characters 65,500 characters
Variable ASCIIZ string type: maximum number of characters 65,500 characters
Variable Pascal string type: maximum number of characters 255 characters
Variable Array type: maximum number of dimensions 3 dimensions
Variable Array type: limit of dimension Limit depending on the available
Part 9: Appendices
memory

5.6 Image formats supported by WinDev


WinDev manages images in the following formats: BMP, WinDev Mobile supports the images in the following for-
JPEG, GIF, PCD, PSD, TGA, TIF, PNG, ICO (Windows icons), mats: BMP, JPEG, GIF or ICO.
EMF, WMF, CUR, OS2 (BMP in OS/2), PCX, ICW (HYPER Note: images in BMP, ICO, CUR and OS2 formats used in
SCREEN Windows icons). windows are automatically managed by WD150OBJ.DLL.
The PCX 24 bits and WMF 24 bits images are not suppor- In the other cases, wd150img.dll must be installed with
ted by WinDev. the other DLLs of WinDev.
Tome1_2.book Page 604 Vendredi, 28. mai 2010 5:50 17

604

5.7 Limits regarding the analyses, the file descriptions and the items

Analysis Maximum size of the ".WDD" file Unlimited


Analysis Maximum number of file descriptions 65,535 files
Analysis Maximum number of items 65,535 items
Analysis Maximum number of links 65,535 links
Analysis Maximum number of analysis generations 231 (more than 2 billions) generations
File description Logical name: maximum number of characters 255 characters
File description Maximum number per analysis 65,535 files
File description Maximum number of items 65,535 items
File description Maximum number of links per file 65,535 links
File description Maximum number of keys 65,353 keys
File description Maximum size of all the keys 2 GB
Item Logical name: maximum number of characters 255 characters
Item Maximum number per analysis 65,535 items
Item Maximum number per file 65,535 items
Item Maximum number in a composite key 65,535 items
Item Maximum size 65,535 bytes (except 255 bytes for the
files in Windows Turbo Pascal in the lan-
guage format)
Item Maximum size of a memo item (text or binary) 4 GB
Item Maximum size of a binary string 65,535 bytes
Item Maximum number of elements in an array of items 255 elements
Key Maximum number per file description 65,353 keys
Key Maximum size of all the keys found in a file 2 GB
Key Maximum size of a key (composite or simple) 65,535 bytes
Part 9: Appendices

Key Maximum number of items in a composite key 65,535 items


Record Maximum size 2 GB
Record Minimum size 16 bytes
Tome1_2.book Page 605 Vendredi, 28. mai 2010 5:50 17

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

5.9 Limits for xBase files Part 9: Appendices

Record Maximum number per data file Unlimited


Record Maximum size • Clipper5 file: 8,192 bytes
• Others: 4,000 bytes
Record Maximum number per index file Unlimited
Record Maximum number per memo file Unlimited
Item Maximum number per file • dBase 4 file: 255 items
• DBX file: 512 items
• Clipper 5 file: 1,023 items
• others: 128 items
Item Maximum size of a text item • Clipper 5 file: 2,048 bytes
• Others: 254 bytes
Item Maximum size of a numeric item • dBase 4 file: 20 bytes
• FoxPro file: 20 bytes
• Others: 19 bytes
Tome1_2.book Page 606 Vendredi, 28. mai 2010 5:50 17

606

Item Maximum size of a decimal numeric item • dBase file: 18 bytes


• FoxPro file: 18 bytes
• Others: 15 bytes
Item Name: maximum number of characters 10 characters
Key Maximum size 65,535 bytes
Key Name: maximum number of characters 10 characters
Key expression Maximum size 100 bytes
Key expression Authorized functions DTOC, DTOS, Left, Right, Upper, Lower,
STR, SUBSTR
Index Maximum number in an MDX file 47 indexes
Text memo Maximum number of characters written 24,576 characters

5.10 Limits regarding the libraries

Maximum size of the library file (".WDL" file) Available size on the disk (or up to 2 GB)
Maximum number of elements Unlimited

5.11 Limits regarding the executables

Maximum size of the executable program (".EXE" file) Available size on the disk (or up to 2 GB)

5.12 Limits regarding the setup program *

Supported lan- Maximum number 20 languages


guages
Part 9: Appendices

Components Maximum number 500 components


Groups of files Maximum number 500 groups of files
Update Maximum number of analyses that can be taken into 100 analyses
account by a single update Each update can automatically modify
the data files belonging to 100 different
analyses.
DLL Maximum number of DLLs associated with a custom 500 DLLs
setup program
* Reminder: the setup program cam be created with:
•the setup program creation wizard ("Workshop ..
Create the setup procedure"),
•the WDINST setup editor ("Tools .. WDINST - Setup
editor").
Tome1_2.book Page 607 Vendredi, 28. mai 2010 5:50 17

607

6. WEBDEV LIMITS
6.1 Limits regarding the project

Pages per project: Maximum number Unlimited


Project languages: maximum number 20
Procedures per project: Maximum number 5,000 procedures for each WebDev project ele-
ment (window, report, set of procedures, and so on)
Classes per project: Maximum number 8,000 classes
Variables of a project (global or local variables): maximum num- 65,500 variables
ber
Processes of a project: Maximum number of lines 65,500 lines

6.2 Limits for pages and framesets

Maximum dimensions 32,000 x 32,000 pixels


Maximum number of controls per page Greater than 5,000
This limit can be less depending on the operating
system used.
Maximum number of frames per frameset 16 frames
Logical name of a page: maximum number of characters 255 characters
Languages selected for a rpage: Maximum number 20
Pages open at the same time at run time (in recent browsers): In Windows 95, 98, or Me: limited by Windows gra-
Maximum number phic resources
In Windows NT, 2000 and XP: unlimited
Limit may vary depending on the memory available Part 9: Appendices
and the number of controls found in each page.
Page contexts open at the same time at run time: Maximum Unlimited
number Limit may vary depending on the memory available
and the number of controls found in each page.
Variables of a page (global or local variables): maximum num- 65,500 variables
ber
Page process: Maximum number of lines 65,500 lines
Tome1_2.book Page 608 Vendredi, 28. mai 2010 5:50 17

608

6.3 Limits regarding the different types of controls

Control: maximum dimensions 32,000 x 32,000 pixels


Logical name of a control: Maximum number of characters 255 characters
Control process: maximum number of lines 65,500 lines
Edit control: maximum number of characters 2 billions (2GB) characters
In Windows 95, 98 and Me, this limit is set to
32,000 characters.
Static control: maximum number of characters If the static control caption is entered in the editor:
2 billion characters (2GB),
if the caption is assigned by programming: variable
limit according to the available memory.
Image control: maximum dimensions Unlimited
In Windows 95, 98 and Me, dimension limited to 16
millions of pixels.
Check box or radio button: maximum number of options 256 options
List or combo box: maximum number of elements 5 millions elements
Memory table or looper: Maximum number of rows 5 millions rows
Change according to the available memory.
Table (memory or browsing table): maximum number of colu- 1 million columns
mns
Table (memory or browsing table): maximum number of cells Dozens of millions of cells
Table (memory or browsing table): maximum number of charac- 2 billions (2 GB) characters maximum per row (for
ters in a line all the columns)
Columns in a table (memory or browsing table): maximum width 32,000 pixels
Text column in a table (browsing or memory table): maximum 2 billions (2GB) characters
number oc characters
Looper (memory or browsing looper): Maximum number of attri- 1 million attributes
Part 9: Appendices

butes

6.4 Limits for the menus

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

6.5 Limits for processes

Maximum number of lines in: 65,500 lines


• an element process (project, page, control, …)
• a procedure (local or global)
Maximum number of languages selected for the code 20
Program line: maximum number of characters 1,000 characters
Procedure Maximum number of parameters 255 parameters
Procedure Name: maximum number of characters 255 characters
Nested loop Maximum number 140 nested loops
Class Maximum number per project 8,000 classes
Class Maximum number of members 65,500 members
Class Name: maximum number of characters 255 characters
Variable (global Maximum number in a project 65,500 variables
or local)
Variable (global Maximum number in a page 65,500 variables
or local)
Variable (global Maximum number in a process 65,500 variables
or local)
Variable Name: maximum number of characters 255 characters
Variable String type: maximum number of characters Limit depending on the available
memory
Variable Fixed string type: maximum number of characters 65,500 characters
Variable ASCIIZ string type: maximum number of characters 65,500 characters
Variable Pascal string type: maximum number of characters 255 characters
Variable Array type: maximum number of dimensions 3 dimensions
Variable Array type: limit of dimension Limit depending on the available
Part 9: Appendices
memory

6.6 Image formats supported by WebDev


WebDev supports images in the following formats: BMP, Caution: on the Web user’s computer, only the images
JPEG, GIF, PCD, PSD, TGA, TIF, PNG, ICO (Windows icons), supported by the browser are displayed.
EMF, WMF, CUR, OS2 (BMP in OS/2), PCX, ICW (HYPER
SCREEN Windows icons). Note: images in BMP, ICO, CUR and OS2 formats used in
pages are automatically managed by WD150PAGE.DLL.
The PCX 24 bit and WMF 24 bit images are not supported In all the other cases, WD150IMG.DLL must be installed
by WebDev. with the other DLLs of WebDev.
Tome1_2.book Page 610 Vendredi, 28. mai 2010 5:50 17

610

6.7 Limits regarding the analyses, the file descriptions and the items

Analysis Maximum size of the ".WDD" file Unlimited


Analysis Maximum number of file descriptions 65,535 files
Analysis Maximum number of items 65,535 items
Analysis Maximum number of links 65,535 links
Analysis Maximum number of analysis generations 231 (more than 2 billions) generations
File description Logical name: maximum number of characters 255 characters
File description Maximum number per analysis 65,535 files
File description Maximum number of items 65,535 items
File description Maximum number of links per file 65,535 links
File description Maximum number of keys 65,353 keys
File description Maximum size of all the keys 2 GB
Item Logical name: maximum number of characters 255 characters
Item Maximum number per analysis 65,535 items
Item Maximum number per file 65,535 items
Item Maximum number in a composite key 65,535 items
Item Maximum size 65,535 bytes (except 255 bytes for the
files in Windows Turbo Pascal in the lan-
guage format)
Item Maximum size of a memo item (text or binary) 4 GB
Item Maximum size of a binary string 65,535 bytes
Item Maximum number of elements in an array of items 255 elements
Key Maximum number per file description 65,353 keys
Key Maximum size of all the keys found in a file 2 GB
Key Maximum size of a key (composite or simple) 65,535 bytes
Part 9: Appendices

Key Maximum number of items in a composite key 65,535 items


Record Maximum size 2 GB
Record Minimum size 16 bytes
Tome1_2.book Page 611 Vendredi, 28. mai 2010 5:50 17

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

6.9 Limits for xBase files Part 9: Appendices

Record Maximum number per data file Unlimited


Record Maximum size • Clipper5 file: 8,192 bytes
• Others: 4,000 bytes
Record Maximum number per index file Unlimited
Record Maximum number per memo file Unlimited
Item Maximum number per file • dBase 4 file: 255 items
• DBX file: 512 items
• Clipper 5 file: 1,023 items
• others: 128 items
Item Maximum size of a text item • Clipper 5 file: 2,048 bytes
• Others: 254 bytes
Item Maximum size of a numeric item • dBase 4 file: 20 bytes
• FoxPro file: 20 bytes
• Others: 19 bytes
Tome1_2.book Page 612 Vendredi, 28. mai 2010 5:50 17

612

Item Maximum size of a decimal numeric item • dBase file: 18 bytes


• FoxPro file: 18 bytes
• Others: 15 bytes
Item Name: maximum number of characters 10 characters
Key Maximum size 65,535 bytes
Key Name: maximum number of characters 10 characters
Key expression Maximum size 100 bytes
Key expression Authorized functions DTOC, DTOS, Left, Right, Upper, Lower,
STR, SUBSTR
Index Maximum number in an MDX file 47 indexes
Text memo Maximum number of characters written 24,576 characters

6.10 Limits regarding the libraries

Maximum size of the library file (".WDL" file) Available size on the disk (or up to 2 GB)
Maximum number of elements Unlimited

6.11 Limits regarding the setup program *

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

Scheduled installation Maximum time-out between the setup creation 30 days


and the actual setup
Update Maximum number of analyses that can be taken 1 analysis
into account by a single update Each update can automatically modify
the data files belonging to only 1 analy-
sis.
* Reminder: The setup program can be created with the
wizard for creating the setup program ("Workshop ..
Create the setup procedure").
Tome1_2.book Page 613 Vendredi, 28. mai 2010 5:50 17

613

INDEX
Symbols B Client
Types 334

HyperFileSQL Client/Server 579


"Back" key 281 Back (management) 281
Client/Server 579
.Jar 133 Back Office 558
Clipboard (functions) 352, 353
.JNL 529 Binary
COALESCE 578
.NET 484, 494 Binary memos 520
Code
.Net 484 Functions 327
User macro-code 265
Assembly 494 BOTTOM 577
Communication
.Net services server 484 Break (Statement) 212
.Net 484
.REP 521 Browse using filter 506
Fax 446
.WDO 125 Buffer (Variable) 168
FTP server 464
Buffer type 168
A Burn 370
HTML page
J2EE services server
460
486
Burner
Accessing third-party databases 560 Palm Pilot 449
Functions 371
ADD_MONTHS 578 SOAP 479
Burning 370
Agent Socket 466
Functions 362 C Telephony
Thread
439
473
AJAX 384
Align Call stack 102 WinDev FTP/RPC 461
Rulers and markers 244 Cardinality 69, 74 XML file 492
Alignment markers 244 Advanced 70 XML Web services server 488
Alignment rulers 244 CD (burn) 370 Complement link 70
Analysis 67 CDM 73 Complex link 71
Creation 67 Association 73 Components
Limits 604, 610 Entity 73 Project 61
Metatypes 68 Operations 74 Composite key 500, 502
Anchoring controls 247 Character string 329 CONCAT 574
Application 53 Handling 329 Constant 172
Multilingual 311 Character strings Continue (Statement) 210
Profiler 104 Functions 330 Control 239
Setup 133, 135, 136 Characteristics of the project 60 Alignment 244
Test 92 Chart Anchoring 247
Using a component 119 3D 335 Copy 240
Archive 367 Charts 334 Create 240
Index

ZIP functions 368 Bar 334 Delete 241


Archive file (functions) 368 Creation 336 Frame 247
Assembly (.NET) 494 Default values 336 Functions 250
Assign file 520 Examples 336 Handles 242
Assisted management of errors 546 Functions 337 Limits 602, 608
Association (CDM) 73 Liine 335 Locked 247
Automatic identifier 516 Pie 334 Move 243
Automation object (Variable) 180 Presentation 334 Off-window control 243
AVG 576 Scatter 335 Properties 317
Stock 335 Selection 242
Tab order 80, 86
Tome1_2.book Page 614 Vendredi, 28. mai 2010 5:50 17

614

Types of controls 239 DDE Setup 587


Cookies 379 Functions 362 Electronic key 46
Copy DDW 263 Email 401
Control 240 Dead lock 542 Functions 410
Project 62 Debugger 101 POP 3 and SMTP 401
COUNT 576 Debugging (functions) 106 Read 408
Create DECODE 578 Simple MAPI 404
Application 53 Deploying a site 140, 146 Structure 408
Control 240 Deploying through FTP 140, 142 Update HyperFileSQL files 558
Project 58 Developer Write 407
UML Model 63 Identification 57 Emails
Creation Dialog (dialog boxes) 284 Communication 401
Analysis 67 Dialog box 284 Encrypting HyperFileSQL files 516
CDM 73 Multilingual 286 Entity (CDM) 73
Data file 67 Dialog boxes Error
LDM 67 Functions 288 Assisted management 546
Link 68 Dim automatically 263 Exception management 225
Property (CDM) 73 Directory Euro 339
Query 77 Project 60 Dual display 340
Relationship 73 Documentation Functions 342
Report 89 Deployment 143 Stored currency 339
WinDev component 116 Dongle 46 Tooltip 340
Window 78 DotNet Excel 366
CTI 439 Functions 485 Functions 366
Currecny Structure 484 Exception (Mechanism) 225
Stored 339 Download 378 Exception mechanism 225
Currency Download a file 377, 378 Executable 131, 133, 135, 136
Display 340 Drag and Drop 307 Functions 361
Currency (Variable) 167 From explorer 309 Limits 606
Currency + Euro 339 Functions 310 Explorer (drag and drop) 309
Drag and drop Expression to evaluate 102
D Automatic 307 Extension of the WebDev files 594
Programmed 308 Extension of the WinDev files 590
Dashboard 60 Dual display (Euro) 340 Extern (Keywords) 213
Data file 67 Duplicate 500, 506 External files
Import 68 Duplicate key 500, 506 Functions 345
Data Replication 555, 559 Duplicates 546 Handling disks and directories
Data source (Variable) 181 Duplicating a project 62 344
Database 560 Duration Handling files 344
Index

External 68 Time management 62 Handling the content 344


Third-party 560 Duration (Variable) 170 Presentation 344
Date Dynamic array (Variable) 174
Functions 332 Dynamic automation object (Variable) F
Date (Variable) 169 180
Date type 169 Dynamic page 273 Fax 446
DateTime type 169 Dynamic structure (Variable) 179 Fax sending application 447
Duration type 170 Fax server 446
Time type 169 E Functions 448
Dates and times 332 Fax server 446
DateTime (Variable) 169 Editor Programming 447
Tome1_2.book Page 615 Vendredi, 28. mai 2010 5:50 17

615

File Archive 368 USB 355


Index 585 Binary 327 Window 271
Limits 604, 610 Burner 371 Window control 250
Member 69 Character string 330 Window status bar 304
Operation 72 Chart 337 Windows 357
Owner 69 Clipboard 352, 353 Windows event 358
Project 60 Date 332 XLS 366
Zip 367 DDE 362 ZIP 368
File alias 513 Debugging 106 Functions
File browse 505 Dialog box 288 LDAP 438
File description (Variable) 182 DotNet 485 MCI 355
File protection 516 Drag and Drop 310 SNMP 363
File variable 503 Email 410
Filter 506 Euro 342 G
Finances (functions) 328 Executable 361
Fixed array (Variable) 175 External files 345 Generating an XML Web service 489
Fonction Fax 448 Generation 75, 76
Menu 299 Finances 328 Analysis 76
XML 492 FTP 465 Java 133
Font (Variable) 185 HTTP 460 LDM 76
For (Statement) 201 HyperFileSQL 561 LDM from CDM 75
For all, array browsing (Statement)206, HyperFileSQL Client/Server 580 PHP 135
207 J2EE 487 Restart at a generation num 76
For all, control browsing (Statement) Java 358 Generation number (Reset to 1) 76
205 Matrix 327 Goto (Statement) 200
For all, file browsing (statement) 201 MDI 272 Group the selection 243
For all, string parsing (Statement) 204 Memory zone 343 GUI (checker) 246
For each, array browsing (Statement) Menu options 299
206, 207 Messages 288 H
For each, control browsing (Statement) Miscellaneous functions 359
205 Mouse 353 Handles of controls 242
For each, file browsing (Statement)201 Net 463 HTML page 460
For each, parsing string (Statement) Network 363 Retrieve 460
204 Overload a WLanguage function HTTP (functions) 460
Frame 224 Hyper File file
Operations 87 Page 279 Logical name 499
Frameset 83 Palm Pilot 459 HyperFileSQL
Creation 87 Print 349 Client/Server 579
Limits 607 Project 364 Client/Server functions 580
Index

Operations 87 Registry 352 Functions 561


Framework 494 Serial and parallel ports 353 Managing the NULL value 514
Framing a control 247 Service 356 ODBC driver 535
Free window 257 SOAP 483 Properties 567
Front Office 558 Socket 470 Remote access management
FTP 464 SQL 571 (RPC) 558
FTP (functions) 465 Statistics 328 Replication 555, 559
FTP (site deployment) 140, 142 System 356 SQL 537
FTP server 464 Telephony 442 Triggers 553
Function Thread 478 View 550
Agent 362 Twain 354 HyperFileSQL Client
Tome1_2.book Page 616 Vendredi, 28. mai 2010 5:50 17

616

Update by email 558 Interface checker 246 LDAP 438


HyperFileSQL file Internal 79 LDM 67
Alias 513 Internal window 79, 264, 265 Operations 71
Assign 520 Internal window 264, 265 LEFT 572
Backup 530 IS_NULL 578 LEN 575
Close 499 Item 503 LENGTH 575
Create 499 Handling 72 Library 140
Identifier 501, 516 Key 500 Limits 606, 612
Key 517 Metatypes 68 Limits 601, 607
Lock 541 Item description (Variable) 184 Analysis 604, 610
Log 529 Control 602, 608
Long name 499, 521 J Executable 606
Memos 519 File 604, 610
Open 499 J++ 535 Frameset 607
Optimization 534 J2EE 486 Image format 603, 609
Positioning 508 Functions 487 Index file 605, 611
Protection 516 Structure 486 Item 604, 610
Read 505 J2EE services server 486 Library 606, 612
Read based on a filter 506 Jar 133 Memo file 605, 611
Read based on key 505 JAVA 133 Menu 602, 608
Remote access (RPC) 558 Java (functions) 358 Page 607
Restore 530 JDBC 535 Process 603, 609
Size greater than 2Gb 500 Project 601, 607
Update by email 558 K Setup program 606, 612
Variable 503 Window 601
View 550 Key 500 xBase file 605, 611
HyperFileSQL view 550 Composite key 502 Link 68
Programming 551 Key type 500 Type 70
Read based on key 505 Types of links 517
I Key uniqueness 517 Link description (Variable) 183
Keywords Lock 541
Identification 57 Extern 213 HyperFileSQL file 541
Identifier 501 Modulo 215 Record 542
IF (Statement) 208 MyFile 217 Lock mode 542, 543
IF_NULL 578 MyPage 214 Locked (Control) 247
Image MyParent 217 Log 529
Supported format 603, 609 MyPopupControl 216 Programming 531
Import MyReport 217 Log file 529
Data file 68 Myself 215 Logical name 499
Index

Window 78 MySource 215 Long name 499, 521


Importing an XML Web service 488 MyWindow 214 Loop (Statement) 200
Incoming calls 439 Stop 218 LOWER 575
Index 585 LPAD 574
Installing a site 142, 143 L LTRIM 572
Installing an application 133, 135,
136 Language
Page 84
M
INSTR 575
Int (variable) 167 SQL 537 Main menu 294
Integrity check 517 Window 78 Menu options 296
Inter locking 542 LAST_DAY 578 MAPI 404
Tome1_2.book Page 617 Vendredi, 28. mai 2010 5:50 17

617

Marker 245 MyPage (Keywords) 214 Comparison 194


Matrices 325 MyParent (Keywords) 217 Optimization 534
Functions 327 MyPopupControl (Keywords) 216 Optional link 70
Handling 325 MyReport (Keywords) 217 Outgoing calls 441
MAX 576 Myself (Keywords) 215 Overloading a WLanguage function224
MCI (functions) 355 MySource (Keywords) 215 Owner (File) 69
MDI 256 MyWIndow (Keywords) 214
Functions 272 P
MDI Child 256 N
MDI Parent 256 Page 83
MDI window (functions) 272 Net (functions) 463 Context 276
Member (File) 69 Network (functions) 363 Creation 84
Memo 519 NEW_TIME 578 Dynamic page 273
Memo File NEXT_DAY 578 Frameset 83
Limits 605, 611 Non-MDI window 257 Functions 279
Memo file 519 Non-modal 257 Index file 611
Memory zone (functions) 343 Close 259 Item 610
Menu Minimize 259 Limits 607
Functions 299 Open 258 Multilingual 84
Limits 602, 608 Overlaying 259 Open 277
Main menu 294 Non-modal management 257 Operations 85
Menu options 296 Non-modal window 257 Overview 273
Popup menu 289 Close 259 Page template 274
Menu option 296 Current 259 Page type 273
Function 299 Minimize 259 Page types 83
Message (functions) 288 Open 258 Page with parameter 275
Metatypes 68 Overlaying 259 Processes 278
MID 572 NULL 171 Properties 279
MIN 576 NULL in HyperFileSQL 514 Refresh a page 276
Modal 257 Numeric (Variable) 167 Semi-dynamic page 273
Close 257 Numeric key 501 Site types 84
Current 257 NVL 578 Static page 273
Minimize 257 Template 274
Open 257 O Validate 277
Modal management 257 Version 86
Modal window 257 ODBC driver for HyperFileSQL 535 Page context 276
Close 257 Open Page parameter 275
Current 257 Frameset 87 Page template 274
Minimize 257 Page 85, 277 Palm Pilot 449
Index

Open 257 WinDev 56 Functions 459


Modulo (Keywords) 215 Window 80 Modify data 449
MONTHS_BETWEEN 578 Operator 191 Read data 457
Mouse Arithmetic 192 Structure 452
Functions 353 Binary 192 Palm Structure 452
Moving a control 243 Indirection 197 Parallel link 70
Moving inside a file 508 Logical 191 Parameters of a procedure 222
Multilingual 311 Miscellaneous 198 Password 516
Dialog box 286 On address 196 Variable 516
Functions 316 On character strings 195 PATINDEX 575
MyFile (keyword) 217 operator PDA 449
Tome1_2.book Page 618 Vendredi, 28. mai 2010 5:50 17

618

Performances of an application 104 Settings 60 Refreshing a page 276


PHP 135, 274 Share 151 Registration
PHP generation 135 Task list 61 Card 46
PHP page 274 Test 92, 95 Registration card 46
PHP site 135 Time management 62 Registry (functions) 352
POP3 401 Trace 101 Relationship 73
Popup (window) 262 Project documentation 129 Remote access
MyPopupControl 216 Project graph 60 HyperFileSQL file 558
Popup menu 289 Project migration 46 REPLACE 574
Custom 289 Property Replication file 555, 559
Menu options 296 Anchor 249 Report 89
System 292 DateTime 169 Creation 89
Popup window 262 Duration 170 Type 89
MyPopupControl 216 File description 182 Reserved words 213
Previous (Button) 281 Hour 169 Result (Statement) 211
Previous versions 46 HyperFileSQL 567 Retrieving HTML pages 460
Print Item description 184 Return (Statement) 211
Drawings 348 Link description 183 RIGHT 572
Fonts 348 Page 279 ROUND 578
Functions 349 Window 269 RPAD 574
Images 348 Window status bar 302 RTRIM 573
Parameters 347 Windows and controls 317 Rule for variable scope 190
Principles 347 Property (CDM) 73 Ruler 245
Text 348 Operation 75 Running a test page 151
Print area 130 Protocol Running WinDev 56
Printing 347 POP 3 401
Overview 347 SMTP 401 S
Procedure 219 SOAP 479
Call 221 SSL 392 SCM (Source Code Manager) 151
Declare 221 Search
Global 219 Q Exact match 501
Local 220 Generic 501
Parameters 222 Query 77 Search argument 501
Sets of procedures 220 Printout area 130 Search Criterion 501
Process Search engine (site referencing) 90
Limits 603, 609 R Search key 505
Project 58 Secure transaction 392
Components 61 RAD 78 Securing transactions (SSL) 392
Dashboard 60 Reading an email 408 Seeking records. 505
Index

Directory 60 Record 503 Selecting a control 242


Documentation 129 Add 507 Semaphore in threads 474
Duplicate 62 Delete 507 Semi-dynamic page 273
File 60 Loaded in memory 504 Sending faxes 446
Functions 364 Point 503, 504 Serial and parallel ports (functions)353
Limits 601, 607 Read 503 Server
Migration 46 Seek 505 HyperFileSQL Client/Server 579
Operation 62 Update 507 Service (functions) 356
PHP 135 Write 503 Set of procedures 220
Project diagram 60 Reference a site 90 Setup program 137, 587
SCM 151 Referential integrity 70, 517 Limits 606, 612
Tome1_2.book Page 619 Vendredi, 28. mai 2010 5:50 17

619

Shared link 71 SUM 576 Telephony 439


Sharing a project 151 TOP 577 Functions 442
Signals 476 UPPER 575 Incoming calls 439
Simple array (Variable) 173 SSL 392 Outgoing calls 441
Site SSL certificate 392 Template 274
AJAX 384 Starting WinDev 56 Temporary (File) 533
Deployment 140, 146 Statement 200 Temporary file 533
Link with WinDev 558 Break 212 Test
Open a page 277 Composite 200 Application 92
Referencing 90 Continue 210 Performances 104
Resources 144 For 201 Project 92, 95
Search engine 90 For all (array browsing) 206, Stress test 98
Setup 142 207 Window 100
Site types 84 For all (control browsing) 205 Test page 151
Size of a window 80 For all (file browsing) 201 Text key 501
Skin template For all (string parsing) 204 Thread 473
Window 78 For each (array browsing) 206, Functions 478
SMTP 401 207 Managing semaphores 474
SNMP (Functions) 363 For each (control browsing) 205 Signals 476
SOAP 479 For each (file browsing) 201 Time
Functions 483 For each (string parsing) 204 DateTime type 169
SOAP server 479 Goto 200 Duration type 170
Configure 482, 491 IF 208 Time type 169
Running procedures 479 Loop 200 Time (Management) 62
Socket 466 Result 211 Time addition 62
Functions 470 Return 211 Time management 62
SOUNDEX 577 Switch 208 Tools
SOUNDEX2 577 Static page 273 WinDev Mobile tools 589
Source Code Manager 151 Statistics (functions) 328 Tooltip 340
Speeding up processes 534 Status bar 301 TOP 577
SQL 537 Status report Trace the project 101
AVG 576 WLanguage 103 Transaction 526
BOTTOM 577 Stop (Keywords) 218 Programming 527
COUNT 576 Structure TRANSLATE 574
Functions 571 DotNet 484 Triggers 553
HyperFileSQL 537 Email 408 TRIM 573
INSTR 575 J2EE 486 TRUNC 578
LEFT 572 Structure (Variable) 178 Twain (functions) 354
LEN 575 SUBSTR 572 Twain device (functions) 354
Index

LENGTH 575 SUBSTRING 572 Type


LOWER 575 SUM 576 Buffer 168
LTRIM 572 Switch (Statement) 208 Controls 239
MAX 576 SYSDATE 578 Currency 167
MID 572 System (functions) 356 Currency+Euro 339
MIN 576 Data source 181
PATINDEX 575 T Date 169
RIGHT 572 DateTime 169
RTRIM 573 Tab order 80, 86 Dynamic array 174
SUBSRING 572 Task 61 File description 182
SUBSTR 572 Task list 61 Fixed array 175
Tome1_2.book Page 620 Vendredi, 28. mai 2010 5:50 17

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

Uniqueness 500 Distributing 118


Upload
UPPER
377
575
W Generating
Modifying
116
121
USB (functions) 355 Use in an application 119
WDADMIN 96, 147
User Visibility of elements 124
Configuration 147
Cookies 379 WinDev configuration 45
Connections 147
Macro-code 265 WinDev files 590
Development 147
User groupware 107 WinDev framework 131
Sites 148
User Macro-Code 131, 265 WinDev FTP/RPC 461
Test page 151
WDBackup 530 WinDev setup 45
WinDev tools
Tome1_2.book Page 621 Vendredi, 28. mai 2010 5:50 17

621

WDInst 587 Non-modal 257 Server code 164


WDSQL 586 Open 257, 258 Writing an email 407
WDTool 585 Operations 80
Window 78 Overlaying 259 X
Background image 253 Presentation 252
Close 257, 259 Processes 268 xBase 508
Creation 78 Properties 269, 317 File limits 605, 611
Current 257, 259 Status bar 301 xBase file 508
DDW 263 Test 100 Limits 605, 611
Dim disabled windows 263 Type 256 xBase index 508
Free 257 Version 81 XLS 366
Functions 271 Window control 239 Functions 366
Import 78 Window status bar XLS file 366
Index file 605 Functions 304 XML 492
Internal window 79 Properties 302 Functions 492
Item 604 Windows 352 XML document
Limits 601 Functions 357 Functions 492
MDI 256 Windows event (functions) 358 XML file 492
Minimize 257, 259 WLanguage 163 XML Web service 488
Modal 257 Browser code 164 Generate 489
Multilingual 78 Overload a WLanguage function XML Web services
Non MDI 257 224 Import 488

Index
Tome1_2.book Page 622 Vendredi, 28. mai 2010 5:50 17

622
Index

Das könnte Ihnen auch gefallen