ClassesClassesClassesClasses | | | | Operators

set_drawing_object_callbackset_drawing_object_callbackSetDrawingObjectCallbackset_drawing_object_callbackSetDrawingObjectCallbackSetDrawingObjectCallback (Operator)

Name

set_drawing_object_callbackset_drawing_object_callbackSetDrawingObjectCallbackset_drawing_object_callbackSetDrawingObjectCallbackSetDrawingObjectCallback — Add a callback function to a drawing object.

Signature

set_drawing_object_callback( : : DrawID, DrawObjectEvent, CallbackFunction : )

Herror set_drawing_object_callback(const Hlong DrawID, const char* DrawObjectEvent, const Hlong CallbackFunction)

Herror T_set_drawing_object_callback(const Htuple DrawID, const Htuple DrawObjectEvent, const Htuple CallbackFunction)

Herror set_drawing_object_callback(const HTuple& DrawID, const HTuple& DrawObjectEvent, const HTuple& CallbackFunction)

void HDrawingObject::SetDrawingObjectCallback(const HTuple& DrawObjectEvent, const HTuple& CallbackFunction) const

void SetDrawingObjectCallback(const HTuple& DrawID, const HTuple& DrawObjectEvent, const HTuple& CallbackFunction)

void HDrawingObject::SetDrawingObjectCallback(const HTuple& DrawObjectEvent, const HTuple& CallbackFunction) const

void HDrawingObject::SetDrawingObjectCallback(const HString& DrawObjectEvent, void* CallbackFunction) const

void HDrawingObject::SetDrawingObjectCallback(const char* DrawObjectEvent, void* CallbackFunction) const

void HOperatorSetX.SetDrawingObjectCallback(
[in] VARIANT DrawID, [in] VARIANT DrawObjectEvent, [in] VARIANT CallbackFunction)

void HDrawingObjectX.SetDrawingObjectCallback(
[in] VARIANT DrawObjectEvent, [in] VARIANT CallbackFunction)

static void HOperatorSet.SetDrawingObjectCallback(HTuple drawID, HTuple drawObjectEvent, HTuple callbackFunction)

void HDrawingObject.SetDrawingObjectCallback(HTuple drawObjectEvent, HTuple callbackFunction)

void HDrawingObject.SetDrawingObjectCallback(string drawObjectEvent, IntPtr callbackFunction)

Description

set_drawing_object_callbackset_drawing_object_callbackSetDrawingObjectCallbackset_drawing_object_callbackSetDrawingObjectCallbackSetDrawingObjectCallback adds the callback function CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction to be called on the event(s) defined in DrawObjectEventDrawObjectEventDrawObjectEventDrawObjectEventDrawObjectEventdrawObjectEvent to the drawing object DrawIDDrawIDDrawIDDrawIDDrawIDdrawID. An event is an action, i.e., a user interaction with the mouse or a call to a HALCON operator, e.g., attach_drawing_object_to_windowattach_drawing_object_to_windowAttachDrawingObjectToWindowattach_drawing_object_to_windowAttachDrawingObjectToWindowAttachDrawingObjectToWindow), that changes the current state of a given drawing object. The operator set_drawing_object_callbackset_drawing_object_callbackSetDrawingObjectCallbackset_drawing_object_callbackSetDrawingObjectCallbackSetDrawingObjectCallback allows to define how to react to those events.

The following predefined events are available:

'on_attach'"on_attach""on_attach""on_attach""on_attach""on_attach"

The corresponding callback will be called right after the object has been attached to the HALCON window and is ready for interaction.

'on_detach'"on_detach""on_detach""on_detach""on_detach""on_detach"

The corresponding callback will be called right after the object has been detached from the window and is no longer available for interaction.

'on_drag'"on_drag""on_drag""on_drag""on_drag""on_drag"

The corresponding callback will be called right after the object has been dragged with mouse interaction.

'on_resize'"on_resize""on_resize""on_resize""on_resize""on_resize"

The corresponding callback will be called right after the object has been resized with mouse interaction.

'on_select'"on_select""on_select""on_select""on_select""on_select"

