ASELOBJ( ) Function Example

Before running the following example, open a new form in the Form Designer and add one or more controls with Caption properties, such as a Label or CommandButton, to the form. Select a number of these controls and then run the example. ASELOBJ( ) displays the names of  the selected controls, and then changes the captions of the selected controls.

gnobjects = ASELOBJ(gaSelected)     && Create array of control names
IF gnobjects > 0  && 0 indicates no controls selected
   CLEAR
   DISPLAY MEMORY LIKE gaSelected     && Displays selected controls
   FOR nCnt = 1 TO gnobjects 
      ? gaSelected(nCnt).Caption + ' => New Caption ' ;
         + LTRIM(STR(nCnt))  && Display old and new caption
      gaSelected(nCnt).Caption = 'New Caption ' ;
         + ALLTRIM(STR(nCnt))  && Assign new caption
   NEXT
ENDIF