set_content_update_callbackT_set_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback (算子)
名称
set_content_update_callbackT_set_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback — 设置缓冲窗口中内容更新的回调。
签名
描述
set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback sets a callback CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function,
which is called whenever the contents of the buffer window
WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle change.
The parameter CallbackContextCallbackContextCallbackContextCallbackContextcallbackContextcallback_context is always passed to the
callback.
The type of CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_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_eventSendMouseDownEventSendMouseDownEventSendMouseDownEventsend_mouse_down_event,
send_mouse_up_eventsend_mouse_up_eventSendMouseUpEventSendMouseUpEventSendMouseUpEventsend_mouse_up_event, and send_mouse_double_click_eventsend_mouse_double_click_eventSendMouseDoubleClickEventSendMouseDoubleClickEventSendMouseDoubleClickEventsend_mouse_double_click_event,
set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackSetContentUpdateCallbackset_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 CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function.
The control then can obtain the contents of the buffer with
dump_window_imagedump_window_imageDumpWindowImageDumpWindowImageDumpWindowImagedump_window_image and display them.
注意
set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback 依赖于 libcanvas 库,该库在嵌入式系统上可能不可用。
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (输入控制) window → HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
窗口句柄。
CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunctioncallback_function (输入控制) pointer → HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)
Callback for content updates.
CallbackContextCallbackContextCallbackContextCallbackContextcallbackContextcallback_context (输入控制) pointer → HTupleUnion[int, HHandle]HTupleHtuple (integer / handle) (IntPtr / IntPtr) (Hlong / HHandle) (Hlong / handle)
Parameter to CallbackFunction.
结果
If the window exists and is a buffer window,
set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackSetContentUpdateCallbackset_content_update_callback 返回 2 ( H_MSG_TRUE )。
另见
flush_bufferflush_bufferFlushBufferFlushBufferFlushBufferflush_buffer
模块
基础