Download Sapera LT ActiveX Manual
Transcript
Trapping events To install a handler for one of the events in the Sapera LT ActiveX controls, first select the form that will handle the event, then select View | Code to bring up the source code window. In the list at the top left, select the name of the required control, for example, SapAcquisition1. In the list at the top right, select the name of the required event, for example, Xfer. Here is an example handler: Private Sub SapAcquisition1_Xfer(ByVal eventType As SapAcquisitionLIB.enumXferEvent, ByVal eventCount As Long, ByVal bufIndex As Long, ByVal isTrash As Boolean, ByVal pairIndex As Long) ‘ Event handling code goes here End Sub Compiling Demos in Visual Studio .NET To compile demos you must open the following solution in Microsoft Visual Studio .NET 2003: <SAPERADIR>\Demos\ActiveX\.NET\SapActiveXDemos.sln You can also directly open this solution by selecting DALSA | Sapera LT | Demos | ActiveX | All Demos (Visual Studio .NET) from the Start menu. You can compile all demos at once by selecting Build | Build Solution. You can also compile the demos individually by right-clicking the desired project in the Solution Explorer, selecting Set as StartUp Project and then selecting Build | Build CSAcqDemo. Using ActiveX Controls in Visual Studio .NET Before you can use any ActiveX control in your form, you must enable the required control(s) in your project by selecting Tools | Add/Remove Toolbox Items | COM Components. The controls are listed under the names Sap…Control of the COM Components tab. After the controls are selected they appear as icons in the Windows Forms tab of your toolbox. Open your toolbox window if it is not visible by selecting View | Toolbox. Notice that at least one form must be open so that the controls are enabled in the toolbox. Inserting ActiveX Controls in a Form (Design-time) To insert a control in a form, click the icon of your choice in the toolbox and drag a rectangle in your form at the desired location. Once the control is inserted a corresponding variable is automatically created. The name of this variable is ax<ControlName>1, for example axSapAcquisition1 for C# and Ax<ControlName>1, for example AxSapAcquisition1 for Visual Basic. You can then use it to invoke properties and methods from your control. 10 • Using the Sapera LT ActiveX Controls Sapera LT ActiveX Manual