ActiveX sample and news of A21

Started by Fred Tomke, February 01, 2010, 07:37:43 AM

Previous topic - Next topic

Fred Tomke

Hello, Owen, I'm not sure whether to post as a reply on sourceforge.net or better here. That's why I do it here.

I'm going to build up a ActiveX sample for OpenDCL. I hope that I only used standard controls so I hope everybody can load and show the project. While playing around with the controls I discovered some problems which I don't know whether they are bugs or not.

I post them without any order of importance.


  • Normally I can get the event function name of an activated event by calling something like (dcl_control_getproperty oControl "Clicked"). To avoid globale variables I tried to get the EnterCell event function name of the FlexGrid control in the project. It returned nil and I cannot set another function name at runtime. I don't know whether it's a bug or not.
  • Have a look at the function statusbar_text. There you can see a line  (dcl_AxObject_Get oPanel nil "Text"). If I call only (dcl_AxObject_Get oPanel "Text") instead then I get an error of too less arguments. I've found out that another argument must passed between control object and property name. The syntax in the control browser does not show this additional argument. Unfortunately, changing the text of the second panel has no effect. Maybe it is caused by the additional argument.
  • Some properties seem to be read-only although they're officially not. So I tried to make the vertical scrollbar of the richtext control visible. Maybe someone else has much more luck.
  • The prompting when a control fails to get imported should be improved. I have tried to import an instance of the HHCtrl component. After drawing a rectangle to locate the control nothing happens. I do remember a message in earlier releases that some controls are not desgined to be placed on a form. Otherwise the OpenDCL developer does not know why this happens (or better: does not happen).
  • In my first idea to such a ActiveX sample I wanted to show pdf and dwf files in a form. But unfortunately, OpenDCL editor crashed when locating an instance of dwf viewer component. Then I tried Adobe Reader control. When loading the form in AutoCAD, AutoCAD crashed immediately. But I remember a small sample in this forum, could be shown succesfully. Maybe both crashes depended on the existing ActiveX controls of the form where they should be placed at. I didn't investigate furthermore. Maybe somebody else will do that.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Thanks Fred, this is exactly the kind of feedback I was hoping for! I will go through your list as time permits and respond when I have someting to add.

owenwengerd

I did a quick test with the HHCtrl control. The problem is that the exact reason for the failure is not returned from the MFC function that handles control creation. It does display some debug utput when running under the debugger:

SetClientSite on OLE control {ADB880A6-D8FF-11CF-9377-00AA003B7A11} failed.
>>> Result code: 0x80004002

This might indicate that the control is not happy with the window where it is being created, but that's just a guess. In other cases of failure, the reasons could be even more obscure. There could be a generic error message, but its only benefit would be to verify that control creation failed for some unknown reason.

Fred Tomke

Owen, thank you for your reply. I'm glad that my post matches your desires :) .

Meanwhile I was searching for a reference sample you've mentioned in you sourceforge post. And I have found a method:
Item method of the IButtons collection of the toolbar. But the control browser show a very special data type: I also found a 'Variant but in this case there is a single ' .

There is another thing left. Does anybody have experiences in linking a imagelist control to a control's imagelist property? My toolbar shows no images because I didn't linked a imagelist yet. Can I link it also at design time or only at runtime or even no time?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Quote from: owenwengerd on February 01, 2010, 08:33:54 AM
There could be a generic error message, but its only benefit would be to verify that control creation failed for some unknown reason.

Owen, it's just like in a marriage: communication is everything  :D . It's better to say that a control cannot be placed just before someone is coming up thinking it's a bug because nothing happens.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Quote from: Fred Tomke on February 01, 2010, 08:45:49 AM
Owen, it's just like in a marriage: communication is everything  :D . It's better to say that a control cannot be placed just before someone is coming up thinking it's a bug because nothing happens.

I agree that feedback would be good. I'm not sure what form it should take, though. A modal message box would irritate me. I'd prefer a less intrusive form of feedback.

owenwengerd

Quote from: Fred Tomke on February 01, 2010, 07:37:43 AM
  • Normally I can get the event function name of an activated event by calling something like (dcl_control_getproperty oControl "Clicked"). To avoid globale variables I tried to get the EnterCell event function name of the FlexGrid control in the project. It returned nil and I cannot set another function name at runtime. I don't know whether it's a bug or not.

That's a bug, now fixed for the next build.

owenwengerd

Quote from: Fred Tomke on February 01, 2010, 07:37:43 AM
Have a look at the function statusbar_text. There you can see a line  (dcl_AxObject_Get oPanel nil "Text"). If I call only (dcl_AxObject_Get oPanel "Text") instead then I get an error of too less arguments. I've found out that another argument must passed between control object and property name. The syntax in the control browser does not show this additional argument. Unfortunately, changing the text of the second panel has no effect. Maybe it is caused by the additional argument.

There was a bug in the argument processing code that caused it to skip an argument. That is now fixed for the next build. The oher problem is unrelated. I don't know why, but the control returns an error when attempting to set any properties (as evidenced by the dcl_AxObject_Put function returning NIL). The error is "parameter not found", but as best I can tell, everything is correct when the Invoke function is called.

owenwengerd

Quote from: Fred Tomke on February 01, 2010, 07:37:43 AM
Some properties seem to be read-only although they're officially not. So I tried to make the vertical scrollbar of the richtext control visible. Maybe someone else has much more luck.

I had no luck making the property writeable (it retuns an exception saying that it's read-only -- probably because they don't allow that property to be changed after the control is visible), but while investigating this problem I figured out how to get the status bar panels working.

owenwengerd

Quote from: Fred Tomke on February 01, 2010, 08:37:42 AM
Meanwhile I was searching for a reference sample you've mentioned in you sourceforge post. And I have found a method:
Item method of the IButtons collection of the toolbar. But the control browser show a very special data type: I also found a 'Variant but in this case there is a single ' .

This is now fixed for the next build.

Quote from: Fred Tomke on February 01, 2010, 08:37:42 AM
There is another thing left. Does anybody have experiences in linking a imagelist control to a control's imagelist property? My toolbar shows no images because I didn't linked a imagelist yet. Can I link it also at design time or only at runtime or even no time?

It doesn't look like there is any way to set that at design time. If there was some certain way to determine programmatically that the property expects an image list COM object, I could add code to create the image list at design time via the property wizard, but unlike fonts and colors, there doesn't seem to be any standard way to determine that for the e list property.