Skip to content. | Skip to navigation

Personal tools
You are here: Home Accelerate Articles How to include an ActiveX control within an SB+ input screen

How to Include an ActiveX Control Within an SB+ Input Screen

ActiveX technology provides a rich set of self-contained controls that can enhance the U2 SB+ user experience. This article takes you through two examples. In the first example, you see how to include a calendar control within an input screen. In the second example, see how to include an HTML object within an input screen.

Level: Intermediate

Kevin Drury (, SB+ Developer, Rocket Software
Pavel Smelianski (, SBClient Expert, Rocket Software

14 Jun 2007


Rocket U2 SB+ for UniData® and UniVerse® (SB+), is a cross-platform, complete, and powerful rapid application development and deployment environment that enables developers to focus on what they know best: their application, their business, and their users. SB+ lets you quickly design U2 data server structures and develop applications using a comprehensive developer interface.


These examples are designed to be implemented by running SBClient Version 5.4 or later in an SBDEMO account in GUI on SB+ Release 5.4 or later using UniData 6.1 or later on a UNIX® or Windows® OS or UniVerse 10.1 (Pick compatibility) or later on a UNIX or Windows OS.

Both of these examples use ActiveX controls, that are provided to you for free, that you should already have on your PC. The first example uses MSCAL.Calendar, which is shipped with SBClient. The second example uses Shell.Explorer, which is part of the Windows OS.

The first example is based on an ActiveX control in a screen that has been in SBDEMO for a number of years. You will see how to apply this example within a new screen in SBDEMO to help you utilize this idea within your application.

The second example shows how you can present data within an HTML object. Since this is HTML, you can make use of all the HMTL formatting and presentation capabilities. It also demonstrates how to embed a hypertext link within the HTML that is generated. Many developers may already be familiar with the concept of creating a new window to display HTML using the HTML,<url> style process, but this example displays the HTML within a field in a screen rather than in a new window.


Example 1: How to include an ActiveX control within an input screen

Register your ActiveX control as SB.MSCAL. Invoke the user classes registration (UCR) process, then complete the screen, as shown in Figure 1. The attributes for this control are:

  • ShowTitle
    0 will not show a title when you display the control
    1 will show a title of the month and year when you display the control
  • DayLength
    0 will show the first letter of the days of the week
    1 will show the first three letters of the days of the week


You then create a new file, MYFILE, using the File Create (FC) process in which we will create a screen that will access this new control.

In this file, we create the following fields using the Field Definition (FD) process:

You then create a screen using the Screen Definition (SD) process that contains these fields, called MY.SCREEN. Note that the coordinates and dimensions for the field ENTRY.DATE are used as the coordinates and the dimensions for the ActiveX control that you use in this screen:

You then create a paragraph using the Paragraph Definition process (PD.P) called XDATE that creates the ActiveX SB.MSCAL object based on the dimensions and the coordinates of the field ENTRY.DATE:

   DISP 4,'In Paragraph, Event = ':@PARAM

The paragraph XDATE is then called from the Process Before Screen Display field within the GUI Parameters screen for the Input Process definition that you will create to call the input screen:

When you invoke the screen, you can see the ActiveX control displayed in the container that you specified for ENTRY.DATE.

The control is set to today's date when the input screen is empty, and is then set to the value that has been stored in ENTRY.DATE when the record is read and then displayed in this input screen. The user is able to select a date by selecting a month and a year from the drop-down boxes, and can then select a day within that month using the mouse.

Example 2: How to display an HTML object within an SB+ screen

The objective of this example is to demonstrate how to display HTML in a field within an SB+ screen. The first thing that you need to do is to register the ActiveX that you are going to use.

Then, define the paragraph using the (PD.P) that will be used to handle events for this object, which in this example is called BROWSER.EVENT.HANDLER:

EVENTSTR = @PARAM                                                               
* Find the position of the string that marks the beginning of the Process Name in the 
* passed parameter
PROCESS.NAME.POS = INDEX(EVENTSTR<3,2>,"#$",1)                                  
* Find the position of the string that marks the beginning of the Data in the 
* passed parameter
KEY.POS = INDEX(EVENTSTR<3,2>,"%20",1)                                          
*Extract the name of the process
*Extract the key to be passed to the process
L.DATA = EVENTSTR<3,2>[KEY.POS+3,(LEN(EVENTSTR<3,2>)-KEY.POS-3)]                
DATA L.DATA                                                                     

Then, define a paragraph using the (PD.P), to create and populate the HTML field, which in this example is called XBROWSER:

LOCAL HANDLE, FBG, SET.VAL, L.REC                                               
IF NOT(@GUI) THEN EXIT                                                          
BEGIN CASE                                                                      
CASE @PARAM = 1                                                                 
   FBG = GETATTR(@FORM,G.BACKGROUND)                                            
* Create browser object                                                         
   IF HANDLE = 0 THEN DISP 4,'OBJECT NOT CREATED'                               
* Create HTML                                                                   
   L.REC = '<HTML>'                                                             
   L.REC<2> = "<B>Title</B> ":@RECORD<4>:"<BR>"                                 
   L.REC<3> = "<B>First Name</B> :":@RECORD<2>:"<BR>"                           
   L.REC<4> = "<B>Surname</B> ":@RECORD<1>:"<BR>"                               
   L.REC<5> = "<B>Phone No</B> ":@RECORD<6>:"<BR>"                              

 * The following line contains the name of an SB+ process to call from within a hypertext 
* link and it also passes the current KEY to be data stacked into that process by the 
* BROWSER.EVENT.HANDLER  paragraph process that you created earlier
 L.REC<6> = '<A HREF="#$O*CUST*S1 ':@KEY:'$">This is a link to the enq screen</A>'
 L.REC<7> = "</HTML>"                                                         
* Transfer the HTML to the client as the ActiveX control will only display HTML from a 
* Windows file
   WRITE L.REC ON "CHWORK","HTMLREC":@PORT                                      
* Put HTML into browser control Navigate2 is a method within Shell.Explorer
   SET.VAL = GETATTR(HANDLE, '(Navigate2,C:\TEMP\MYOUTPUT.HTML)')                  
CASE 1                                                                          
   DISP 4,'In Paragraph, Event = ':@PARAM                                       

Then, define a field using the FD process called PSFIELD (this field name should not contain any special characters) that is used as a container for the HTML control:

Create a screen using the SD process, that contains PSFIELD. Note that the coordinates and dimensions for the field PSFIELD are used as the coordinates and the dimensions for the ActiveX control that you are going to use in this screen, and that the field must be an input field.

Insert XBROWSER,1 in the Process After Read Record field in the Screen Parameters window of the screen in which you wish to display the HTML, as shown in Figure 13.

When you invoke the screen and select a record, you see the following:

When you then click on the hyperlink that you have created, you invoke the enquiry screen that you specified in the HTML that you built in the paragraph XBROWSER:


These examples have demonstrated how to display a calendar control within an SB+ input screen and how to display a browser control within an input screen. Using these examples, you should get the idea of how easy it is to incorporate ActiveX controls within your application, and take advantage of the work that other people have done to improve the look and feel and also the usability of your application without a significant investment from you in programming time. Note that these examples only work in the GUI.




Get products and technologies

About the authors

Kevin Drury photo

Kevin Drury is the programmer of the server part of SB+. He has been working with SystemBuilder and SB+ for 19 years.


Pavel Smelianski photo

Pavel Smelianski is a specialist in the client and middle tier technologies. He joined System Builder in 1993 as a compiler engineer.

Document Actions