User Tools

Site Tools


use_set_field_equate_label_or_control_update_variable_.htm
Navigation:  Language Reference > 9 -  Window and Report Attributes > Window and Report Attributes >====== USE (set field equate label or control update variable) ====== Previous pageReturn to chapter overviewNext page

NewC7.jpg

USE(|   label   | [,number] [,equate] )

variable

blk2blue.jpg

USE Specifies a variable or field equate label.
label A field equate label to reference the control or structure in executable code. This must begin with a question mark (?) and meet all the requirements of a valid Clarion label.
variable The label of the variable to receive the value the user enters in the control. The variable's label (with a leading question mark - ?VariableLabel) becomes the field equate label for the control, unless the equate parameter is used.
number An integer constant that specifies the number the compiler equates to the field equate label for the control (PROP:Feq, equivalent to {PROP:USE,2}).
equate A field equate label to reference the control in executable code when the named variable has already been used in the same structure. This provides a mechanism to provide a unique field equate when the variable would not.

The USE attribute (PROP:USE) specifies a field equate label for the control or structure, or a variable for the control to update.

USE with a label parameter simply provides a mechanism for executable source code statements to reference the control or structure. USE with a variable parameter supplies the control with a variable to update by operator entry (on a window control) or to provide the value to print (on a report control).

The USE attribute's number parameter allows you to specify the actual field number the compiler assigns to the control. This number also is used as the new starting point for subsequent field numbering for controls without a number parameter in their USE attribute. Subsequent controls without a number parameter in their USE attribute are incremented (or decremented) relative to the last number assigned.

Two or more controls with exactly the same USE variable in one WINDOW or APPLICATION structure would create the same Field Equate Label for all, therefore, when the compiler encounters this condition, all Field Equate Labels for that USE variable are discarded. This makes it impossible to reference any of these controls in executable code, preventing confusion about which control you really want to reference. It also allows you to deliberately create this condition to display the contents of the variable in multiple controls with different display pictures. You may eliminate this situation by using equate parameters on these controls.

Writing to PROP:USE changes the USE attribute to use the name of the variable assigned. Reading it returns the contents of the current USE variable. PROP:Feq sets and returns the field number for the control.

Window Usage

black.jpg

Some controls or structures only allow a field equate label as the USE parameter, not a variable. These are: PROMPT, IMAGE, LINE, BOX, ELLIPSE, GROUP, RADIO, REGION, MENU, BUTTON, and TOOLBAR.

USE with a variable parameter supplies the control with a variable to update by operator entry. This is applicable to an ITEM with the CHECK attribute, ENTRY, OPTION, SPIN, TEXT, LIST, COMBO, CHECK, and CUSTOM.

PROP:ListFeq is equivalent to {PROP:USE,3} and sets the field equate label for the list portion of a COMBO control or a LIST control with the DROP attribute. See Also: PROP:Selected

PROP:ButtonFeq is equivalent to {PROP:USE,4} and sets the field equate label for the drop button portion of a COMBO control (not valid for drop list controls).

Report Usage

black.jpg

Some controls and strcutures only allow a field equate label as the USE parameter, not a variable. These are: IMAGE, LINE, BOX, ELLIPSE, GROUP, RADIO, FORM, BREAK, DETAIL, HEADER, and FOOTER.

USE with a variable parameter supplies the control with a variable to update by operator entry. This is applicable to an OPTION, TEXT, LIST, CHECK, or CUSTOM. STRING controls may use either a field equate label or variable.

All controls and structures in a REPORT are automatically assigned numbers by the compiler. By default, these numbers start at one (1) and increment by one (1) for each control in the REPORT. The USE attribute's number parameter allows you to specify the actual field number the compiler assigns to the control or structure. This number also is used as the new starting point for subsequent numbering for controls and structures without a number parameter in their USE attribute. Subsequent controls and structures without a number parameter in their USE attribute are incremented relative to the last number assigned.

Example:

MainWin APPLICATION('My Application'),SYSTEM,MAX,ICON('MyIcon.ICO'),STATUS

        MENUBAR

         MENU('&File'),USE(?FileMenu)

          ITEM('&Open…'),USE(?OpenFile)

          ITEM('&Close'),USE(?CloseFile),DISABLE

          ITEM('E&xit'),USE(?MainExit)

         END

        END

        TOOLBAR,USE(?Toolbar)

         BUTTON('Exit'),USE(?MainExitButton)

         ENTRY(@S8),AT(100,160,20,20),USE(E2)

         ENTRY(@S8),AT(100,200,20,20),USE(E3,100)      !Field number 100

         ENTRY(@S8),AT(100,240,20,20),USE(E2,,?Number2:E2)  !

        END

       END

CustRpt  REPORT,AT(1000,1000,6500,9000),THOUS

Detail    DETAIL,AT(0,0,6500,1000),USE(?Detail)                        !Line item detail

         STRING('Group Total:'),AT(5500,500,1500,500),USE(?Constant)  !Field equate label

         STRING(@N$11.2),AT(6000,1500,500,500),USE(Pre:F1)            !USE variable

         END

        END

CODE

OPEN(MainWin)

DISABLE(?E2)                    !Disable first entry control

DISABLE(100)                    !Disable second entry control

DISABLE(?Number2:E2)            !Disable third entry control

PrintRpt(CustRpt,?Detail)       !Pass report and detail equate to print proc

 ACCEPT

 END

PrintRpt PROCEDURE(RptToPrint,DetailNumber)

CODE

OPEN(RptToPrint)                !Open passed report

PRINT(RptToPrint,DetailNumber)  !Print its detail

CLOSE(RptToPrint)               !Close passed report

See Also:

Field Equate Labels

use_set_field_equate_label_or_control_update_variable_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1