xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_WithObjectCounter()

Determines the nesting level of WITH OBJECT statements.

Syntax

HB_WithObjectCounter() --> nNestingLevel

Return

The function returns a numeric value indicating the nesting level of WITH OBJECT statements.

Description

Function HB_WithObjectCounter() is used to determine the nesting level of the current WITH OBJECT context. A context can be opened with the WITH OBJECT statement or the HB_SetWith() function.

Info

See also:HB_SetWith(), HB_QWith(), WITH OBJECT
Category: Object functions , xHarbour extensions
Source:vm\hvm.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example opens two WITH OBJECT contexts and displays
// the result of HB_WithObjectCounter().

   PROCEDURE Main()

      WITH OBJECT ErrorNew()
         ? :className()              // result: ERROR
         ? HB_WithObjectCounter()    // result: 1


         WITH OBJECT GetNew()

            ? :className()           // result: GET
            ? HB_WithObjectCounter() // result: 2

         END

         ? :className()              // result: ERROR
         ? HB_WithObjectCounter()    // result: 1
      END

      ? HB_WithObjectCounter()       // result: 0
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe