Usage Note 19649: "ERROR: Attempt to invoke a method or access an attribute on an object
before its _INIT method has run."
If you have a Form Viewer or Table Viewer control in a SAS/AF Frame
entry and there is logic in the DFINIT label of the model SCL that
either executes a method or accesses an attribute of another object in
the Frame entry, you might receive the following ERROR message:
ERROR: Attempt to invoke a method or access an attribute on an
object before its _INIT method has run.
If you receive this error in SAS 9.1.3 and did not receive it in SAS
8.2, this is because of the issue documented in SAS Note #007405 . In
SAS 8, the DFINIT label in model SCL incorrectly executed after the INIT
label of the Frame's SCL program. We corrected this error in SAS 9.1 so
the labeled sections now execute in correct order:
DFINIT
Frame INIT
Model INIT
With the DFINIT label executing before INIT, you cannot assume that
other objects in the Frame entry will be fully created before the form
viewer is created and DFINIT executes. The error message indicates that
the other object is not fully created. If an object is not fully
created, you cannot execute methods or query attributes about that
object until it is fully created.
You have two options to avoid the error message and program halt:
1. position the other object so that it is at least 2 pixels above
the form viewer control
2. set a flag in DFINIT so that you can query the modelID attribute
the first time that model INIT executes.
Option #1
The first option might work well if you have the two objects
side by side. When a Frame entry needs to process more than one
component, a predefined order (known as the window order) controls the
processing order. The window order starts from the top row of the window
and moves to the bottom row. Additionally, window order moves from left
to right in each row. Therefore, if the two objects are side by side,
you can set the value of the verticalPosition attribute for the other
object to be 2 greater than the same attribute setting for the form
viewer. This means that the form viewer will be positioned lower on the
Frame entry enough to affect window order but not enough for the human
eye to detect a noticeable differerence. This is easy to accomplish by
following these steps:
1. create a Form Viewer control and a Table Viewer control in a Frame
entry; position the form viewer to the left of the table viewer.
2. click on the form viewer to select it.
3. hold down the Ctrl key and click on the table viewer to select it.
Both objects should now be selected.
4. From the pull-down menu, select Layout -> Align -> Tops.
You should now see the objects aligned on the top edge.
5. Open the Properties window and increase the value of the
verticalPosition attribute of the form viewer by 2. For example,
if it has a value of 30, change it to 32. The verticalPosition
attribute for the table viewer should have a value of 30.
With the above alignment of objects in your Frame entry, the following
logic will successfully execute in the DFINIT label of the model SCL for
the Form Viewer control:
DFINIT:
dcl object tableviewer1 modelid;
frameid=getnitemn(_viewer_,'_frame_');
call send(frameid,'_getWidget','tableviewer1',tableviewer1);
modelid=tableviewer1.modelid;
return;
Option #2
The second option works well for any arrangment of objects in your Frame
entry. With the following code in the model SCL, you will not query an
attribute of another object until you know that that object is fully
created. For example,
/* Model SCL */
DFINIT:
dcl object tableviewer1 modelid;
frameid=getnitemn(_viewer_,'_frame_');
call send(frameid,'_getWidget','tableviewer1',tableviewer1);
flag=1;
return;
INIT:
if flag=1 then
do;
flag=0;
modelid=tableviewer1.modelid;
end;
return;
Operating System and Release Information
SAS System | SAS/AF | Microsoft Windows NT Workstation | 9.1 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M0 | |
Microsoft Windows XP Professional | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M0 | |
Microsoft Windows 2000 Server | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M0 | |
Microsoft Windows 2000 Professional | 9.1 TS1M0 | |
Microsoft Windows 2000 Datacenter Server | 9.1 TS1M0 | |
64-bit Enabled Solaris | 9.1 TS1M0 | |
Microsoft Windows 2000 Advanced Server | 9.1 TS1M0 | |
Solaris for x64 | 9.1 TS1M3 SP4 | |
Linux | 9.1 TS1M0 | |
Linux on Itanium | 9.1 TS1M3 | |
HP-UX IPF | 9.1 TS1M0 | |
64-bit Enabled HP-UX | 9.1 TS1M0 | |
OpenVMS Alpha | 9.1 TS1M0 | |
64-bit Enabled AIX | 9.1 TS1M0 | |
Tru64 UNIX | 9.1 TS1M0 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Date Modified: | 2007-02-28 11:56:30 |
Date Created: | 2007-02-28 11:09:34 |