xHarbour Reference Documentation > Function Reference |
Replaces the with object during WITH OBJECT execution.
HB_ResetWith( <oObject> ) --> NIL
The return value is always NIL.
Function HB_ResetWith() replaces the current with object in the context of the WITH OBJECT statement. All abbreviated messages within the WITH OBJECT .. END block are addressed to this new with object.
In contrast to the HB_SetWith() function, HB_ResetWith() does not open a new WITH OBJECT context. As a result, the nesting level of WITH OBJECT and the return value of HB_WithObjectCounter() remain unchanged.
See also: | HB_SetWith(), HB_QWith(), HB_WithObjectCounter(), WITH OBJECT |
Category: | Object functions , xHarbour extensions |
Source: | vm\hvm.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example shows how to change the current "with" object // without changing the nesting level of WITH OBJECT PROCEDURE Main() LOCAL oSavedWith WITH OBJECT ErrorNew() ? :className() // result: ERROR ? HB_WithObjectCounter() // result: 1 oSavedWith := HB_QWith() HB_ResetWith( GetNew() ) ? :className() // result: GET ? HB_WithObjectCounter() // result: 1 HB_ResetWith( oSavedWith ) ? :className() // result: ERROR ? HB_WithObjectCounter() // result: 1 END RETURN
http://www.xHarbour.com