%DOTNET_TKWIN

Create a container window and embed a form, control, or element

WTSupported in traditional Synergy on Windows

 

 

 

window_id = %DOTNET_TKWIN(name, height, width, object[, flags])

Return value

window_id

On Windows, the Toolkit container window ID. On UNIX and OpenVMS, returns 0. (^VAL)

Arguments

name

The name of the Toolkit container window to create. This can be up to 15 characters. If you specify a null string (“”), Toolkit assigns a unique window name in the form _W_nnn, where nnn is the window ID. (a)

height

The height of the window in character rows. If you pass either height or width as 0, Toolkit sets the window to the height and width of the application screen. (n)

width

The width of the window in character columns. If you pass either height or width as 0, Toolkit sets the window to the height and width of the application screen. (n)

object

The .NET form, .NET control, or WPF element to embed. This must be derived from System.Windows.Forms.Form, System.Windows.Forms.Control, or System.Windows.UIElement and wrapped in a Synergy class (i.e., as a DotNetObject) by gennet40. (@DotNetObject)

flags

(optional) Pass DN_MAKEFORM to instruct %DOTNET_TKWIN to create a .NET form for a .NET control (object must be a .NET form or control or null). Pass DN_WPF to instruct %DOTNET_TKWIN to create a .NET form for a WPF element (object must be a WPF element or null). Although you can combine these bit flags with .BOR. or the vertical bar (|) operator (for a WPF element), this is not necessary because DN_WPF includes DN_MAKEFORM. (n)

Discussion

%DOTNET_TKWIN enables you to embed a .NET form, .NET control, or WPF element in a Toolkit application. To do this, it creates a Toolkit container window and, optionally, it creates a .NET form to contain the form, control, or element passed as object. (On UNIX and OpenVMS, this function returns zero, but otherwise does nothing.)

Before you pass a .NET form, .NET control, or WPF element as object, you must wrap it in a Synergy class using gennet40. (See Embedding a .NET form.) Otherwise Toolkit throws an exception.

If you pass DN_MAKEFORM or DN_WPF, this function creates a Toolkit container window with an embedded .NET form. If object is null, the .NET form will be empty. If object is non‑null, Toolkit embeds object as a control in the Toolkit‑created .NET form (even if object is a .NET form). Object is added to the Controls collection for the Toolkit‑created form. Object is sized and positioned to fill the form; you can subsequently resize and move object by modifying the Toolkit‑created form.

If you don’t pass flags (or if you pass it as a value other than DN_MAKEFORM or DN_WPF) and object is null, this function creates a Toolkit container window with an embedded .NET form. If object is non‑null, it creates a Toolkit container window, but it doesn’t create a .NET form. Instead, Toolkit embeds object (which must be a .NET form) in the container window.

%DOTNET_TKWIN creates a container window by calling W_PROC. and passing name, rows, and cols. If W_PROC generates an error, you can trap it. Note that the container window is logged with Toolkit at the current environment level. You can use U_GBLWND to promote it to global.

When a user clicks on an embedded .NET form, that event does not automatically trigger a call to any UWNDEVENTS_METHOD associated with the Toolkit container window. To trigger Windows event processing, the .NET form must fire an event of its own.

Examples

See the DOTNET_TKADDCTL Examples.