Use the CodeBehind tab to define a set of functions connected with a display. You can write code in either standard VB.Net or CSharp. You can also switch between the two. If you change your language selection, the system automatically converts existing code to the selected language.

If you need references to your own assemblies, use Run > Build > References.

CodeBehind functions can be executed when opening or closing, or while the display is open, depending on how you configure the code. You can use CodeBehind to define mouse and input command handling methods to be executed on a specific display.

For Dialog displays, use the built-in DialogOnOK method, which is called when the built-in OK button on the dialog is pressed. If "True" is returned on that method, the dialog is closed; if "False" is returned, the dialog remains open. This method is commonly used to ensure data validation on the dialog (which prompts the user to correct incorrect entries before closing the dialog).

The Code Behind of the Displays has the following pre-defined methods:

  • DisplayOpening()Executed when display is opening.
  • DisplayIsOpen()Called in a regular intervals while the display is open.
  • DisplayClosing()Executed when display is closing.
  • DialogOnOK()Called when the OK button on a Dialog display is pressed. Returning 1 allows the dialog to close.Returning 0 prevents the dialog from closing.

You can add your own .NET variables and methods to this page. 

Because the client displays are designed to run on distributed and web environments, we recommend avoiding the use of functions that do not allow partial trust execution or that refer to physical file paths.

Once the CodeBehind runs into the client side, while the code is running the display will be locked. So, to avoid locked displays for too long, if the code has too many procedures, choose Scripts (tasks and classes).

In this section...

  • No labels