User Tools

Site Tools


property_expressions.htm

 

[target] [$] [control] { property [,element] }

blk2blue.jpg

target The label of an APPLICATION, WINDOW, REPORT, VIEW, or FILE structure, the label of a BLOB, or one of the built-in variables: TARGET, PRINTER, or SYSTEM. If omitted, the  target is assumed from the context (it's recomended that you set it to a specific target).
$ Required delimiter when both target and control are specified. Omit if either target or control is omitted.
control A field number or field equate label for the control in the target structure (APPLICATION, WINDOW, or REPORT) to affect. If omitted, the target must be specified. The control must be omitted if the target is a FILE, BLOB, or the PRINTER or SYSTEM built-in variables.
property An integer constant, EQUATE, or variable that specifies the property (attribute) to change. It can also be a string when referencing an OCX or OLE container property.
element An integer constant or variable that specifies which element to change (for properties which are arrays).

This property expression syntax allows you access to all the attributes (properties) of APPLICATION, WINDOW, or REPORT structures, or any control within these structures. To specify an attribute of an APPLICATION, WINDOW, REPORT, VIEW, or FILE structure (not a component control), omit the control portion of the property expression. To specify a control in the current window, omit the target portion of the property expression.

REPORT data structures are never the target by default. Therefore, either SETTARGET must be used to change the target to the REPORT, or the REPORT structure's label must be explicitly specified as the target before you can change any property of the structure, or any control it contains.

Property expressions may be used in Clarion language statements anywhere a string expression is allowed, or as the destination or source of simple assignment statements. They may not be used in operating assignment statements (such as +=, *=, etc.). Assigning a new value to a property is a simple assignment with the property as the destination and the new value as the source. Determining the current value of a property is a simple assignment where the property is the source and the variable to recieve its value is the destination. A Property expression may also be used as an executable statement (without an assignment statement) when the property expression is a method call for an OLE or OCX control.

All properties are treated as string data at runtime; the compiler automatically performs any necessary data type conversion. Any property without parameters is binary (toggle). Binary properties are either “present” or “missing” and return a '1' if present, and (null) if missing. Changing the value of a binary property to (null), '0' (zero), or any non-numeric string sets it to missing. Changing it to any other value sets it to “present.”

Most properties can be both examined (read) and changed (written). However, some properties are “read-only” and cannot be changed. Assigning a value to a “read-only” property has no effect at all. Other properties are “write-only” properties that are meaningless if read. Some properties are arrays that contain multiple values. The syntax for addresssing a particular property array element uses a comma (not square brackets) as the delimiter between the property and the element number.

Built-in Variables

black.jpg

There are three built-in variables in the Clarion for Windows runtime library: TARGET, PRINTER, and SYSTEM. These are only used with the property assignment syntax to identify the target in a property expression.

TARGET by default references the window that currently has focus. It can be set to reference a Window in another execution thread or the currently printing REPORT, enabling you to affect the properties of controls and windows in other execution threads and dynamically change Report control properties while printing. The SETTARGET statement and SYSTEM {PROP:Target} property changes the TARGET variable's reference.

PRINTER references the Printer Properties to be used by the next REPORT opened (and any subsequent reports).

SYSTEM specifies global properties used by the entire application. There are a number of runtime properties that may use the SYSTEM variable to set or query application-wide properties.

Example:

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

MENUBAR

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

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

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

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

END

MENU('Help'),USE(?HelpMenu)

ITEM('Contents'),USE(?HelpContents),STD(STD:HelpIndex)

ITEM('Search for Help On…'),USE(?HelpSearch),STD(STD:HelpSearch)

ITEM('How to Use Help'),USE(?HelpOnHelp),STD(STD:HelpOnHelp)

ITEM('About MyApp…'),USE(?HelpAbout)

END

END

TOOLBAR

BUTTON('Open'),USE(?OpenButton),ICON(ICON:Open)

END

END

CODE

OPEN(MainWin)

MainWin{PROP:Text} = 'A New Title'        !Change window title

?OpenButton{PROP:ICON} = ICON:Asterisk    !Change the Open button's icon

?OpenButton{PROP:AT,1} = 5                      !Change button x position

?OpenButton{PROP:AT,2} = 5                      !Change button y position

IF MainWin$?HelpContents{PROP:STD} <;> STD:HelpIndex

MainWin$?HelpContents{PROP:STD} = STD:HelpIndex

END

MainWin{PROP:MAXIMIZE} = 1                !Maximize the Window

ACCEPT

CASE ACCEPTED()                          !Which control was chosen?

OF ?OpenFile                             !Open… menu selection

OROF ?OpenButton                         !Open button on toolbar

START(OpenFileProc)                     !Start new execution thread

OF ?MainExit                             !Exit menu selection

OROF ?MainExitButton                     !Exit button on toolbar

BREAK                                   !Break ACCEPT loop

OF ?HelpAbout                            !About… menu selection

HelpAboutProc                           !Call application information procedure

END

END

CLOSE(MainWin)                            !Close APPLICATION

RETURN

See Also:

SETTARGET

Runtime Properties

property_expressions.htm.txt · Last modified: 2021/04/15 15:57 (external edit)