|
|
|
|
|
- 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
External language: Programming in Fortran
You can call the elements developed in WINDEV (project, windows, analysis, etc.) from Fortran code. The WLanguage code used from the external language will be dynamically compiled and run during its call. This mode is illustrated in the "City.dsp" project (Fortran format), available in the "External Languages\EN\Fortran" subdirectory of the WINDEV installation directory. Remarks: - Fortran does not allow you to use the HFSQL engine. To use the HFSQL engine, perform the necessary processes in WINDEV.
- Fortran does not support Chinese characters.
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
The following lines must be included in the code of the main ".FOR" file of your Fortran project: * Fichier de declaration obligatoire include 'Windev.fd' include 'Windev.fi' Character*2 Chn * Initialisation obligatoire de 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, etc.). Therefore, it must be loaded in memory in order for its components to be called. Attention: If the library to be loaded contains windows, the code for each of these windows must be integrated into the corresponding ".WDW" file (option "Integrate compiled code" checked, in the "Detail" tab of each window description). * Ouverture de la bibliotheque * si WDEntier n'est pas nul, la bibliothèque n'a pas été trouvée! CALL APPELWD(LOC('BIBLI,Disque,ville.wdl'C)) if (WDEntier .EQ. 0) then ....... else * Bibliothèque non trouvée CALL APPELWD(Loc('Erreur, Bibliothèque non trouvée'C)) endif Running WINDEV codes from the external language 1. Calling a WLanguage codeAll 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 * ouverture de la première fenêtre du programme contenant le menu CALL APPELWD(LOC('Ouvre,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 menus, buttons, etc.), you need to implement a loop-based system 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 * ouverture de la première fenêtre du programme contenant le menu CALL APPELWD(LOC('Ouvre,menufc.wdw'C)) * le programme boucle jusqu'à ce que le choix Fichier Quitte * soit sélectionné DO While (WDTouche .NE. 'ESC') * on effectue la saisie du menu CALL APPELWD(Loc('Ecran,Saisie'C)) * le compte-rendu WDTouche vaut *M* lorsque un choix de menu * a été sélectionné if (WDTouche .EQ. '*M*') then Chn = WDChaine ... * Affichage liste. if (Chn .EQ. 'DD') then call APPELWD(Loc('Ouvre,lstdepfc.wdw'C)) call APPELWD (Loc('Ecran,Saisie'C)) call APPELWD (Loc('Ferme'C)) endif * Impression. if (Chn .EQ. 'DI') then call APPELWD (Loc('Ouvre,impdep.wdw'C)) WDTouche = ' ' endif ... Code for intercepting the selection of "File..Exit" of the WINDEV "Menu" window: DO While (WDTouche .NE. 'ESC') * le compte-rendu WDTouche vaut *M* lorsque un choix de menu * a été sélectionné if (WDTouche .EQ. '*M*') then Chn = WDChaine endif ... if (Chn .EQ. 'FQ') then WDTouche = 'ESC' endif ... END DO * Quitter l'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".
To end the use of external interface, type the following lines of code: * Terminer... include 'wdfin.fi' END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|