PreviousNextIndex

VALID-HANDLE function

Verifies that a handle is valid.

Note: Does not apply to SpeedScript programming.
Syntax

VALID-HANDLE ( handle ) 

handle
Example

In the following example, the user creates a window dynamically. The WINDOW-CLOSE trigger uses the VALID-HANDLE function to determine whether the window has been created.

r-valhnd.p
DEFINE VARIABLE mywin AS HANDLE NO-UNDO. 
DEFINE BUTTON mkwin LABEL "New Window". 
ENABLE mkwin. 
ON CHOOSE OF mkwin DO: 
  CREATE WINDOW mywin ASSIGN  
    VISIBLE          = TRUE 
    TITLE            = "Second Window" 
    MAX-WIDTH-CHARS  = 40 
    MAX-HEIGHT-CHARS = 10. 
  SELF:SENSITIVE   = FALSE. 
END. 
ON WINDOW-CLOSE OF DEFAULT-WINDOW DO: 
  IF VALID-HANDLE(mywin) THEN  
    DELETE WIDGET mywin. 
END. 
WAIT-FOR WINDOW-CLOSE OF DEFAULT-WINDOW. 

In the example, the VALID-HANDLE function returns a TRUE value only if the window has been created (that is, mywin does not have the Unknown value (?)) and the window has not been deleted. Therefore, the DELETE WIDGET statement executes only if mywin is a valid handle.

Notes
See also

CREATE SERVER statement, HANDLE function


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex