Visual FoxExpress (VFE) allows us to have several cursor objects per business object. The main cursor is always pointed by the property oCursor in the business object. The other cursors can be accessed via the Cursors collection in the Data Environment of the business object.
For example: let's say that we have a business object with 2 cursor objects. The first cursor can be accessed with this.oCursor while the second one can be accessed with this.oDataEnvironment.Cursors.Item( "v_myothercursor1" ).
It is possible to create a property oCursorOther and make it point to the other cursor: oCursorOther = this.oDataEnvironment.Cursors.Item( "v_myothercursor1" )
Even more, we can add the following code to the Access method of the oCursorOther property to ensure it will be always valid:
if isnull( this.oCursorOther )
this.oCursorOther = this.oDataEnvironment.Cursors.Item( "v_myothercursor1" )
The above code assumes you initialized the oOtherCursor property to .NULL. You can modify it to evalue against .F. instead.
-- Hector Correa
This also works to find the cursor object:
This.oCursorOther = This.findCursor( "cAlias" )
Make sure that you NULLIFY This.oCursorOther in the Destroy so that you do not have hanging object references.
* Destroy code;
This.oCursorOther = .NULL.
Category Visual FoxExpress
( Topic last updated: 2001.05.23 11:50:25 AM )