Presentation is loading. Please wait.

Presentation is loading. Please wait.

Company LOGO ActiveX & Progress Hendrik Demol. Who am I? Progress since V4 Belgian ISV Free-lance DWP agent Hotel-room ActiveX student From a city with.

Similar presentations

Presentation on theme: "Company LOGO ActiveX & Progress Hendrik Demol. Who am I? Progress since V4 Belgian ISV Free-lance DWP agent Hotel-room ActiveX student From a city with."— Presentation transcript:

1 Company LOGO ActiveX & Progress Hendrik Demol

2 Who am I? Progress since V4 Belgian ISV Free-lance DWP agent Hotel-room ActiveX student From a city with a Viking name: Brugge

3 Who are you? Anybody using ActiveX ? Why ? Which ones?

4 Why use ActiveXs? To enhance the Progress GUI To add functionality To make better reports To interface with hardware or software To conform to fashion To make marketing happy

5 When to avoid ActiveX? When you can not install them on your customers PCs (policies) When you are afraid of the added complexity When you dont want to learn new syntax

6 Types of ActiveX In-line processing: The preferred way because it is many times faster. The OCX runs in the Progress container OLE conversation: For use with programs like Office modules (Word, Excel, Outlook). Each call includes a start & stop and this makes it very slow Other division: UI element or not

7 Check if they work with Progress! Progress applies the rules very strictly Others may not … including Microsoft! E.g. Mappoints OCX does not load in Progress so you can only use the OLE type As a rule of thumb: if a component works with C++ it works with Progress as well

8 Tools THE MANUAL: first source of functionality and syntax – usually written with the VB or C programmer in mind (: <>.) Progress objectviewer: Progress tool for discovering syntax ActiveXplorer: check the internals Dependency walker: to check the files you need to re-distribute Progress Knowledgebase (Solutions)

9 ActiveXplorer

10 Progress Objectviewer The bottom pane shows the applicable Progress syntax!

11 Adding an OCX to a screen Select ocx on the Progress palette Select the required ocx and size it Set standard properties

12 ActiveX events Most OCX components also trigger events These are listed in the manuals and are visible in the Progress COM viewer Also visible as events in the Appbuilder section editor

13 Wrx files Created by the Appbuilder automatically in the same directory as the.w file Distribute together with.r files Watch out for the change of.wrx files over versions:.wrx file generated in Progress 9.1D06 does not load in Progress 9.1D05 OCX versions between developers and between development & production may vary Some keep their first wrxs. Older wrxs seem upwardly compatible (both older OS & OCX)

14 Initialize-controls Define your own variable and initialize it properly – also for readability Use this for setting to your standard properties DEFINE VARIABLE hSp AS COM-HANDLE NO-UNDO. ASSIGN hSP = chCtrlFrame:vaSpread hsp:allowdragdrop = TRUE hSp:appearance = 1 hSP:BorderStyle = 1 hSP:unitType = 2 /* twips */ hSP:PrintColHeaders = FALSE hSP:PrintRowHeaders = FALSE hSP:printMarginLeft = 1000 hSP:TypeNumberShowSep = TRUE hSP:Protect = FALSE.

15 Cleaning up Clean up afterwards (memory leaks) Delete the objects (com-handles) Set the handle variables to Null DELETE OBJECT hXMLDoc NO-ERROR. ASSIGN hXMLDoc = ?.

16 MS Office Most Office programs are ActiveX servers: Outlook, Word, Excel, Powerpoint, MapPoint, Access, Visio and Binder DEFINE VARIABLE chActiveX AS COM-HANDLE. CREATE chActiveX. Once the handle to the application is set you expand to other com-objects and use all the properties and methods of each component. Study the component objects! Use Macro recording to retrieve syntax Suns Star Office works in a similar way

17 Excel via OLE Many samples available on the net Use this for small projects (slow) Ubiquitous Dump a textfile and open it with Excel Make a library with your functions Consider also the in-line activeX (since Office 9)

18 EXCEL object model Some collection of objects! Can be found via help in the VBA (macro) editor

