Purpose With Control you can embed an ActiveX control into a SAP GUI window. 
 
Example Control (10.5,40.2) (20.5,80) progid="Comctl.ListViewCtrl" name="cid"

The  "List View Control", contained in the "Microsoft Common Controls", is embedded into the screen. If the GuiXT script variable V[cid] contains a valid reference to a List View Control, this control is shown. Otherwise a new ActiveX object of class "list view" is created and the reference to the new object is stored in V[cid].
 

Format Control (row1,column1) (row2,coloumn2) progid="ProgId"  name="vname"

With (row1,column1) (row2,coloumn2) you specify the upper left hand and lower right hand corner; you may use decimal numbers as coordinates.

For the progid= parameter the following formats are supported:

  • Specification of the "ProgID" of the ActiveX component. Examples:

    progid="Comctl.ListViewCtrl"    List View Control of the Microsoft Common Controls
    progid="Comctl.TreeCtrl"          Tree View Control of the Microsoft Common Controls
    progid="Shell.Explorer"              Internet Explorer Control
    progid="myclass.control1"        A self-implemented ActiveX component, for example implemented in VB.NET
     

  • Specification of the class identification CLSID. Example:

    progid="{CA8A9780-280D-11CF-A24D-444553540000}"
     

  • Specification of a URL. In this case the Internet Explorer Control is opened with the given URL. Examples:

    progid="http://www.google.en"
    progid="file://c:/demo/d1.html
    progid="file://SAPMR:...
    progid="file://SAWMR:..."
     

  • Direct specification of HTML coding using the notation "MSHTML:...". In this case the Internet Explorer control is opened with the given HTML code. Example:

    progid="MSHTML:<div style='color:#202020;'>Hello</div>"

For communication with the control you can call VB.NET, JavaScript or VBScript functions; please see CallVB CallJS and CallVBS for details.

The name= parameter specifies a GuiXT variable that receives the object handle after creating the control. You can pass the variable to VB.NET, JavaScript or VBScript functions in order to access object properties and call up its methods.

In order to handle the control events you can use the SetEventHandler() function of the "guixt" object in JavaScript / VBScript; see Object "guixt" in VBScript.

After a Control command you can use if Q[ok] to query whether the control has been created.

For HTML pages displayed with the Control statement you may use connectHTML  in order to read and write attributes in the HTML page.  Our Tips, Tricks and Samples contain examples for the communication between the HTML page and GuiXT.
 

Additional options
-floating A new window is opened for display. It can be resized and moved about independently of the SAP GUI screen.
-maximize The window is maximized. Often used in conjunction with -floating.
-topmost Used in conjunction with -floating: the window is shown on top of all other windows
-scrollbars Adds scrollbars. In many cases the control already brings its own scrollbars so that you do not need this option.
-closeonhide The control is closed when it is no longer visible.
-silent Only relevant in the Web Browser Control: All user dialogs are suppressed, for example script errors of the HTML page to be displayed, but also other dialogs.
title= Used in conjunction with -floating: window title
initflag= Name of a GuiXT variable. The variable is set to "X" by GuiXT if the control has been newly created, otherwise it is set to "". You can query the variable after Control in order to call an initialization function in VB.NET, JavaScript or VBScript.
 
properties= A string with property names and values to be set as control initialization.
The format is "propertyname1:value1;propertyname2:value2;..." The property names are case sensitive.

This option is possible for ActiveX controls that support the "IPersistPropertyBag" interface.

Example:

Control (2,0) (20,72) name="rtf" progid="RICHTEXT.RichtextCtrl" properties="ScrollBars:3"

loadFromFile= A file name that contains the control state.

This option is possible for ActiveX controls that support the "IPersistStreamInit" interface.

You may omit progid= parameter when you specify loadFromFile=.

The file starts with the CLSID of the control, followed by its state in the control specific "IPersistStreamInit" format.

Example:

Control (2,0) (20,72) name="rtf" loadFromFile="rtfdefaults.tsm"

You may save the control state with the SaveControl command.

Another way to create an initialization file is to install Microsoft's "ActiveX Control Test Container" TSTCON.EXE, to set the control parameters and then to apply the menu option "Control -> Save to stream" in order to create an initialization file.

Tips
& Tricks
  • The GuiXT script editor function "Tools->Display ActiveX controls" lists all ActiveX controls installed on this PC.
  • Attributes and methods of an ActiveX component are shown in Visual Studio or in VBScript editors such as "VbsEdit".
Components GuiXT + Controls