VBA_Collection

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

VBA_Collection

Scott D
I have the following method being generated by the Active X Component
Wizard in Dolphin 5.1.4.  Everything has been working great so far.
But now I have a need to call the following method.  What is a
VBA_Collection?  How do I create an object to pass in as the argument?

putref_ItemStatus: arg1
        "Private - Set the value of the 'ItemStatus' property of the object
wrapped by the
         receiver to the <VBA_Collection*> argument, arg1.

                HRESULT __stdcall ItemStatus(
                        [in] _Collection* arg1);"

        <virtual stdcall: hresult 8 VBA_Collection*>
        ^self invalidCall


Thanks,
Scott


Reply | Threaded
Open this post in threaded view
|

Re: VBA_Collection

Bill Schwab-2
Scott,

> I have the following method being generated by the Active X Component
> Wizard in Dolphin 5.1.4.  Everything has been working great so far.
> But now I have a need to call the following method.  What is a
> VBA_Collection?  How do I create an object to pass in as the argument?

According to the archives, you might find that you need to create it like
any other COM object.  However, the last mention I find is from 1999, which
has me suspicious.  You might also look for SAFEARRAY, though I have no idea
whether the two are interchangeable (that might be a little too OO for VB in
particular).

Sorry I can't be of any real help.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: VBA_Collection

Blair McGlashan
In reply to this post by Scott D
"Scott D" <[hidden email]> wrote in message
news:[hidden email]...
> I have the following method being generated by the Active X Component
> Wizard in Dolphin 5.1.4.  Everything has been working great so far.
> But now I have a need to call the following method.  What is a
> VBA_Collection?

Well it will be another COM object. Remember that any identifier referenced
in a method generated by the analyzer must either be an alias for a built in
type (e.g. sdword), or it will be the name of a class that is either
pre-existing, or which the analyzer itself had to generated. Therefore you
should be able to find the VBA_Collection class easily enough. If you didn't
specifically ask for it to be created, it may be a stub, in which case
you'll need to go back into the AX Component wizard, find the entry in the
types list in the last step, and generate it.

>...How do I create an object to pass in as the argument?

At the risk of sounding flippant, try using #new, i.e.

    collection := VBA_Collection new.

Then use the class browser to locate VBA_Collection (e.g. by pressing Ctrl+B
on the above line in a workspace), and work out how to populate the
collection.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: VBA_Collection

Scott D
I did find the class that the analyzer itself had to generated.  But
when I do 'VBA_Collection new', I get a walkback 'HRESULT Error: Class
not registered (FACILITY_ITF)'.  When looking at the class
VBA_Collection, there are no class or instance methods.

The analyzer did generate the following 2 getter methods which work
just fine.

1.  (private) get_ItemStatus: arg1
        "Private - Get the value of the 'ItemStatus' property of the
receiver.

                HRESULT __stdcall ItemStatus(
                        [out, retval] _Collection** arg1);"

        <virtual stdcall: hresult 9 VBA_Collection**>
        ^self invalidCall

2.  (public) itemStatus
        "Answer the <VBA_Collection> value of the 'ItemStatus' property of
the receiver."

        | answer |
        answer := VBA_Collection newPointer.
        self get_ItemStatus: answer.
        ^answer asObject

The public setter method that was generated is as follows but does not
wrap the creation of the active type for the argument like some of the
other generated setters.

setItemStatus: arg1
        "Set the 'ItemStatus' property of the receiver to the
<VBA_Collection*> value of the argument."

        self putref_ItemStatus: arg1



"Blair McGlashan" <[hidden email]> wrote in message news:<4067f042$[hidden email]>...

> "Scott D" <[hidden email]> wrote in message
> news:[hidden email]...
> > I have the following method being generated by the Active X Component
> > Wizard in Dolphin 5.1.4.  Everything has been working great so far.
> > But now I have a need to call the following method.  What is a
> > VBA_Collection?
>
> Well it will be another COM object. Remember that any identifier referenced
> in a method generated by the analyzer must either be an alias for a built in
> type (e.g. sdword), or it will be the name of a class that is either
> pre-existing, or which the analyzer itself had to generated. Therefore you
> should be able to find the VBA_Collection class easily enough. If you didn't
> specifically ask for it to be created, it may be a stub, in which case
> you'll need to go back into the AX Component wizard, find the entry in the
> types list in the last step, and generate it.
>
> >...How do I create an object to pass in as the argument?
>
> At the risk of sounding flippant, try using #new, i.e.
>
>     collection := VBA_Collection new.
>
> Then use the class browser to locate VBA_Collection (e.g. by pressing Ctrl+B
> on the above line in a workspace), and work out how to populate the
> collection.
>
> Regards
>
> Blair


Reply | Threaded
Open this post in threaded view
|

Re: VBA_Collection

Blair McGlashan
"Scott D" <[hidden email]> wrote in message
news:[hidden email]...
> I did find the class that the analyzer itself had to generated.  But
> when I do 'VBA_Collection new', I get a walkback 'HRESULT Error: Class
> not registered (FACILITY_ITF)'.  When looking at the class
> VBA_Collection, there are no class or instance methods.
> ...

>From my last posting: "If you didn't
specifically ask for it to be created, it may be a stub, in which case
you'll need to go back into the AX Component wizard, find the entry in the
types list in the last step, and generate it."

If it has no methods, then it is a stub. It may be that VBA_Collection was
not one of the types in the type library you generated from, but is an
"import" from another library. You'll need to locate this cross referenced
library on the AX Component Wizard's first page. Based on the prefix that
the analyzer has used, it would appear to be the VBA library (i.e. Visual
Basic for Applications).  It would have appeared in the library list when
you generated from the original library. I hope this is now clear.

>....
> The public setter method that was generated is as follows but does not
> wrap the creation of the active type for the argument like some of the
> other generated setters.
>
> setItemStatus: arg1
> "Set the 'ItemStatus' property of the receiver to the
> <VBA_Collection*> value of the argument."
>
> self putref_ItemStatus: arg1

No automatic wrapping is appropriate - the argument must be an instance of
the VBA_Collection class. It may be that you want to add some of your own
helper methods to allow the status to be set from a Smalltalk collection (or
you may want to provide a Smalltalk <collection> wrapper around
VBA_Collection, examples in the image are ADOCollection and DOMNodeList),
but automatically generating these would, in general, require a level of
intelligence that is beyond what is possible based on the limited
information in the type library.

Regards

Blair