19 Excel sample code (1) DEFINE VARIABLE chExcel AS COM-HANDLE NO-UNDO. DEFINE VARIABLE chWorksheet AS COM-HANDLE NO-UNDO. DEFINE VARIABLE chWorkbook AS COM-HANDLE NO-UNDO. CREATE "excel.application" chExcel. /* Open an Excel document */ chExcel:Workbooks:Open("c:\test1.xls"). chExcel:visible = true. /* Sets the number of sheets that will be automatically inserted into new workbooks */ chExcel:SheetsInNewWorkbook = 5. /* Add a new workbook */ chWorkbook = chExcel:Workbooks:Add(). /* Add a new worksheet as the last sheet */ chWorksheet = chWorkbook:Worksheets(5). chWorkbook:Worksheets:add(, chWorksheet). RELEASE OBJECT chWorksheet. /* Select a worksheet */ chWorkbook:Worksheets(2):Activate. chWorksheet = chWorkbook:Worksheets(2). /* Rename the worksheet */ chWorkSheet:NAME = "test". /* Modify the cell's format to Text */ chWorksheet:Cells:NumberFormat = "@". /* Change the cell's color */ chWorksheet:Columns("A:A"):Interior:ColorIndex = 5. /* Change the cell's format */ ASSIGN chWorksheet:Columns("A:A"):Font:ColorIndex = 2 chWorksheet:Columns("A:A"):Font:Name = "Courrier New". chWorksheet:Columns("A:A"):Font:Bold = TRUE. chWorksheet:Columns("A:A"):Font:Italic = TRUE. /* Set underline: StyleSingle = 2 */ chWorksheet:Columns("A:A"):FONT:UNDERLINE = 2.

20 Excel sample code (2) /* Add data */ ASSIGN chWorksheet:Range("B1"):VALUE = "Value" chWorksheet:Range("B2"):VALUE = 255 chWorksheet:Range("B3"):VALUE = 100 chWorksheet:Range("B4"):VALUE = 250 chWorksheet:Range("B5"):VALUE = 400 chWorksheet:Range("B6"):VALUE = 100 chWorksheet:Range("B7"):VALUE = 600. /* Add a Formula */ chWorksheet:Range("A8"):VALUE = "Total:". /* Set Cell's format to Number */ chWorksheet:Range("B8"):NumberFormat = 0. chWorksheet:Range("B8"):Formula = "=SUM(B2:B7)". /* Set horizontal alignment Right Alignemnt: -4152 / Left Alignment :-4131 */ chWorksheet:Range("B:B"):HorizontalAlignment = -4152. /* Freeze Pane */ chWorksheet:Range("A2"):SELECT. chExcel:ActiveWindow:FreezePanes = TRUE. /* Save the new workbook without displaying alerts */ chExcel:DisplayAlerts = FALSE. chWorkbook:SaveAs("c:\test2.xls",43,,,,,). /* Quit Excel */ chExcel:quit(). /* Release Com-handle */ RELEASE OBJECT chWorksheet. RELEASE OBJECT chWorkbook. RELEASE OBJECT chExcel.

21 Word Sample program with print screen Sample code: DEFINE VARIABLE oWord AS COM-HANDLE NO-UNDO. CREATE "Word.Application" oWord. oWord:Documents:Open("Some.Doc"). oWord:Visible = True. PAUSE. /* Allow you to actually see the document before we kill it */ RELEASE OBJECT oWord.

22 Outlook Very interesting and rich in functionality Since V10 date-time format to interact with Outlook agenda MAPI namespace Read & write mail, tasks, contacts, calendar & notes Think about master data! Who is boss? Outlook or your application? Make a library with your frequent functions

23 Sending mail DEFINE VARIABLE objOutlook AS COM-HANDLE NO-UNDO. DEFINE VARIABLE objOutlookMsg AS COM-HANDLE NO-UNDO. DEFINE VARIABLE objOutlookAttach AS COM-HANDLE NO-UNDO. DEFINE VARIABLE objOutlookRecip AS COM-HANDLE NO-UNDO. CREATE "Outlook.Application" objOutlook. objoutlookMsg = objOutlook:CreateItem(0). objOutlookRecip = objOutlookMsg:Recipients:Add(""). /*use of concatenated object */ objOutlookRecip:Type = 1. objOutlookMsg:Subject = "Your Subject". objOutlookMsg:Body = "The Body". objOutlookMsg:Attachments:Add("c:\autoexec.bat"). objOutlookRecip:Resolve. objOutlookMsg:Send. objoutlook:Quit(). RELEASE OBJECT objOutlook. RELEASE OBJECT objOutlookMsg. RELEASE OBJECT objOutlookRecip.

24 Outlook Object Model Folders Inspectors Collections Items

25 Mappoint Show addresses on the map Calculate routes Plan routes Location services Add data to maps Very underestimated software (Mappoint who ? by Microsoft!)

