- Retrieving variables
- Edit control
- Static 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) Subscript for a subscripted control or for a subscripted variable. <Index 2>: Character string (optional) Subscript for a two-dimensional subscripted 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 zone 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. Caution: no operation (reallocation, ...) must be performed on this pointer. Important: In C, to use WDpLongText, the program must be compiled with the option "unsigned characters". Example in C: // Retrieves the content of the Price variable CALLWD("Screen,Get,PRICE"); Amount=WDReal*Quantity; // Retrieves the content of the subscripted variable PRODCAP[1] CALLWD("Screen,Get,PRODCAP,1"); strcpy(Caption,WDString); // Retrieves the content of the Name variable CALLWD("Screen,Get,NAME"); strcpy(Name,WDString); Example in Pascal: * Retrieves the content of the Price variable*) CALLWD('Screen,Get,PRICE'); Amount=WDReal*Quantity; (*Retrieves the content of the indexed variable PRODCAP[1]*) CALLWD('Screen,Get,PRODCAP,1'); Caption:=WDString; (* Retrieves the content of the Name variable*) CALLWD('Screen,Get,NAME'); Name:=WDString; Example in VB: ' Retrieves the content of the Price variable call CALLWD("Screen,Get,PRICE") Amount=WDReal*Quantity ' Retrieves the content of the indexed variable PRODCAP[1] call CALLWD("Screen,Get,PRODCAP,1") Caption=WDString ' Retrieves the content of the Name variable call CALLWD("Screen,Get,NAME") 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. Caution: no operation (reallocation, ...) must be performed on this pointer. In C, to use WDpLongText, the program must be compiled with the "unsigned characters" option.
Example in C: CALLWD("Screen,Get,PRICE"); // Retrieves the price Amount=WDReal*Quantity; CALLWD("Screen,Get,PRODCAP,1"); // Retrieves the indexed control 1 strcpy(Caption,WDString); CALLWD("Screen,Get,NAME"); // Retrieves the name strcpy(Name,WDString); Method used to retrieve a long text:
// pszControlName: Name of the control to retrieve // pszValue: Character string containing the result // nLng Maximum length of the result string without // counting the binary zero //in output: pszValue Contains the result
void GetLong(char far *pszControlName,char far *pszValue,int nLng) { char far *pszSource; CALLWD("SCREEN,GET%Fs",pszControlName); if (WDpLongText!=NULL) pszSource=WDpLongText; else pszSource=WDString; // pszSource may exceed nLng _fstrncpy(pszValue,pszSource,nLng); // strncpy does not include the binary zero if // the length of the source string is strictly equal to nLng characters pszValue[nLng]=0; } Example in Pascal: CALLWD('Screen,Get,PRICE'); (*Retrieves the price*) Amount=WDReal*Quantity; CALLWD('Screen,Get,PRODCAP,1'); (*Retrieves the indexed static 1*) Caption:=WDString; CALLWD('Screen,Get,NAME'); (*Retrieves the NAME*) Name:=WDString; CALLWD('Screen,Get,LONGTEXT); (*Retrieves the LONGTEXT control*) move(lgtxt,wdplongtext,WdInt); Example in VB: call CALLWD("Screen,Get,PRICE") 'Retrieves the price Amount=WDReal*Quantity; call CALLWD("Screen,Get,PRODCAP,1") 'Retrieves the Static control Caption=WDString call CALLWD("Screen,Get,NAME") 'Retrieves the name Name=WdString WdString contains the static displayed. Example in C:
CALLWD("Screen,Get,STC"); strcpy(Caption,WDString); Example in Pascal: CALLWD('Screen,Get,STC'); Caption:=WDString; Example in VB: call CALLWD("Screen,Get,STC") Caption=WDString 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: CALLWD("Screen,Get,CHECKBOX"); if (WDInt==1)... Example in Pascal: CALLWD('Screen,Get,CHECKBOX'); if (WDInt=1)... Example in VB: call CALLWD("Screen,Get,CHECKBOX") if WDInt=1... WdInt contains the rank of the current option Example in C: CALLWD("Screen,Get,RADIOBBUTTON"); if (WDInt==2)... Example in Pascal: CALLWD('Screen,Get,RADIOBUTTON'); if (WDInt=2)... Example in VB: call CALLWD("Screen,Get,RADIOBUTTON") if (WDInt=2)... WdString contains the caption of the button. Example in C: CALLWD("Screen,Get,Image1"); strcpy(Caption,WDString); Example in Pascal: CALLWD('Screen,Get,Image2'); Caption:=WDString; Example in VB: call CALLWD("Screen,Get,Image3") Caption=WDString WdString contains the name of the image file displayed in the button. Example in C: CALLWD("Screen,Get,Image1"); strcpy(ImageFile,WDString); Example in Pascal: CALLWD('Screen,Get,Image2'); ImageFile:=WdString; Example in VB: call CALLWD("Screen,Get,Image3") ImageFile=WdString Graphic image and click area <Value> can be the name of the image file to display: Example in C: CALLWD("Screen,Get,Image1"); strcpy(ImageFile,WDString); Example in Pascal: CALLWD('Screen,Get,Image2'); ImageFile:=WdString; Example in VB: call CALLWD("Screen,Get,Image3") ImageFile=WdString WdInt contains the position of the scrollbar: Example in C: CALLWD("Screen,Get,SCROLLBAR"); Example in Pascal: CALLWD('Screen,Get,SCROLLBAR'); Example in VB: call CALLWD("Screen,Coordinate,SCROLLBAR") Drop-down list or expanded list If the subscript is specified, the text value of the element is returned in WdString. If the subscript is not specified, WdInt contains the subscript of the selected element (no significance for the editable combo boxes) and WdString contains the value of the selected element. For the multi-selection list boxes, only the first selected element will be retrieved. Example in C: CALLWD("Screen,Get,LIST1,2"); strcpy(elem,WDString) Example in Pascal: CALLWD('Screen,Get,LIST1,2'); Elem:=WdString; Example in VB: call CALLWD("Screen,Get,LIST1,2") Elem=WdString
|
|
|