DADiSP – ActiveX

Learn about the DADiSP ActiveX connection…

ActiveX is a broad term that generally refers to a Microsoft binary standard for sharing code and data between separate programs or “components”. The actual protocol is specified by the Component Object Model (COM). COM has undergone many upgrades and enhancements since its original introduction as Object Linking and Embedding (OLE).

ActiveX Automation

One important feature of COM is Automation. Automation allows a “client” program to control a “server” or component program just as if the component functionality was built into the client. For example, DADiSP can fully control Microsoft Word, placing a DADiSP Worksheet into a document and printing the results all from within DADiSP. Likewise, a Visual Basic program can hand off data to DADiSP for processing without DADiSP ever being visible to the user. In this way, DADiSP acts as a powerful data analysis library for any program that supports Automation.

ActiveX components generally expose three basic constructs:

  • Properties
  • Events
  • Methods

Properties represent the various settings of the component such as color, font, size, etc.

Events are notifications the component makes to the client program. Some possible events are mouse was clicked, canvas was sized, button was pushed, etc. After receipt of the notification, the client can respond appropriately.

Methods are functions the client program can direct the component to execute.

DADiSP Automation Server

DADiSP as an ActiveX server or component supports several extremely powerful methods, including:

  • Getdata (window or variable)
  • Putdata (window or variable, data)
  • Execute (“command string”)

Getdata retrieves data from a DADiSP Window or variable to the client. For example, here’s a Visual Basic code fragment that obtains the series in W2 of a DADiSP Worksheet into a Visual Basic variable:

DADiSP code fragment

In this example, Visual Basic acts as the “client” and DADiSP the ActiveX “server”.

We declare DADiSP as an ActiveX object with the

Dim DADiSP As Object

declaration. Visual Basic establishes a connection to DADiSP with the

Set DADiSP = CreateObject("DADiSP.Application")

statement. The connection is made by checking the Registry for ActiveX components and capabilities. For faster ActiveX communication, DADiSP also provides a COM “Type Library” (dadisp.tlb) that provides in depth information on the ActiveX capabilities offered by DADiSP. Finally,

VbVar = DADiSP.Getdata("W2")

copies the series or table in W2 into the Visual Basic array VbVar. ActiveX data transfers are quite flexible and efficient. DADiSP transparently supports multi-column data using the COM standard SafeArray. Byte, Integer, Float, and Double scalar values are also supported.

Here’s a code fragment that generates a Visual Basic array and then transfers the array to DADiSP.

DADiSP code fragment

You can also “get” or “put” data to a DADiSP variable. For example:

DADiSP variable

Because Execute accepts any valid DADiSP command as input, all the features, functions and capabilities of DADiSP are available to any program that supports ActiveX Automation.

Now for a full example of ActiveX with Visual Basic controlling DADiSP. We’ll use each of the above methods to 1) create data in VB, 2) transfer it to DADiSP, 3) use DADiSP to process the data and 4) retrieve the processed result from DADiSP.

ActiveX with DADiSP
To make DADiSP appear on the screen, we set the “visibility” property with:

DADiSP.Visible = 1

You could also use the DADiSP SETVISIBLE function:

DADiSP.Execute("SetVisible(1)")

DADiSP Automation Client

So far, we’ve shown examples of controlling DADiSP from Visual Basic. In this case, Visual Basic is the “client” and DADiSP acts as the ActiveX “server”. However, DADiSP can also function as an ActiveX client to control and make use of the features of ActiveX servers such as Excel, Word, database programs or data acquisition drivers.

The DADiSP SPL syntax for ActiveX is very similar to the Visual Basic syntax mentioned above. For example, to connect to an ActiveX object, you use the CreateObject function. Properties can be set and retrieved with standard variable assignments and methods executed with the “dot” syntax. For example, the following SPL code fragment connects to Word and makes it visible:

SPL code fragment

DADiSP can access any function exposed by the ActiveX Automation server. For example, Word has a very elaborate ActiveX hierarchy, consisting of Documents, Ranges, Tables and a host of other objects all accessible to DADiSP.

Finally, the full SPL example below demonstrates the use of these objects to create and copy a DADiSP Worksheet to a Word document.

SPL full example

In conclusion, ActiveX is a very powerful, standardized means of sharing the capabilities of separate programs in a flexible and robust manner. The SPL\ActiveX subdirectory included with your DADiSP distribution provides several additional examples of using ActiveX with DADiSP.

The Next Steps

What do our Customers say about us?

I began using Origin because of its versatility in the varied experimental work that we do, from electrophysiology to clinical studies. I have stayed with Origin because of the high level of statistical expertise and customer service that we get from technical support staff.”

Good tutor genuinely interested in student’s needs. This course provided all I needed and more.

GS, Great Dunmow, UK

Thank you for all your efforts. A perfect example of what support should be. Again thank you.

GT

“Looking online for a software that would perform the particular task we need at the moment (resolution of overlapped Gaussian-shaped peaks), I was glad to find out that a fully functional trial version of OriginPro was made available by your company. Also, watching one of the tutorial videos, all commands and short-cuts I needed to get my results were shown there. Very handy and a time-saver.”

Mauricio Morais, LCT, M.Sc. - Sr. Research Assistant - NEPS Lab Jean Mayer USDA Human Nutrition Research Center on Aging at TUFTS Univers

For the time being we are unable to offer the following product ranges although we are currently working hard to increase the number of products we can offer in the future. Please contact us to talk about alternative products that we may be able to offer you.