PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Implementation
  • Including the files of Fortran interface of WINDEV
  • Loading the WINDEV library (WDL)
  • Running WINDEV codes from the external language
  • Ending the application
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
We are going to call the elements developed in WINDEV (project, windows, analysis, ...) from the Fortran language. The WLanguage code used from the external language will be dynamically compiled and run during its call.
This mode is illustrated by the City.dsp project (in Fortran format) supplied in the "ExternalLanguages\Fortran" sub-directory of the setup directory of WINDEV.
Notes:
  • The Fortran language does not allow you to use the HyperFileSQL engine. To handle the HyperFileSQL engine, perform the necessary processes in WINDEV.
  • The Fortran external language does not support the Chinese character set.
Implementation

Including the files of Fortran interface of WINDEV

The following files must be included in a Fortran project in order to call the Fortran interface of WINDEV:
  • WDDEBUT.FI
  • WDFIN.FI
  • WINDEV.FI
  • WinDeve.FI
  • WINDEV.FD
  • wd170FC.LIB
The following lines must be included in the code of the main ".FOR" file of your Fortran project:
* Mandatory declaration file
include 'Windev.fd'
include 'Windev.fi'
Character*2 Chn
* Mandatory initialization of WINDEV
include 'WDDebut.fi'
These lines allow you to retrieve the minimum declarations required to use the external interface.
Loading the WINDEV library (WDL)
The WINDEV library (.WDL extension) contains all the project elements (windows, reports, classes, queries, analysis, ...). Therefore, it must be loaded in memory in order for its components to be called.
Caution: If the library to load contains windows, the code of each one of these windows must be included in the corresponding ".WDW" file ("Include the compiled code" must be checked in the "Details" tab of the description of each window).
* Opening the library
* if WDInt is not null, the library was not found!
CALL CALLWD(LOC('LIBRA,Disk,city.wdl'C))
if (WDInt .EQ. 0) then
.......
else
* Library not found
CALL CALLWD(Loc('Error, Library not found'C))
endif
Running WINDEV codes from the external language
1. Calling a WLanguage code
All the WLanguage functions can be called from the external language. The behavior of these WLanguage functions as well as the returned values are identical whether they are called:
  • from WINDEV or
  • from the interface of external language
To find out the parameters and the return values of a WLanguage function, see the online help or the documentation about WLanguage.
The call to a procedure
* open the first window of the program that contains the menu
CALL CALLWD(LOC('Open, menufc.wdw'C))
2. Retrieving the events triggered in the WINDEV windows
The input in the WINDEV windows requires to retrieve the events triggered in these windows.
To retrieve the user events (click on a menu, on a button, and so on), you must implement a system based on a loop in your Fortran program. This loop will remain active as long as the WINDEV window is opened and it will be used to intercept each user action.
To find out the type of action performed by the user, you have the ability to use a character string variable (in WLanguage) named 'WDKey'. This variable will be used in your WLanguage code to signal to the Fortran program which button was pressed for example.
Example: Fortran code
* open the first window of the program that contains the menu
CALL CALLWD(LOC('Open,menufc.wdw'C))
* the program loops until the File Exit option
* is selected
DO While (WDKey .NE. 'ESC')
* perform the input of the menu
CALL CALLWD(Loc('Screen,Input'C))
* the status report WDKey is set to *M* when a menu choice
* was selected
if (WDKey .EQ. '*M*') then
Str = WDString
...
* Display the list.
if (Str .EQ. 'DD') then
Call CALLWD(LOC('Open,lstdepfc.wdw'C))
Call CALLWD(Loc('Screen,Input'C))
Call CALLWD(Loc('Close'C))
endif
* Print.
if (Str .EQ. 'DI') then
Call CALLWD(LOC('Open,impdep.wdw'C))
WDKey = ' '
endif
...
Code for intercepting the selection of "File..Exit" of the WINDEV "Menu" window:
DO While (WDKey .NE. 'ESC')
* the status report WDKey is set to *M* when a menu choice
* was selected
if (WDKey .EQ. '*M*') then
Str = WDString
endif
...
if (Str .EQ. 'FE') then
WDKey = 'ESC'
endif
     ...
END DO
* Exit from the application
When the user clicks "File .. Exit":
  • WDKey will be equal to "*M*".
  • WDString will contain the shortcuts in the order in which the menus are selected. In our example, WDString contains "FE".
Ending the application
To end the use of external interface, type the following code lines:
* Done...
include 'wdfin.fi'
END
Minimum required version
  • Version 9
Comments
Click [Add] to post a comment