ClassesClassesClassesClasses | | | | Operators

set_spyset_spySetSpyset_spySetSpySetSpy (Operator)


set_spyset_spySetSpyset_spySetSpySetSpy — Control of the HALCON Debugging Tools.


set_spy( : : Class, Value : )

Herror set_spy(const char* Class, const char* Value)

Herror T_set_spy(const Htuple Class, const Htuple Value)

Herror set_spy(const HTuple& Class, const HTuple& Value)

void SetSpy(const HTuple& Class, const HTuple& Value)

static void HSystem::SetSpy(const HString& Class, const HTuple& Value)

static void HSystem::SetSpy(const HString& Class, const HString& Value)

static void HSystem::SetSpy(const char* Class, const char* Value)

void HOperatorSetX.SetSpy(
[in] VARIANT Class, [in] VARIANT Value)

void HSystemX.SetSpy(
[in] BSTR Class, [in] VARIANT Value)

static void HOperatorSet.SetSpy(HTuple classVal, HTuple value)

static void HSystem.SetSpy(string classVal, HTuple value)

static void HSystem.SetSpy(string classVal, string value)


The operator set_spyset_spySetSpyset_spySetSpySetSpy is the HALCON debugging tool. This tool allows the flexible control of the input and output data of HALCON-operators - in graphical as well as in textual form. The datacontrol is activated by using


and deactivated by using


The debugging tool can further be activated with the help of the environment variable HALCONSPY. The definition of this variable corresponds to calling up 'mode'"mode""mode""mode""mode""mode" and 'on'"on""on""on""on""on".

The following control modes can be tuned (in any desired combination of course) with the help of ClassClassClassClassClassclassVal/ValueValueValueValueValuevalue:

Class Meaning / Value


When a routine is called, its name and the names of its parameters will be given (in TRIAS notation).

Value: 'on' or 'off'

default: 'off'


When a routine is called, the names and values of the input control parameters will be given.

Value: 'on' or 'off'

default: 'off'


When a routine is called, the names and values of the output control parameters are given.

Value: 'on' or 'off'

default: 'off'


Additional information on 'input_control' and 'output_control': indicates how many values per parameter shall be displayed at most (maximum tuplet length of the output).

Value: tuplet length (integer)

default: 4


Information concerning the 4 relations in the HALCON-database. This is especially valuable in looking for forgotten clear_objclear_objClearObjclear_objClearObjClearObj.

Value: 'on' or 'off'

default: 'off'


Any reading access of the gray-value component of an (input) image object will cause the gray-value component to be shown in the indicated window (Window-ID; 'none' will deactivate this control ).

Value: Window-ID (integer) or 'none'

default: 'none'


Any reading access of the region of an (input) iconic object will cause this region to be shown in the indicated (Window-ID; 'none' will deactivate this control ).

Value: Window-ID (integer) or 'none'

default: 'none'


Any reading access of the xld will cause this xld to be shown in the indicated (Window-ID; 'none' will deactivate this control ).

Value: Window-ID (integer) or 'none'

default: 'none'


Processing time of the operator

Value: 'on' or 'off'

default: 'off'


Determines whether there is a halt after every individual action ('multiple') or only at the end of each operator ('single'). The parameter is only effective if the halt has been activated by 'timeout' or 'button_window'.

Value: 'single' or 'multiple'

default: 'multiple'


After every output there will be a halt of the indicated number of seconds.

Value: seconds (real)

default 0.0


Alternative to 'timeout': after every output spy waits until the cursor indicates ('button_click' = 'off') or clicks into ('button_click' = 'on') the indicated window. (Window-ID; 'none' will deactivate this control ).

Value: Window-ID (integer) or 'none'

default: 'none'


Additional option for 'button_window': determines whether or not a mouse-click has to be waited for after an output.

Value: 'on' or 'off'

default: 'off'


If 'button_notify' is activated, spy generates a beep after every output. This is useful in combination with 'button_window'.

Value: 'on' or 'off'

default: 'off'


Spy can hereby divert the text output into a file having been opened with open_file.

Value: a file handle (see open_fileopen_fileOpenFileopen_fileOpenFileOpenFile)


If 'error' is activated and an internal error occurs, spy will show the internal procedures (file/line) concerned.

Value: 'on' or 'off'

default: 'off'


If 'internal' is activated, spy will display the internal procedures and their parameters (file/line) while an HALCON-operator is processed.

Value: 'on' or 'off'

default: 'off'


HALCON Spy cannot be used to debug multithreaded programs or programs using the automatic parallelization.

Note that under Windows HALCON Spy does only work in combination with a console application, i.e., you can not use it together with HDevelop.



ClassClassClassClassClassclassVal (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Control mode

Default value: 'mode' "mode" "mode" "mode" "mode" "mode"

List of values: 'button_click'"button_click""button_click""button_click""button_click""button_click", 'button_notify'"button_notify""button_notify""button_notify""button_notify""button_notify", 'button_window'"button_window""button_window""button_window""button_window""button_window", 'db'"db""db""db""db""db", 'error'"error""error""error""error""error", 'halt'"halt""halt""halt""halt""halt", 'input_control'"input_control""input_control""input_control""input_control""input_control", 'input_gray_window'"input_gray_window""input_gray_window""input_gray_window""input_gray_window""input_gray_window", 'input_region_window'"input_region_window""input_region_window""input_region_window""input_region_window""input_region_window", 'input_region_window'"input_region_window""input_region_window""input_region_window""input_region_window""input_region_window", 'input_xld_window'"input_xld_window""input_xld_window""input_xld_window""input_xld_window""input_xld_window", 'internal'"internal""internal""internal""internal""internal", 'log_file'"log_file""log_file""log_file""log_file""log_file", 'mode'"mode""mode""mode""mode""mode", 'operator'"operator""operator""operator""operator""operator", 'output_control'"output_control""output_control""output_control""output_control""output_control", 'parameter_values'"parameter_values""parameter_values""parameter_values""parameter_values""parameter_values", 'time'"time""time""time""time""time", 'timeout'"timeout""timeout""timeout""timeout""timeout"

ValueValueValueValueValuevalue (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double) (BSTR / Hlong / double) (char* / Hlong / double)

State of the control mode to be set.

Default value: 'on' "on" "on" "on" "on" "on"

Suggested values: 'on'"on""on""on""on""on", 'off'"off""off""off""off""off", 1, 2, 3, 4, 5, 10, 50, 0.0, 1.0, 2.0, 5.0, 10.0

Example (C)

/* init spy: Setting of the wished control modi */
/* calling of program section, that will be examined */


The operator set_spyset_spySetSpyset_spySetSpySetSpy returns the value 2 (H_MSG_TRUE) if the parameters are correct. Otherwise an exception is raised.

Possible Predecessors


See also

get_spyget_spyGetSpyget_spyGetSpyGetSpy, query_spyquery_spyQuerySpyquery_spyQuerySpyQuerySpy



ClassesClassesClassesClasses | | | | Operators