Presentation is loading. Please wait.

Presentation is loading. Please wait.

ICONICS ActiveX ToolWorX V 6.1.

Similar presentations


Presentation on theme: "ICONICS ActiveX ToolWorX V 6.1."— Presentation transcript:

1 ICONICS ActiveX ToolWorX V 6.1

2 AGENDA Introduction & Overview Demonstration: GWXGauge
ActiveX Toolkit Architecture Programming Techniques Demonstration: Creating a New ActiveX Control with ActiveX ToolWorX

3 Introduction/Overview
Part 1 Introduction/Overview

4 Recommended Knowledge
Visual C++ 6.0 MFC Microsoft Developer’s Studio OLE Automation Win 32 Building ActiveX controls with MFC

5 ActiveX Controls Component/modular software design
Can be embedded into any ActiveX container Visual Basic Forms HTML pages for Internet Explorer ICONICS’ GraphWorX32 HMI Application Your own custom built container Methods, Properties, and Events Usually In-process

6 ActiveX ToolWorX A development toolkit for easy creation of OPC (OLE for Process Control) enabled ActiveX controls Featuring OPC Connectivity Powerful Animation Capabilities Built-in UI controls (sliders, buttons, etc.)

7 OPC Connectivity Easy support for connection to OPC servers
Automatically handles OPC data updates (reads and writes); just provide a tag name, the toolkit takes care of the rest. OPC Tag Browser included for tag name selection user interface

8 Powerful Animation Includes all the animation capabilities of ICONICS’ GraphWorX32 HMI product Compose images with rectangles, lines, ellipses, text, bitmaps, and more... Transform images: Size, Location, Rotation, Color, and more... Updates are fast and flicker-free

9 Built-in UI Controls Toolkit includes handling of User Input controls
Sliders and dials for writing analog values Numeric/text entry fields Buttons for downloading/toggling values No need to worry about handling mouse clicks, mouse moves, or keystrokes for these input controls; the toolkit takes care of it.

10 Origins of ActiveX ToolWorX
Toolkit was created by ICONICS to assist in development of ICONICS component ActiveXs Leverages functionality developed by ICONICS for GraphWorX32 HMI Application Resulting toolkit is “general purpose” (useful to developers other than ICONICS).

11 Advantages of Using ActiveX ToolWorX
Rapid development because there is no need to implement features already supported by the toolkit (OPC connectivity, animation, UI controls, etc.) Permits focus on component-specific functionality (build desired “intelligence” into your component) Don’t even need to understand OPC (the toolkit abstracts it)

12 What is Included in the Toolkit?
ICONICS ActiveX ToolWorX Wizard Automatically generates the framework source code for developing ActiveX controls using ActiveX ToolWorX ActiveX ToolWorX Developer’s Guide Documentation Detailed instructions on how to use the toolkit Explanation of the toolkit’s architecture GraphWorX32 OLE Automation Reference

13 What is Included in the Toolkit?
GwxExtDll.DLL Dynamic link library containing HMI functionality (more on this later) olexpress.DLL Contains OPC related functionality (this DLL is used by GwxExtDll; you will not need to use this DLL directly) TagBrowser.DLL OPC tag browser

14 What is Included in the Toolkit?
Gwx32.TLB Type library for OLE Automation supported by GwxExtDll GWXGauge ActiveX Example ActiveX control created using the toolkit Source code of GWXGauge A valuable resource for understanding how to create controls using the toolkit Other miscellaneous support files

15 GWXGauge GWXGauge is an OPC enabled ActiveX control developed with ActiveX ToolWorX Gauge has over 100 properties making it a highly flexible component Source code for the gauge included in the toolkit demonstrates a wide variety of programming techniques that can be used with the toolkit

16 Part 2 Architecture

17 GwxExtDll.DLL Significant portions of ICONICS’ GraphWorX32 HMI product have been encapsulated in this DLL This DLL is an MFC Extension DLL The extention DLL exports a single class CGwxControl (a COleControl derived class). Your new controls are derived off of CGwxControl (instead of COleControl), thus inheriting all of the functionality in GwxExtDll GwxExtDLL exposes a rich set of OLE automation properties/methods for manipulating the base control

18 ActiveX Toolkit Architecture
ActiveX Container Application Instances of your ActiveX Controls ActiveX “A” Code ActiveX “B” Code OLE Automation OLE Automation GwxExtDll.DLL Code GwxExtDll Data GwxExtDll Data OPC Data OPC Data OPC Data OPC Server OLExpress FrameWorX

19 ActiveX ToolWorX Wizard
The released version of the toolkit will include a wizard for automatically generating framework source code for developing ActiveX controls using ActiveX ToolWorX To help understand the toolkit better, the tasks automated by the wizard are described in the ActiveX ToolWorX documentation

20 Tasks Performed by the Wizard
Create a new Visual C++ project using Microsoft’s MFC ActiveX Control Wizard In Build-Settings-Link-Release add GwxExtDll.LIB In Build-Settings-Link-Debug add GwxExtDlld.LIB When you are building a debug version of your ActiveX, you need to use the debug version of GwxExtDll to ensure that the ActiveX registers properly

21 Tasks Performed by the Wizard
Change your control class to be derived from CGwxControl instead of COleControl Replace all instance of COleControl in your control class (.cpp and .h file) Include Control.h in the .cpp files of your control class and application class Control.h is the class definition file for CGwxControl