The corresponding callback will be called right after the object has been selected with mouse interaction.

It is possible to specify a particular callback for each desired event. Then the input parameters DrawObjectEventDrawObjectEventDrawObjectEventDrawObjectEventDrawObjectEventdrawObjectEvent and CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction must have the same length. It is also possible to use the same callback for different events. Then DrawObjectEventDrawObjectEventDrawObjectEventDrawObjectEventDrawObjectEventdrawObjectEvent has an arbitrary length and CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction contains one single value.

The callback is an integer of long type containing a pointer to a C function with the following signature:

Herror HDrawObjCallback(long DrawID, long WindowHandle, char *type)

On Windows systems, the __stdcall naming convention is used:

Herror (__stdcall HDrawObjCallback)(long DrawID, long WindowHandle, char* type)

The first parameter of the callback function contains the handle to the draw object that generated the event, the second one contains the handle of the window where the interaction took place. Finally, the third parameter indicates which event occurred.

Attention

No graphical operator should be called within the callback, like for example disp_objdisp_objDispObjdisp_objDispObjDispObj, for otherwise a deadlock may occur.

Parallelization

Parameters

DrawIDDrawIDDrawIDDrawIDDrawIDdrawID (input_control)  drawing_object HDrawingObject, HTupleHTupleHDrawingObject, HTupleHDrawingObjectX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Handle of the drawing object.

DrawObjectEventDrawObjectEventDrawObjectEventDrawObjectEventDrawObjectEventdrawObjectEvent (input_control)  string(-array) HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Events to be captured.

Suggested values: 'on_resize'"on_resize""on_resize""on_resize""on_resize""on_resize", 'on_drag'"on_drag""on_drag""on_drag""on_drag""on_drag", 'on_attach'"on_attach""on_attach""on_attach""on_attach""on_attach", 'on_detach'"on_detach""on_detach""on_detach""on_detach""on_detach", 'on_select'"on_select""on_select""on_select""on_select""on_select"

CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction (input_control)  pointer(-array) HTupleHTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Callback functions.

Result

set_drawing_object_callbackset_drawing_object_callbackSetDrawingObjectCallbackset_drawing_object_callbackSetDrawingObjectCallbackSetDrawingObjectCallback returns 2 (H_MSG_TRUE), if DrawIDDrawIDDrawIDDrawIDDrawIDdrawID is valid. Otherwise an exception is raised.

Possible Predecessors

attach_drawing_object_to_windowattach_drawing_object_to_windowAttachDrawingObjectToWindowattach_drawing_object_to_windowAttachDrawingObjectToWindowAttachDrawingObjectToWindow

Possible Successors

close_windowclose_windowCloseWindowclose_windowCloseWindowCloseWindow, clear_drawing_objectclear_drawing_objectClearDrawingObjectclear_drawing_objectClearDrawingObjectClearDrawingObject, detach_drawing_object_from_windowdetach_drawing_object_from_windowDetachDrawingObjectFromWindowdetach_drawing_object_from_windowDetachDrawingObjectFromWindowDetachDrawingObjectFromWindow, get_drawing_object_iconicget_drawing_object_iconicGetDrawingObjectIconicget_drawing_object_iconicGetDrawingObjectIconicGetDrawingObjectIconic, get_drawing_object_paramsget_drawing_object_paramsGetDrawingObjectParamsget_drawing_object_paramsGetDrawingObjectParamsGetDrawingObjectParams

See also

create_drawing_object_rectangle1create_drawing_object_rectangle1CreateDrawingObjectRectangle1create_drawing_object_rectangle1CreateDrawingObjectRectangle1CreateDrawingObjectRectangle1, attach_drawing_object_to_windowattach_drawing_object_to_windowAttachDrawingObjectToWindowattach_drawing_object_to_windowAttachDrawingObjectToWindowAttachDrawingObjectToWindow, detach_drawing_object_from_windowdetach_drawing_object_from_windowDetachDrawingObjectFromWindowdetach_drawing_object_from_windowDetachDrawingObjectFromWindowDetachDrawingObjectFromWindow

Module

Foundation


ClassesClassesClassesClasses | | | | Operators