How to use an ActiveX control

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use an ActiveX control

Maxim Friedental
We've spend several hours to find how to use a third-party ActiveX control
in a Dolphin application. That's because the lack of documentation. I'd like
to document it here for other developers who could google the newsgroup
searching an answer.

If you need to make a simple demo of your GUI and want to use an ActiveX
control:
1. Install the control on your system as appropriate.
2. In the View Composer open a Resource Browser, find there the
AXControlSite and drop it on your form.
3. Doubleclick the aspect progId in the Published Aspect Inspector and
choose your ActiveX control from the list.
4. At that point you should see the control displayed in your form.
5. To change the properties of the control doubleclick the 'AXControlSite'
in the Published Aspect Inspector (that is the root of all aspects in the
tree). You should see the property sheet provided by the ActiveX control.

So if all you need is a GUI demo you can do it just as quick as in VB. And
without any programming.

But if you want to manipulate the control programmatically, you must do
more:
6. Start ActiveX Component Wizard and click Browse.
7. Choose your ActiveX control from the list.
8. Click "Next" two times, then click "Generate" and "Finish".
9. Make a new subclass of the AXControlSite. Define the method
defaultProgId. You can copy and paste the progId from the Published Aspect
Inspector, if you did the step 3. You can also find it in the caption of the
AX Control Browser.
10. Execute 'MyAxControl makeResource: 'Default view' inClass: MyAxControl'.
11. Write method wrappers for interesting properties and methods of the
ActiveX control. The main COM interface of the control is in the
controlDispatch aspect of your view.


Reply | Threaded
Open this post in threaded view
|

Re: How to use an ActiveX control

Carsten Haerle
Andy,

please include this in the documentation in the next release.

One more reason to generate the Smalltalk code is the problem with property
setters in IDispatch in general:

If there is a property named X one can set and get property with the
getProperty/setProperty-Methods. One can also read a property by just
sending #X but one cannot set a property by sending #X: (when the code is
not generated). This is because the parameter for property setting must be a
"named parameter" whereas for a standard method call it must be a
"positional parameter". Unfortunately Smalltalk cannot distinguish between
method calls and properties access.

Interestingly VisualBasic can also not distinguish between a method call and
a property get (Syntax "object.X" can me a method without parameters or a
property get), so IDispatch supports this, and it also works in Smalltalk.
However for property setting VisualBasic has a special syntax ("object.X =
y"), so VisualBasic knows the difference here. The only way for Smalltalk to
distingush would be to evaluate the type library if there is one.

Regards

Carsten Haerle

"Maxim Friedental" <[hidden email]> schrieb im Newsbeitrag
news:be998v$2je99$[hidden email]...
> We've spend several hours to find how to use a third-party ActiveX control
> in a Dolphin application. That's because the lack of documentation. I'd
like

> to document it here for other developers who could google the newsgroup
> searching an answer.
>
> If you need to make a simple demo of your GUI and want to use an ActiveX
> control:
> 1. Install the control on your system as appropriate.
> 2. In the View Composer open a Resource Browser, find there the
> AXControlSite and drop it on your form.
> 3. Doubleclick the aspect progId in the Published Aspect Inspector and
> choose your ActiveX control from the list.
> 4. At that point you should see the control displayed in your form.
> 5. To change the properties of the control doubleclick the 'AXControlSite'
> in the Published Aspect Inspector (that is the root of all aspects in the
> tree). You should see the property sheet provided by the ActiveX control.
>
> So if all you need is a GUI demo you can do it just as quick as in VB. And
> without any programming.
>
> But if you want to manipulate the control programmatically, you must do
> more:
> 6. Start ActiveX Component Wizard and click Browse.
> 7. Choose your ActiveX control from the list.
> 8. Click "Next" two times, then click "Generate" and "Finish".
> 9. Make a new subclass of the AXControlSite. Define the method
> defaultProgId. You can copy and paste the progId from the Published Aspect
> Inspector, if you did the step 3. You can also find it in the caption of
the
> AX Control Browser.
> 10. Execute 'MyAxControl makeResource: 'Default view' inClass:
MyAxControl'.
> 11. Write method wrappers for interesting properties and methods of the
> ActiveX control. The main COM interface of the control is in the
> controlDispatch aspect of your view.
>