View Issue Details

IDProjectCategoryView StatusLast Update
0021138PatchesPatchpublic2012-04-16 10:47
ReporterLudo Brands Assigned ToMattias Gaertner  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version0.9.31 (SVN) 
Summary0021138: New Lazarus package integrating typelib importer and ActiveXContatiner in IDE
DescriptionThe attached package does the following:
- add "import type library" to the Project menu
- add generic visual TActiveXContainer to the component palette in the ActiveX tab

Usage:
TActiveXContainer is a TWinControl descendant having the following additional properties:
property ClassName:string;
property ComServer:IDispatch;
property Active:boolean;
There are 2 ways to use the component, drop on a TActiveXContainer form and
1) assign a class name to ClassName (f.e 'Shell.Explorer'), set Active to true: TActiveXContainer will create the com object with CreateOleObject, connect it to the TActiveXContainer window and return the interface in ComServer. Use ComServer to access the object with late binding. Setting Active to false destroys also the COM object.
2) at run time, create a com object (CreateOleObject, call CoClass constructor,...) and assign the interface to ComServer. Set Active to true to connect the object to the TActiveXContainer window and false to disconnect it (no automatic destruction of the object). This is the typical use for early binding.
 
"import type library" opens a screen prompting the user for the typelib to import plus several options. The options correspond with the importtl tool options.
When a typelib is imported, eventually with dependencies, all created units will be opened in the current project as new files (not saved, not added to the project).
When a typelib is imported as a package, the user is prompted for a directory to store the new package (similar to "create new package"). The Name of the package is generated from the typelib and the package is opened when importing completed. The package contains the typelib with ActiveXContainer descendants created for dispatchable objects, including event handlers for these objects.

IMPORTANT. This package requires fpc trunk (backporting to 2.6.1 is on its way). Units typelib.pas and stdole2.pas are recently added to fpc.
Additional InformationThis is my first IDE integration package. Probably some close review would be useful in that area ;)
TagsNo tags attached.
Fixed in Revision36802
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

2012-01-23 17:16

 

lazactivexreg.zip (11,157 bytes)

Mattias Gaertner

2012-01-23 17:30

manager   ~0055974

property ClassName hides TObject.ClassName.
Is this needed?

Ludo Brands

2012-01-23 17:34

developer   ~0055975

Important point for Delphi users: to access the methods of the imported ActiveX object you have to use the OleServer property of the component which exposes the interface of the object. The Delphi ActiveX importer adds an additional binding to publish all objects methods as component methods. This importer does not do this (yet?).
For example, using ieframe.dll (ShDocVw) the Delphi WebBrowser_V1.GoHome; becomes TWebBrowser.OleServer.GoHome; in fpc.

Ludo Brands

2012-01-23 18:19

developer   ~0055977

> property ClassName hides TObject.ClassName.
> Is this needed?

No. Strange that the compiler doesn't notice this. I'll change it to OleClassName.

Sven Barth

2012-01-23 18:59

manager   ~0055979

Why menu "Project"? I'd more expect this in "Tools"...

Regards,
Sven

Ludo Brands

2012-01-23 20:10

developer   ~0055982

> Why menu "Project"? I'd more expect this in "Tools"...
My Delphi habits;
Also, when just importing, the files are opened in the current editor. "Tools" would require a prompt or several prompts to save the file(s). This gives also the opportunity to rename the units in case there are multiple versions. Again in case of dependencies, the units are already included in the uses clause and renaming them from a "tools" menu would be more complicated then from the editor.
The package creation part would perhaps be better in the "Package" menu.

Sven Barth

2012-01-23 21:01

manager   ~0055987

If I'd use Delphi as a base then you'd need to put it into "Package" as this is where I used it last time (which was today ;) ). "Tools" sounds more naturally to me.
Besides: Does the capability of your importer depend on the menu location? (This is an honest question as I haven't used the IDE Interface yet...) E.g. can't you do the same if the menu item is located in the "Tools" menu?

Regards,
Sven

Ludo Brands

2012-01-24 09:43

developer   ~0055996

Last edited: 2012-01-24 09:44

In my D6 "Import Type Library" is the 3rd menu item in the Project menu :) And "Import ActiveX Control" is the 3rd menu item in the Component menu. Looks they moved all of it in more recent versions to the component menu.

The import "wizard" can be launched from any menu.

> "Tools" sounds more naturally to me.
Not for me. Correct me if I'm wrong, most of the tools work outside the IDE (except for "Check LFM file in Editor") and don't create new files in the editor. See my previous comments on renaming nested typelibs.

To be honest, put it where you (deciders) want it. Let me know your collective decision and I'll change it. I have made plenty of design decisions when writing the import library and ActiveX container that are more fundamental to the tool than where in the menu the wizard is going to be located. If all these decisions are going to be questioned/challenged at length, where going to have fun for quite some time!!

Sven Barth

2012-01-24 10:25

manager   ~0056000

> In my D6 "Import Type Library" is the 3rd menu item in the Project menu :) And "Import ActiveX Control" is the 3rd menu item in the Component menu. Looks they moved all of it in more recent versions to the component menu.
>
> The import "wizard" can be launched from any menu.

In the newer Post-Delphi 2005 IDEs they seem to have cleaned this up, because there only the "wizard" in "Components" menu exists...

>> "Tools" sounds more naturally to me.
>Not for me. Correct me if I'm wrong, most of the tools work outside the IDE (except for "Check LFM file in Editor") and don't create new files in the editor. See my previous comments on renaming nested typelibs.

