Progress
ADM 2 Guide


Get and Set Functions for Object Properties

A second mechanism that supports retrieving and setting property values is a naming convention that defines two groups of Progress functions called get and set functions. These functions are available for all properties that can be read or written by other objects:

If no special processing is needed to get or set a property, the get and set functions simply use the special include file syntax defined in the "ADMProps Temp–table and Object Properties" section to access the appropriate field in the properties temp–table record for the SmartObject. For example:

FUNCTION getMyProp RETURNS CHARACTER:
  DEF VAR cProp AS CHAR.
  {get MyProp cProp}.
  RETURN cProp.
END.

FUNCTION setMyProp RETURNS LOGICAL (pcMyValue AS CHARACTER):
  {set MyProp pcMyValue}.
  RETURN TRUE.
END. 

Note that the get and set functions are not restricted to such simple operations; they can perform whatever actions you need to in order to set and get values, such as verifying the validity of values. For example, you could use the following pair of functions to get and set the value of the BackGround Color property (BGColor) of the default Progress Frame in an object such as a SmartDataViewer:

FUNCTION getBGColor RETURNS INTEGER:
  RETURN {&FRAME-NAME}:BGCOLOR.
END.

FUNCTION setBGColor RETURNS LOGICAL (piBGC AS INTEGER):
  IF piBGC <= SomeMaxBGColorValue THEN DO:
   {&FRAME-NAME}:BGCOLOR = piBGC.
    RETURN TRUE.
  END.
  ELSE RETURN FALSE.
END. 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095