26 Farpoint Spread Much faster than Excel Easy object model Rich functionality Easy to build into a powerful 4GL wrapper: automatically display a temp- table, etc

27 Charts Many different components out there Some highly sophisticated modules The simplest: MS Chart (VB6) Often array based data Try to add user interaction (presentation change, data selection change)

28 ComponentOne VsView The first component I ever used (V2 in combination with Progress 8.2) Print preview PDF generation Zooming Page browsing Own mini toolbar

29 Infragistics SchedX Alternative to Outlook Separate components for day-, week- and monthview

30 Toolbar The newest and slickest are made for.Net I am still looking for the right one Infragistics has Ultra Toolbars with Office XP look. And an annoying bug! And intersting tools

31 Calendars Great for making a date picker (add a dynamic trigger to each date fill-in). E.g. right-mouse-click Put an ocx on a dialog-box and call this from the trigger

32 List view & Tree view Often used together Some types have extra UI features Progress special treeview from Perhaps not the best UI item for large datasets. When to load the node? Nice as a menu

33 Progress bar DEF NEW SHARED VAR vStop AS LOG NO-UNDO init false. DEFINE VARIABLE hProg AS HANDLE NO-UNDO. DEFINE VARIABLE vInt AS INT NO-UNDO. DEFINE VARIABLE vMax AS INT NO-UNDO INIT 8000. DEFINE VARIABLE vMin AS INT NO-UNDO init 1000. RUN progressbar.w PERSISTENT SET hProg. RUN display_title IN hProg (INPUT "Oslo presentation"). RUN display_message IN hProg (INPUT "Hallo World"). /*system message */ RUN GaugeInitMax IN hProg (vMax). RUN GaugeInitMin IN hProg (vMin). DO vInt = vMin TO vMax : RUN Gaugeincrement IN hProg (vInt). IF vStop THEN LEAVE. END. RUN GaugeClose IN hProg. pause 0.

34 Handling low volume SMS For big volume you better talk directly to the telecom SMS server There are several components often working very differently Perhaps consider separating the modules, making a small SMS server polling the database for new records (generated by the client software) and creating records from the incoming messages

35 Outlook-style button bar Great for 2 level- menus Familiar interface Easy combining text & graphics

36 COMM port reader & TCP/IP Serial barcode readers Serial connections to hardware TCP/IP sockets, Telnet,etc

37 Image handling Capturing, scanning, handling, viewing, annotating, converting and more Many different modules available from Leadtools and Pegasus Imaging Corporation are the best known There is even a red-eye removal add-on

38 Trying to be funny If you want to mimic Microsoft you can try to use moving graphics or even genies Many OCX are supplied with standard Windows programs like Media player

39 Some more … Credit-card validation Spelling Word-processing Faxing Data Analysis GIS Data compression Postal code validation Mail validation XML parsing etc

40 Use standard Microsoft components or not? A big question for you: use standard Microsoft OCX components or buy from specialised sources? Standard MS components usually are part of the Windows environment Watch out for version differences between Windows versions or components! Non MS components equals more installed components but more control

41 Use OCX in a framework (DWP) DWP framework : support for activeX, by using a standard wrapper methodology. Today treeview and listview are supported out of the box. You can add your own using the same methodology

42 Tips & tricks Null values: Progress happily accepts null values (x / 0 = ?). Microsoft does not! Initialize variables and values to make sure you have valid data Since V9 you can concatenate objects chApp:Object:SubObject:Property Invest in making your code generic

43 Use OCX in a 4GL wrapper Avoid sprinkling your application with the same ocx in various modules Consider the next version of your ocx Work a little harder now and relax later Render the use of ocxs generic: run your functions & procedures. Keep them when you change ocx Hide ocx complexity from developers

44 Where to find ActiveXs?

45 XP look If all you want to accomplish is an XP look then look at the use of a manifest file Prowin32.exe.manifest is an xml file that signals Windows XP to update the look of the executable Warning: add useClipChildren=Yes to your ini file or registry in the startup section, otherwise buttons will not show

46 Conclusion & questions Think first! OCX can be a nuissance OCX are fun OCX can enhance your app Tusen Takk!

Download ppt "Company LOGO ActiveX & Progress Hendrik Demol. Who am I? Progress since V4 Belgian ISV Free-lance DWP agent Hotel-room ActiveX student From a city with."

Similar presentations

Ads by Google