Version 6.3.8 for Windows
 —  Statements  —

Handle Definition

The handle-definition is used with DEFINE DATA LOCAL, DEFINE DATA OBJECT, DEFINE DATA PARAMETER, DEFINE DATA INDEPENDENT and DEFINE DATA CONTEXT.

The handle-definition has the following syntax:

handle-name

HANDLE OF

dialog-element-type

CONSTANT

init-definition

   

OBJECT INIT
 
(array-definition) HANDLE OF

dialog-element-type ../graphics/cbc2.gif ../graphics/sbo2.gif../graphics/cbo2.gif CONSTANT

array-init-definition
OBJECT INIT

This document covers the following topics:

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.


Function

A handle identifies a dialog element in code and is stored in handle variables. For further information, see NaturalX in the Programming Guide.

The HANDLE definition in the DEFINE DATA statement is generated automatically on the creation of a dialog element or dialog.

After having defined a handle, you can use the handle-name in any statement to query, set or modify attribute values for the defined dialog-element-type.

See also Introduction to Event-Driven Programming and Event-Driven Programming Techniques in the Programming Guide.

Examples of handle-definition:

1 #SAVEAS-MENUITEM HANDLE OF MENUITEM
1 #OK-BUTTON (1:10) HANDLE OF PUSHBUTTON

Top of page

Syntax Description

Syntax Element Description
handle-name
Handle Name:

The name to be assigned to the handle; the naming conventions for user-defined variables apply.

For further information, see Naming Conventions for User-Defined Variables in Using Natural Studio.

HANDLE OF dialog-element-type
Dialog Element Type:

The type of dialog element. Its possible values are the values of the TYPE attribute.

For details, see Dialog Elements and Attributes in the Dialog Component Reference.

HANDLE OF OBJECT
Handle of Object:

Used in conjunction with NaturalX.

For further information, see NaturalX in the Programming Guide.

CONSTANT
CONSTANT Option:

The variable/array is to be treated as a named constant. The constant value(s) assigned will be used each time the variable/array is referenced. The value(s) assigned cannot be modified during program execution.

Notes:

  1. For reasons of internal handling, it is not allowed to mix variable definitions and constant definitions within one group definition; that is, a group may contain either variables only or constants only.
  2. The CONSTANT option must not be used with DEFINE DATA INDEPENDENT and DEFINE DATA CONTEXT.
INIT
INIT Option:

The variable/array is to be assigned an initial value. This value will also be used when this variable/array is referenced in a RESET INITIAL statement.

Note:
With DEFINE DATA INDEPENDENT and DEFINE DATA CONTEXT, the INIT clause is evaluated in each executed programming object that contains this clause (not only in the programming object that allocates the variable). This is different to the way the INIT works for global variables.

init-definition
Initial-Value Definition:

With the init-definition option, you define the initial/constant values for a variable. See Initial-Value Definition.

array-definition
Array Dimension Definition:

With an array-definition, you define the lower and upper bounds of dimensions in an array-definition. See Array Dimension Definition.

array-init-definition
Array Initial Value:

The array is to be assigned an initial value. This value will also be used when this array is referenced in a RESET INITIAL statement.

Top of page