set_content_update_callbackT_set_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallback (Operator)

Name

set_content_update_callbackT_set_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallback — Setzen einer Callback-Funktion bei Aktualisierung des Pufferinhalts.

Signatur

set_content_update_callback( : : WindowHandle, CallbackFunction, CallbackContext : )

Herror T_set_content_update_callback(const Htuple WindowHandle, const Htuple CallbackFunction, const Htuple CallbackContext)

void SetContentUpdateCallback(const HTuple& WindowHandle, const HTuple& CallbackFunction, const HTuple& CallbackContext)

void HWindow::SetContentUpdateCallback(void* CallbackFunction, const HTuple& CallbackContext) const

void HWindow::SetContentUpdateCallback(void* CallbackFunction, void* CallbackContext) const

static void HOperatorSet.SetContentUpdateCallback(HTuple windowHandle, HTuple callbackFunction, HTuple callbackContext)

void HWindow.SetContentUpdateCallback(IntPtr callbackFunction, HTuple callbackContext)

void HWindow.SetContentUpdateCallback(IntPtr callbackFunction, IntPtr callbackContext)

Beschreibung

set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackSetContentUpdateCallback setzt die Callback-Funktion CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction, die immer dann aufgerufen wird, wenn sich der Inhalt des Pufferfensters WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle ändert. Der Parameter CallbackContextCallbackContextCallbackContextCallbackContextcallbackContext wird dabei immer an die Callback-Funktion übergeben.

Der Typ der Callback-Funktion CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction ist: Herror callback(void *context)

Auf Windows Systemen wird die __stdcall calling convention verwendet: Herror __stdcall callback(void *context)

Die Callback-Funktion darf keinen HALCON Operator aufrufen. Dies ist undefiniertes Verhalten. Es wird empfohlen, nur wenig rechenintensive Aufgaben in der Callback-Funktion durchzuführen, z.B. das Setzen eines Flags oder das Anstoßen einer asynchronen Operation.

In Verbindung mit den Operatoren send_mouse_down_eventsend_mouse_down_eventSendMouseDownEventSendMouseDownEventSendMouseDownEvent, send_mouse_up_eventsend_mouse_up_eventSendMouseUpEventSendMouseUpEventSendMouseUpEvent und send_mouse_double_click_eventsend_mouse_double_click_eventSendMouseDoubleClickEventSendMouseDoubleClickEventSendMouseDoubleClickEvent kann set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackSetContentUpdateCallback verwendet werden, um ein Fenster-Control für ein GUI Toolkit wie Qt zu erstellen. Das Controll leitet Mausevents an den Puffer weiter, welcher das Control bei Änderungen des Fensterinhalts benachrichtigt, indem er CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction aufruft. Das Control kann dann den Inhalt das Puffers mit dump_window_imagedump_window_imageDumpWindowImageDumpWindowImageDumpWindowImage kopieren und schließlich anzeigen.

Achtung

set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackSetContentUpdateCallback benötigt die Bibliothek libcanvas, die auf Embedded-Systemen möglicherweise nicht verfügbar ist.

Ausführungsinformationen

Parameter

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (input_control)  window HWindow, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Fenster-Handle.

CallbackFunctionCallbackFunctionCallbackFunctionCallbackFunctioncallbackFunction (input_control)  pointer HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Callback Funktion bei Aktualisierung des Pufferinhalts.

CallbackContextCallbackContextCallbackContextCallbackContextcallbackContext (input_control)  pointer HTupleHTupleHtuple (integer / handle) (IntPtr / IntPtr) (Hlong / HHandle) (Hlong / handle)

Parameter für CallbackFunction.

Ergebnis

set_content_update_callbackset_content_update_callbackSetContentUpdateCallbackSetContentUpdateCallbackSetContentUpdateCallback liefert den Wert 2 (H_MSG_TRUE), falls das Fenster gültig ist. Ansonsten wird eine Fehlerbehandlung durchgeführt.

Siehe auch

flush_bufferflush_bufferFlushBufferFlushBufferFlushBuffer

Modul

Foundation