ActiveX question

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

ActiveX question

Gary Overgard
I posted before on how to get a grid view and was shown a quite nice pattern
/ article by Mikael Svane on how to wrap activeX components.
http://svane.swiki.net/2
So I tried wrapping the BeeGrid component using the Dolphin ActiveX
component Wizard & Mikaels pattern.  When I try to reference the component
using
   dispControl := self controlUnknown queryInterface: BeeGrid10IsgGrid.
dispControl is nil.
  If I swap in:
dispControl := BeeGrid10IsgGrid createObject: BeeGrid10IsgGrid clsid progID.
   dispControl is not nil, but what should display in the Shell window is
not there, there is simply the text for "Active X Control Site ..."  If I
look at the BeeGrid control using Dolphins ActiveX control browser (nice!) I
get the default grid with a couple of columns & a couple of rows.  One
interesting difference between the working ActiveX control browser is that
its "Window' ivar is non zero,  whereas in my dispControl inspecting the
"Window" ivar it is 0.

I was simply going to look at the code in the ActiveX control browser to
look for differences, but it is all hidden.  I also tried unregistering &
reregistering the control, and starting with a fresh image.

The questions are:
    why does the controlUnknown queryInterface:  not work,
        (tracing the code:  hresult := self QueryInterface: anInterfaceClass
iid ppvObject: pUnk.
               --hresult comes back less than 0 which is an error condition)
  & can I even use the alternative line?

Any tips greatly appreciated,
--Gary Overgard


Reply | Threaded
Open this post in threaded view
|

Re: ActiveX question

Louis Sumberg-2
Gary,

FWIW, I tried using Mikael's pattern the other day when he posted it and it
worked fine for me.  It seems like a fine pattern for ActiveX controls
(though I did run into a problem with dynamically adding ActiveX controls,
but I don't think that's what you're dealing with).  I do notice that my
code for #connectInterface has BeeGridOLEDB10IsgGrid, whereas you have
BeeGrid10IsgGrid, but that might just be that you generated the wrapper
classes with non-default names.  I'm using Dolphin 4 and if I remember
right, you're using version 2, so that might be an issue.  I don't have an
answer to your direct question, but you might want to try the following in a
workspace:

shell := Shell show.
shell view layoutManager: ProportionalLayout new.
shell view addSubView: AXControlSite new.
site := shell view firstSubView.
site progId: 'StingaBeeGridOLEDB10.Grid'.
grid := site controlDispatch.
"Test properties and methods"
grid caption: 'My Test Grid'.
grid groupByBoxVisible: false.
grid columns removeAll: false.
(grid columns add: 'Col. 1') width: 1850.
(grid columns at_: 1) style format: 'Currency'.
grid dataRowCount: 0.
grid allowAddNew: true.
"Test event handling"
site when: #ColHeadClick: send: #bell to: Sound.
"Close shell then evaluate these two lines to cleanup."
site destroy.
site := nil.

-- Louis


Reply | Threaded
Open this post in threaded view
|

Re: ActiveX question

Mikael Svane-2
Gary and Louis,

Perhaps I have found a possible explanation. The BeeGrid control appears as
two different controls in the list of the AX Control Wizard. Gary, it seems
from the code that you sent me that you have generated the interfaces of the
control named "Stinga BeeGrid Control 1.0 (ICursor)", while Louis has used
the "Stinga BeeGrid Control 1.0 (OLEDB)" control. From BeeGrid's
documentation:

"There are two different BeeGrid controls. The first one (BEEGD10.OCX)
supports older ICursor (DAO) data sources and the second one (BEEGDO10.OCX)
supports OLEDB (ADO) based data source. Both controls supports unbound and
virtual data modes."
Perhaps something prevents the ICursor control from working properly in
Dolphin (at least using my pattern)?



Best regards,

Mikael Svane

[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: ActiveX question

Gary Overgard
In reply to this post by Louis Sumberg-2
Louis,
  I tried the below code (after importing the BeeGridOLEDB) and it works
just fine.  I then tried plugging in the different class name in
#connectInterface, but it still ends up nil.  If you did a wrapper on
BeeGrid with Mikael's pattern I would be interested in seeing it, to find
out where/if I have gone astray.

  This was done with an evaluation version of Dolphin 4 under Win2K,
although now with the offer of free upgrade for 5 I just need to figure out
which edition to purchase.

Thanks for the example, I will simply modify my code to use this way of
getting the control.

Best Regards,
   Gary Overgard

"Louis Sumberg" <[hidden email]> wrote in message
news:a1ibcc$j9g$[hidden email]...
> Gary,
>
> FWIW, I tried using Mikael's pattern the other day when he posted it and
it
> worked fine for me.  It seems like a fine pattern for ActiveX controls
> (though I did run into a problem with dynamically adding ActiveX controls,
> but I don't think that's what you're dealing with).  I do notice that my
> code for #connectInterface has BeeGridOLEDB10IsgGrid, whereas you have
> BeeGrid10IsgGrid, but that might just be that you generated the wrapper
> classes with non-default names.  I'm using Dolphin 4 and if I remember
> right, you're using version 2, so that might be an issue.  I don't have an
> answer to your direct question, but you might want to try the following in
a

> workspace:
>
> shell := Shell show.
> shell view layoutManager: ProportionalLayout new.
> shell view addSubView: AXControlSite new.
> site := shell view firstSubView.
> site progId: 'StingaBeeGridOLEDB10.Grid'.
> grid := site controlDispatch.
> "Test properties and methods"
> grid caption: 'My Test Grid'.
> grid groupByBoxVisible: false.
> grid columns removeAll: false.
> (grid columns add: 'Col. 1') width: 1850.
> (grid columns at_: 1) style format: 'Currency'.
> grid dataRowCount: 0.
> grid allowAddNew: true.
> "Test event handling"
> site when: #ColHeadClick: send: #bell to: Sound.
> "Close shell then evaluate these two lines to cleanup."
> site destroy.
> site := nil.
>
> -- Louis
>
>


Reply | Threaded
Open this post in threaded view
|

Re: ActiveX question

Andy Bower
Gary,

> This was done with an evaluation version of Dolphin 4 under Win2K,
> although now with the offer of free upgrade for 5 I just need to figure
out
> which edition to purchase.

This explains why you were seeing some methods with hidden source code. Such
methods are only present in the evaluation edition; the full version
contains source code for the entire image.

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: ActiveX question

Louis Sumberg-2
In reply to this post by Mikael Svane-2
Mikael:  To what you said I'll add that there's a third choice in the list
that the Wizard brings up -- the OCA.  My experience is don't generate
classes off the OCA, use the OCX.

Gary:  I sent you separately a pac file.  Hopefully, that'll work.


Reply | Threaded
Open this post in threaded view
|

Re: ActiveX question

Gary Overgard
In reply to this post by Louis Sumberg-2
I found the original error, which could be useful for others.

When I went into the resource editor, and looked at the progID, it had what
appeared to be garbage characters, whereas what it needed was:
'StingaBeeGridOLEDB10.Grid'

After changing this, the original worked.

The original was probably created from the ocx I should not have used.

--Gary