JavaScript Editor js editor     Web development 



Main Page

Places an object reference for the currently selected control or container that exists in the Form Designer, Class Designer, or code editing window into a specified variable array. When calling ASELOBJ( ) in a code editing window, the array also includes elements for forms (.scx), visual class libraries (.vcx), and #INCLUDE file names. You can also use ASELOBJ(В ) to create control builders.

ASELOBJ( ArrayName, [ 1 | 2 | 3 ] )

Parameters

ArrayName


Specifies the name of the array you want to use.
1


Creates a one-element array containing an object reference to the container for the currently active and selected control. For example, if the currently active and selected control is a spinner on a form, the array contains an element with the value "FORM." When calling ASELOBJ(В ) in the Command window, include this argument.
Note:
When a page frame is selected, ASELOBJ() returns the name of the current page.

2


Creates a one-element array containing an object reference to the DataEnvironment object for the form. The DataEnvironment object makes it possible for you to determine the data environment properties of the form.
3


Creates three-element array containing information in context with the currently active code editing window: object reference to a container object, the full path and name of the .scx or .vcx file, and the full path and name of the #INCLUDE file, if available. The following table shows the order in which these elements appear.

Array element Description

1

Object reference to container object

2

Full path and name of .scx or .vcx file

3

Full path and name of #INCLUDE file, if available

Note:
If no #INCLUDE file is available, the third element contains an empty string.

Return Value

Numeric data type. ASELOBJ(В ) returns the number of objects selected. The array contains three columns and a row for each selected object. .

Remarks

If no controls are selected, and the argument, 1, is omitted, ASELOBJ(В ) returns 0 and does not create the array. If no controls exist on the form, ASELOBJ(В ) does not recognize the form as the selected control. If no controls are currently selected and the argument, 1, is included, ASELOBJ(В ) returns 1.

If the array does not exist, Visual FoxPro automatically creates the array.

If the array exists but is too small to contain all the information, Visual FoxPro automatically increases the size of the array to accommodate the information. If the array is larger than needed, Visual FoxPro truncates the array.

If the array exists, and ASELOBJ(В ) returns 0 because no controls are selected, the array remains unchanged. If the array does not exist, and ASELOBJ(В ) returns 0, the array is not created.

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.

В Copy Code
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

See Also



JavaScript Editor js editor     Web development