- Retrieving variables
- Edit control
- Static Text control
- Check Box
- Radio Button
- Text button
- Graphic button
- Graphic image and click area
- Scrollbar
- Drop-down list or expanded list
Screen,Get (External language) In french: Ecran,Recupere Retrieves the value in a control or in a variable. The space characters found at the end of WdString are deleted by default. Syntax
Screen,Get([<Name of the window>, ] <Name> [, <Index 1> [, <Index 2>]])
<Name of the window>: Character string (optional) Used to display the content of a control or variable in the <Window Name> window that is not the current window (for example, for the NAME control found in the CU_FIL window, you must specify CU_FIL.NAME). <Name>: Character string Name of the control or name of the variable. <Index 1>: Character string (optional) Index for an indexed control or for an indexed variable. <Index 2>: Character string (optional) lndice for a two-dimensional indexed variable. Remarks The WINDEV variable containing the value of the variable differs according to the type of the variable to retrieve: - If the variable is an integer, WdInt (for simple integer) or WdLong (for long integer) contains the integer value of the variable.
- If the variable is a real, WdReal (for simple real) or WdRealD (for double real) contains the real value of the variable.
- If the variable is a string or a currency, WdSting contains the value of the variable.
For a text variable exceeding 200 characters, the content of the control can be viewed according to two methods: - WdString contains the first 200 characters.
- the WDpLongText pointer points to the memory area for text retrieval; WdInt indicates the length of the string (in C and in Pascal only).
For a long text, all you have to do is check whether the value of the pointer differs from "Null"; in this case, the pointer contains the string to retrieve. In VB, no long text can be retrieved directly. In the other languages (Cobol, Fortran), WDpLongText will be a text variable that may contain 4000 characters. Warning: you must not perform any operations (reallocation, ...) on this pointer. Important: In C, to use WDpLongText, the program must be compiled with the "unsigned characters" option. Example in C: // Récupère le contenu de la variable Prix APPELWD("Ecran,Recupere,PRIX"); Montant=WDReel*Quantite; // Récupère le contenu de la variable indicée LIBPROD[1] APPELWD("Ecran,Recupere,LIBPROD,1"); strcpy(Libelle,WDChaine); // Récupère le contenu de la variable Nom APPELWD("Ecran,Recupere,NOM"); strcpy(Nom,WDChaine); Example in Pascal: * Récupère le contenu de la variable Prix*) APPELWD('Ecran,Recupere,PRIX'); Montant=WDReel*Quantite; (*Récupère le contenu de la variable indicée LIBPROD[1]*) APPELWD('Ecran,Recupere,LIBPROD,1'); Libelle:=WDChaine; (* Récupère le contenu de la variable Nom*) APPELWD('Ecran,Recupere,NOM'); Nom:=WDChaine; Example in VB: ' Récupère le contenu de la variable Prix call APPELWD("Ecran,Recupere,PRIX") Montant=WDReel*Quantite ' Récupère le contenu de la variable indicée LIBPROD[1] call APPELWD("Ecran,Recupere,LIBPROD,1") Libelle=WDChaine ' Récupère le contenu de la variable Nom call APPELWD("Ecran,Recupere,NOM") The WINDEV variable containing the control value differs according to the type of control to retrieve: - If the control is an integer, WdInt (for simple integer) or WdLong (for long integer) contains the integer value of the control.
- If the control is a real, WdReal (for simple real) or WdRealD (for double real) contains the real value of the control (one of the variables according to the input mask defined).
- If the control is a text/date/time string, WdString contains the text value of the control.
For a text control, the content of the control can be viewed according to two methods: - by WdString if the control contains up to 200 characters
- via the WDpLongText pointer that points toward the memory area for text retrieval and WdInt that indicates the length of the string (in C and in Pascal only). If the value of the pointer differs from "Null", the pointer contains the string to retrieve.
In VB, no long text can be retrieved directly. In the other languages (Cobol, Fortran), WDpLongText will be a text variable that may contain 4000 characters. Warning: you must not perform any operations (reallocation, ...) on this pointer. In C, to use WDpLongText, the program must be compiled with the "unsigned characters" option.
Example in C: APPELWD("Ecran,Recupere,PRIX"); // Récupère le prix Montant=WDReel*Quantite; APPELWD("Ecran,Recupere,LIBPROD,1"); // Récupère le champ indicé 1 strcpy(Libelle,WDChaine); APPELWD("Ecran,Recupere,NOM"); // Récupère le nom strcpy(Nom,WDChaine); Method used to retrieve a long text:
// pszNomChamp: Nom du champ à récupérer // pszValeur: Chaine de caractères contenant le résultat // nLng Longueur maxi de la chaîne résultat sans // compter le zéro binaire //en Sortie: pszValeur Contient le résultat
void RecupereLong(char far *pszNomChamp,char far *pszValeur,int nLng) { char far *pszSource; APPELWD("ECRAN,RECUPERE,%Fs",pszNomChamp); if (WDpTexteLong!=NULL) pszSource=WDpTexteLong; else pszSource=WDChaine; // pszSource peut éventuellement dépasser nLng _fstrncpy(pszValeur,pszSource,nLng); // strncpy ne met pas le zéro binaire si // la chaîne source fait exactement nLng caractères pszValeur[nLng]=0; } Example in Pascal: APPELWD('Ecran,Recupere,PRIX'); (*Récupère le prix*) Montant:=WdReel*Quantite; APPELWD('Ecran,Recupere,LIBPROD,1'); (*Récupère le Libellé indicé 1*) Libelle:=WdChaine; APPELWD('Ecran,Recupere,NOM'); (*Récupère le NOM*) Nom:=WdChaine; APPELWD('Ecran,Recupere,TEXTELONG); (*Récupère le champ TEXTELONG*) move(txtlg,wdptextelong,WdEntier); Example in VB: call APPELWD("Ecran,Recupere,PRIX") 'Récupère le prix Montant=WdReel*Quantite; call APPELWD("Ecran,Recupere,LIBPROD,1") 'Récupère le champ Libellé Libelle=WdChaine call APPELWD("Ecran,Recupere,NOM") 'Récupère le Nom Nom=WdChaine WdString contains the static displayed. Example in C:
APPELWD("Ecran,Recupere,LIB"); strcpy(Libelle,WDChaine); Example in Pascal: APPELWD('Ecran,Recupere,LIB'); Libelle:=WdChaine; Example in VB: call APPELWD("Ecran,Recupere,LIB") Libelle=WdChaine If the check box is checked for the given subscript, WdString contains "O" and WdInt is equal to 1. If the check box is not checked for the given subscript, WdString contains "N" and WdInt is equal to 0. Example in C: APPELWD("Ecran,Recupere,INTERR"); if (WDEntier==1) ... Example in Pascal: APPELWD('Ecran,Recupere,INTERR'); if (WDEntier=1) ... Example in VB: call APPELWD("Ecran,Recupere,INTERR") if WDEntier=1 ... WdInt contains the rank of the current option Example in C: APPELWD("Ecran,Recupere,SELECT"); if (WDEntier==2) ... Example in Pascal: APPELWD('Ecran,Recupere,SELECT'); if (WDEntier=2) ... Example in VB: call APPELWD("Ecran,Recupere,SELECT") if (WDEntier=2) ... WdString contains the caption of the button. Example in C: APPELWD("Ecran,Recupere,Image1"); strcpy(Libelle,WDChaine); Example in Pascal: APPELWD('Ecran,Recupere,Image2'); Libelle:=WdChaine; Example in VB: call APPELWD("Ecran,Recupere,Image3") Libelle=WdChaine WdString contains the name of the image file displayed in the button. Example in C: APPELWD("Ecran,Recupere,Image1"); strcpy(FicImage,WDChaine); Example in Pascal: APPELWD('Ecran,Recupere,Image2'); FicImage:=WdChaine; Example in VB: call APPELWD("Ecran,Recupere,Image3") FicImage=WdChaine Graphic image and click area <Value> can be the name of the image file to display: Example in C: APPELWD("Ecran,Recupere,Image1"); strcpy(FicImage,WDChaine); Example in Pascal: APPELWD('Ecran,Recupere,Image2'); FicImage:=WdChaine; Example in VB: call APPELWD("Ecran,Recupere,Image3") FicImage=WdChaine WdInt contains the position of the scrollbar: Example in C: APPELWD("Ecran,Recupere,ASCENS"); Example in Pascal: APPELWD('Ecran,Recupere,ASCENS'); Example in VB: call APPELWD("Ecran,Recupere,ASCENS") Drop-down list or expanded list If the subscript is specified, the text value of the element is returned in WdString. If the index is not specified, WdInteger contains the index of the selected element (not significant for combos with input) and WdString the value of the selected element. For the multi-selection list boxes, only the first selected element will be retrieved. Example in C: APPELWD("Ecran,Recupere,LISTE1,2"); strcpy(elem,WDChaine) Example in Pascal: APPELWD('Ecran,Recupere,LISTE1,2'); Elem:=WdChaine; Example in VB: call APPELWD("Ecran,Recupere,LISTE1,2") Elem=WdChaine
|
|
|