set_content_update_callbackT_set_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback (Operator)
Name
set_content_update_callbackT_set_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback
— Sets the callback for content updates in buffer window.
Signature
Description
set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback
sets a callback CallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function
,
which is called whenever the contents of the buffer window
WindowHandleWindowHandleWindowHandlewindowHandlewindow_handle
change.
The parameter CallbackContextCallbackContextCallbackContextcallbackContextcallback_context
is always passed to the
callback.
The type of CallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function
is: Herror callback(void *context)
On Windows systems, the __stdcall calling convention is used:
Herror __stdcall callback(void *context)
The callback function must not call a HALCON operator. Doing so is
undefined behavior. It is advised to perform only computationally
inexpensive tasks in the callback, e.g., setting a flag or triggering an
asynchronous operation.
In combination with the operators send_mouse_down_eventsend_mouse_down_eventSendMouseDownEventSendMouseDownEventsend_mouse_down_event
,
send_mouse_up_eventsend_mouse_up_eventSendMouseUpEventSendMouseUpEventsend_mouse_up_event
, and send_mouse_double_click_eventsend_mouse_double_click_eventSendMouseDoubleClickEventSendMouseDoubleClickEventsend_mouse_double_click_event
,
set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback
can be used to create a buffer based
control for a GUI Toolkit (such as Qt), where the control passes mouse
events to the buffer, while the buffer notifies the control on changes by
calling the function CallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function
.
The control then can obtain the contents of the buffer with
dump_window_imagedump_window_imageDumpWindowImageDumpWindowImagedump_window_image
and display them.
Attention
set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback
depends on the library libcanvas, which
might not be available on embedded systems.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
WindowHandleWindowHandleWindowHandlewindowHandlewindow_handle
(input_control) window →
HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Window handle.
CallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function
(input_control) pointer →
HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)
Callback for content updates.
CallbackContextCallbackContextCallbackContextcallbackContextcallback_context
(input_control) pointer →
HTupleUnion[int, HHandle]HTupleHtuple (integer / handle) (IntPtr / IntPtr) (Hlong / HHandle) (Hlong / handle)
Parameter to CallbackFunction.
Result
If the window exists and is a buffer window,
set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback
returns 2 (
H_MSG_TRUE)
.
See also
flush_bufferflush_bufferFlushBufferFlushBufferflush_buffer
Module
Foundation