Hmm... you're right... at least in 0.9.31. I had based my assumptions on 0.9.30 where there are a few source code related options in the Tools menu... (I totally forgot about the menu clean up a few months ago ^^)

But "Project" still does not feel correct. In the end you're not adding the generated units to the project, so why should this option be in the "Project" menu?

Can someone else please comment on this as well? :)

> To be honest, put it where you (deciders) want it. Let me know your collective decision and I'll change it.

In this case I'm not a decider, but a mere user. I may have the "developer" tag next to my name, but that's only for the compiler, not for Lazarus ;)

> I have made plenty of design decisions when writing the import library and ActiveX container that are more fundamental to the tool than where in the menu the wizard is going to be located. If all these decisions are going to be questioned/challenged at length, where going to have fun for quite some time!!

I would see this way: If all that users complain about is the location in the menu then your more fundamental decisions seem to be alright ;)

Regards,
Sven

Felipe Monteiro de Carvalho

2012-01-24 14:00

developer   ~0056009

> Can someone else please comment on this as well? :)

To me too the "Tools" menu seams more appropriate.

Reinier Olislagers

2012-01-26 11:59

developer   ~0056073

Tools would seem more natural to me as well... It's not projectwide, it's only relevant to one unit file...
Also, it seems to fit in with the Delphi importer in Tools: both make foreign code usable for Lazarus...

Just my 2 cents as a user and bug botherer...

Marco van de Voort

2012-02-23 13:43

manager   ~0057026

Bump

Ludo Brands

2012-03-19 15:13

developer   ~0057837

Since there are no more votes I'll assume that the "tools" menu is the consensus among developers.

Attached a modified version that uses the tools menu (itmSecondaryTools). ClassName renamed to OleClassName.

2012-03-19 15:13

 

lazactivexreg2.zip (11,170 bytes)

Ludo Brands

2012-04-10 10:40

developer   ~0058456

Bump

Mattias Gaertner

2012-04-10 11:15

manager   ~0058458

Please convert file names with UTF8ToSys before passing file names from the LCL to the RTL functions (e.g. AssignFile).

Add a README.txt, that explains the requirements like FPC version and OS and where to get an example.

Add a license in the lpk. See the lcl.lpk for an example.

2012-04-11 13:53

 

lazactivexreg3.zip (11,609 bytes)

Ludo Brands

2012-04-11 13:54

developer   ~0058500

Changes attached as lazactivexreg3.zip.

http://wiki.freepascal.org/LazActiveX is work in progress

2012-04-11 15:41

 

lazactivexreg4.zip (11,607 bytes)

Ludo Brands

2012-04-11 15:42

developer   ~0058502

Last edited: 2012-04-11 15:43

Fixed a bug introduced with the property change ClassName -> OleClassName and corrected the comments accordingly. lazactivexreg4.zip

Ludo Brands

2012-04-15 18:04

developer   ~0058625

Wiki page completed. Anything else missing?

Mattias Gaertner

2012-04-16 00:13

manager   ~0058636

Great.

Issue History

Date Modified Username Field Change
2012-01-23 17:16 Ludo Brands New Issue
2012-01-23 17:16 Ludo Brands File Added: lazactivexreg.zip
2012-01-23 17:16 Ludo Brands Widgetset => Win32/Win64
2012-01-23 17:30 Mattias Gaertner Note Added: 0055974
2012-01-23 17:34 Ludo Brands Note Added: 0055975
2012-01-23 18:19 Ludo Brands Note Added: 0055977
2012-01-23 18:59 Sven Barth Note Added: 0055979
2012-01-23 20:10 Ludo Brands Note Added: 0055982
2012-01-23 21:01 Sven Barth Note Added: 0055987
2012-01-24 09:43 Ludo Brands Note Added: 0055996
2012-01-24 09:44 Ludo Brands Note Edited: 0055996
2012-01-24 10:25 Sven Barth Note Added: 0056000
2012-01-24 14:00 Felipe Monteiro de Carvalho Note Added: 0056009
2012-01-26 11:46 Felipe Monteiro de Carvalho LazTarget => -
2012-01-26 11:46 Felipe Monteiro de Carvalho Status new => confirmed
2012-01-26 11:59 Reinier Olislagers Note Added: 0056073
2012-02-23 13:43 Marco van de Voort Note Added: 0057026
2012-03-19 15:13 Ludo Brands Note Added: 0057837
2012-03-19 15:13 Ludo Brands File Added: lazactivexreg2.zip
2012-03-19 16:07 Vincent Snijders Project Lazarus => Patches
2012-04-10 10:40 Ludo Brands Note Added: 0058456
2012-04-10 11:15 Mattias Gaertner Note Added: 0058458
2012-04-11 13:53 Ludo Brands File Added: lazactivexreg3.zip
2012-04-11 13:54 Ludo Brands Note Added: 0058500
2012-04-11 15:41 Ludo Brands File Added: lazactivexreg4.zip
2012-04-11 15:42 Ludo Brands Note Added: 0058502
2012-04-11 15:43 Ludo Brands Note Edited: 0058502
2012-04-15 18:04 Ludo Brands Note Added: 0058625
2012-04-16 00:13 Mattias Gaertner Fixed in Revision => 36802
2012-04-16 00:13 Mattias Gaertner Note Added: 0058636
2012-04-16 00:13 Mattias Gaertner Assigned To => Mattias Gaertner
2012-04-16 00:13 Mattias Gaertner Status confirmed => resolved
2012-04-16 00:13 Mattias Gaertner Resolution open => fixed
2012-04-16 10:47 Ludo Brands Status resolved => closed