Table Of Contents

Register Event Callback (G Dataflow)

Version:
    Last Modified: November 4, 2020

    Registers a VI to be called when an event occurs. Use this function to register and handle .NET events. The type of input reference wired to each item determines the events you can register for.

    Resize the node to register multiple event callbacks for one or more .NET objects.

    spd-note-note
    Note  

    If you wire the callback reference out of one Register Event Callback node to the event callback reference of another, the last node in the series overwrites all previous Register Event Callback nodes.

    Programming Patterns

    Registering and Handling .NET Events

    connector_pane_image
    datatype_icon

    event callback reference

    Refnum that accepts a reference to an existing event callback registration.

    Default: None

    datatype_icon

    error in

    Error conditions that occur before this node runs.

    The node responds to this input according to standard error behavior.

    Standard Error Behavior

    Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

    error in does not contain an error error in contains an error
    If no error occurred before the node runs, the node begins execution normally.

    If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

    If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

    Default: No error

    datatype_icon

    VI reference

    Refnum to the callback VI. The VI must be strictly typed, must match exactly the data from the registered event, and the callback VI must be reentrant.

    Default: None

    datatype_icon

    user parameter

    Variant that contains data that you want to pass to the callback VI when the .NET object generates the event. For example, you can wire a string that includes a text message to the user parameter input to tell a user for which control the event occurred. If you want to use this parameter, you must wire it before you create the callback VI. You can wire any LabVIEW data type, including a cluster, to this parameter.

    Default: None

    datatype_icon

    event callback reference out

    Refnum that returns a reference to a new or existing event callback registration.

    Default: None

    datatype_icon

    error out

    Error information.

    The node produces this output according to standard error behavior.

    Standard Error Behavior

    Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

    error in does not contain an error error in contains an error
    If no error occurred before the node runs, the node begins execution normally.

    If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

    If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

    Avoiding Memory Leaks

    Until you unregister for events, LabVIEW NXG continues to generate and queue the events as long as the VI runs, even if no Event Structure is waiting to handle them. This behavior consumes memory and can hang the VI if you enable front panel locking for the events. To avoid this, unregister for events when you no longer need to handle them using the Unregister For Events node.

    Search within the programming environment to access the Passing Data to a .NET Event Callback example.

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: Not supported

    Web Server: Not supported in VIs that run in a web application


    Recently Viewed Topics