Control

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

The ADOBE PDF reader is embedded into the screen. If the GuiXT script variable V[cid] contains a valid reference to a PDF reader, this control is shown. Otherwise a new ActiveX object of class "AcroPDF.PDF" is created and the reference to the new object is stored in V[cid].
 

Format Control (row1,column1) (row2,colomn2) progID="ProgId"  name="vname"

With (row1,column1) (row2,colomn2) 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="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:..."
     

    Note: For displaying web pages, the WebView instruction is usually preferable because it supports current HTML technologies, while the Internet Explorer control has some limitations.

  • 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:

    Hello
    "

  • Specification of a PDF file. Example:

    progID="https://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf"

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 ConectHTML  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.
-invisible The control is created but is not 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:

GuiXT

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.

returnWindow= Name of a variable that revceives the internal window handle of the created control window
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