22 Tasks Performed by the Wizard
Replace the default drawing code in OnDraw() to: CGwxControl::OnDraw(pdc, rcBounds, rcInvalid) This allows the base class, CGwxControl, to do all the drawing In InitInstance(), just before returning, add the following code: InitialGraphWorXExtensionDll(); This function insures the MFC properly handles the current module state

23 Tasks Performed by the Wizard
Inherit desired properties and methods of the base class by modifying the ODL file of your project Copy the properties/methods you want from GWXview32.ODL (file provided in the toolkit) Modify the ID numbers such that the first bit of the hi-word is set

24 Tasks Performed by the Wizard
Using Class Wizard, add a new class by importing the GwxDisplay object type from Gwx32.TLB This provides easy access to exposed methods/properties of GwxExtDll To use the new class (IGwx32) add a new member variable to your control class. Initialize the variable as follows: LPDISPATCH lpDispatch = GetDisplay(); m_lpDispatch = new IGwx32(lpDispatch); Delete this member in the destructor of your control class

25 Tasks Performed by the Wizard
Optionally override default settings of the base control’s properties in the constructor of your control class The following example would turn on the scrollbars by default in your derived control: m_verticalScrollbar = TRUE; m_horizontalScrollbar = TRUE;

26 Programming Techniques
Part 3 Programming Techniques

27 Programming Tasks Create GraphWorX32 objects which make up the control
Create lines, rectangles, dynamic transformations, etc. that define the look and behavior of your ActiveX Manipulate existing GraphWorX32 objects in the control Associate properties of your ActiveX control with properties of the lines, rectangles, dynamic transformations, etc. that comprise your control.

28 Creating Objects There are two primary techniques you can use to create GraphWorX32 objects with the toolkit Dynamic programmatic creation of objects via OLE automation Loading a pre-created set of objects created visually using GraphWorX32 HMI application

29 Programmatic Creation
Use OLE automation methods defined in Gwx32.TLB to create the GraphWorX32 objects, based on the current values of your ActiveX’s properties Use methods such as CreateRectangle() and CreateSizeDynamic() to build up the visual appearance and behavior of your ActiveX

30 Visual Creation Create the objects for your ActiveX visually using GraphWorX32 Bind the resulting display file directly into your ActiveX resources Load the display from the resource area via FileOpen() method

31 Programmatic vs. Visual Creation
Programmatic Creation is highly flexible but more difficult to program Layout of objects is unrestricted, but logic for intelligent layout can be tricky This is the technique used by GWXGauge Visual Creation is very easy to program, but tends to be less flexible Layout of objects is done visually, but this layout is generally fixed Can include bitmaps in the layout This technique is good for controls which are visually complex, but tend not to vary much in their appearance

32 Example: Programmatic Creation
To create a resizing bar m_lpDispatch->CreateRectangle(l,t,w,h,filled,fillColor,lineColor, lineWidth,lineStyle,shadow,shadowColor,edgeStyle,hidden, ”bar1”,rounded)->Release(); LPDISPATCH lpDisp = m_lpDispatch->CreateSizeDynamic(“bar1”,”size1”, sizeType,clip,startSize,endSize); IGwxDynamic sizeDispDrv(lpDisp); sizeDispDrv.SetDataSource(dataSource); sizeDispDrv.SetRangeOverride(rangeOverride); if (rangeOverride) { sizeDispDrv.SetLowRange(lowRange); sizeDispDrv.SetHighRange(highRange); } Don’t forget to release dispatch pointers

33 Example: Creation by FileOpen()
First, visually create the control’s display using GraphWorX32 Import the display into your project via Insert/Resource/Custom Specify the resource type as “GWX32_DISPLAY” Store the resource id of the display as a string name (for instance, “GWX32_MYCONTROL1”) Load the display from the resource area using FileOpen() method, passing the file name in the special format: “LoadDisplayFromResource:string representation of module handle:resource name string”

34 Example: Creation by FileOpen()
Sample Code: HINSTANCE hModule = AfxGetResourceHandle(); CString strModuleHandle; strModuleHandle.Format(_T("%ld"),(long)hModule); CString strDisplayName(_T("LoadDisplayFromResource:")); strDisplayName += strModuleHandle; strDisplayName += _T(":GWX32_MYCONTROL1"); m_lpDispatch->FileOpen(strDisplayName); Note: you can bind more than one display file into your ActiveX, loading any one of those displays based on property value

35 Handling Property Changes
When a property of your ActiveX changes, you need to update the object(s) affected by that property Get the dispatch pointer of the appropriate object, given the object’s name (the name of an object is specified when the object is first created). Example: changing the data source LPDISPATCH lpDisp = m_lpDispatch->GetDynamicObjectFromName(objName); if (lpDisp != NULL) { IGwxDynamic lpDispDrv(lpDisp); lpDispDrv.SetDataSource(newDataSource); }

36 Creating a new ActiveX Control with ActiveX ToolWorX
Demonstration Creating a new ActiveX Control with ActiveX ToolWorX

37 Summary ICONICS’ ActiveX ToolWorX allows you to rapidly develop OPC enabled ActiveX controls with fast, flicker-free animation, and user input capabilities Components made with ActiveX ToolWorX can be embedded into any ActiveX container


Download ppt "ICONICS ActiveX ToolWorX V 6.1."

Similar presentations


Ads by Google