Company LOGO ActiveX & Progress Hendrik Demol. Who am I? Progress since V4 Belgian ISV Free-lance...

46
Company LOGO ActiveX & Progress Hendrik Demol

Transcript of Company LOGO ActiveX & Progress Hendrik Demol. Who am I? Progress since V4 Belgian ISV Free-lance...

Page 1: 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.

Company

LOGO

ActiveX & Progress

Hendrik Demol

Page 2: 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.

Who am I?

Progress since V4 Belgian ISV Free-lance DWP agent Hotel-room ActiveX

student From a city with a

Viking name: Brugge [email protected]

Page 3: 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.

Who are you?

Anybody using ActiveX ? Why ? Which ones?

Page 4: 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.

Why use ActiveX’s?

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

Page 5: 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.

When to avoid ActiveX?

When you can not install them on your customer’s PC’s (policies)

When you are afraid of the added complexity

When you don’t want to learn new syntax

Page 6: 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.

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

Page 7: 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.

Check if they work with Progress!

Progress applies the rules very strictly Others may not … including Microsoft! E.g. Mappoint’s 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

Page 8: 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.

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)

Page 9: 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.

ActiveXplorer

Page 10: 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.

Progress Objectviewer

The bottom pane shows the applicable Progress syntax!

Page 11: 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.

Adding an OCX to a screen

Select “ocx” on the Progress palette

Select the required ocx and size it

Set standard properties

Page 12: 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.

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

Page 13: 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.

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 wrx’s. Older wrx’s seem upwardly compatible (both older OS & OCX)

Page 14: 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.

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.

Page 15: 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.

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 = ?.

Page 16: 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.

MS Office

Most Office programs are ActiveX servers: Outlook, Word, Excel, Powerpoint, MapPoint, Access, Visio and Binder

DEFINE VARIABLE chActiveX AS COM-HANDLE.

CREATE “my.app” 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 Sun’s Star Office works in a similar way

Page 17: 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.

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)

Page 18: 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.

EXCEL object model

Some collection of objects!

Can be found via “help” in the VBA (macro) editor

Page 19: 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.

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 .

Page 20: 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.

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.

Page 21: 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.

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.

Page 22: 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.

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

Page 23: 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.

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("[email protected]")./*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.

Page 24: 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.

Outlook Object Model

Folders Inspectors Collections Items

Page 25: 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.

Mappoint

Show addresses on the map Calculate routes Plan routes Location services Add data to maps Very underestimated software (“Mappoint

who ?” by Microsoft!)

Page 26: 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.

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

Page 27: 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.

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)

Page 28: 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.

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

Page 29: 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.

Infragistics SchedX

Alternative to Outlook

Separate components for day-, week- and monthview

Page 30: 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.

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

Page 31: 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.

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

Page 32: 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.

List view & Tree view

Often used together Some types have extra

UI features Progress special

treeview from www.4gl.fr Perhaps not the best UI

item for large datasets. When to load the node? Nice as a menu

Page 33: 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.

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.

Page 34: 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.

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

Page 35: 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.

Outlook-style button bar

Great for 2 level-menus

Familiar interface Easy combining

text & graphics

Page 36: 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.

COMM port reader & TCP/IP

Serial barcode readers

Serial connections to hardware

TCP/IP sockets, Telnet ,etc

Page 37: 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.

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

Page 38: 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.

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

Page 39: 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.

Some more …

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

Page 40: 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.

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

Page 41: 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.

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

Page 42: 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.

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

Page 43: 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.

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 ocx’s generic: run your

functions & procedures. Keep them when you change ocx

Hide ocx complexity from developers

Page 44: 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.

Where to find ActiveX’s?

http://www.componentsource.com http://www.infragistics.com http://www.component1.com http://www.active-x.com/ http://www.vbxtras.com/

Page 45: 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.

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

Page 46: 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.

Conclusion & questions

Think first! OCX can be a nuissance OCX are fun OCX can enhance your app

Tusen Takk!