1. Kari Paukku
  2. PowerBuilder
  3. Monday, 28 January 2019

Hi,

I have created a small ActiveX control using Visual Studio 2015. Attaching that to a PB window is ok and I can execute the ActiveX functions from the PB window using ole_1.object.MyCustomFunction().

I have also programmed some events and as the ActiveX is based on a 3rd party control (DevExpress) it has its own events. I can refer in PB code to these events (ole_1.object EVENT MyEvent() but I can't see the event in the Events DropDownList for the OLE object.

Reading the PB documentation, if I understood it correctly, the events should be merged.

Using events of the ActiveX control

An ActiveX control has its own set of events, which PowerBuilder merges with the events for the custom control container. The ActiveX control events appear in the Event List view with the PowerBuilder events. 

https://www.appeon.com/support/documents/appeon_online_help/pb2018/application_techniques/ch21s04.html

I have tested this using PB 2017 and PB2018 and the behaviour is the same - no events visible.

Would anyone have any idea what I'm doing wrong or a small example that has a custom ole control with custom events programmed into it? 

Thanks,

ktp

 

 

 

Who is viewing this page
Kari Paukku Accepted Answer Pending Moderation
0
Votes
Undo

Bruce,

did find and downloaded your TiffViewer example. Using that I can see the custom events you created (e.g. DblClick) in PB.

Will use this and try to implement my code using this as a basis.

Thanks,

ktp

Comment
There are no comments made yet.
  1. Tuesday, 29 January 2019
  2. PowerBuilder
  3. # 1
Kari Paukku Accepted Answer Pending Moderation
0
Votes
Undo

Bruce,

I have used the Microsoft InteropForms Toolkit template as a starting point.

Reading your reply I added


Public Interface InteropUserControl1
     Function MyFunction() As String
     Sub MySub()
     Event MyEvent()
End Interface

to the control and now I can see the above in PB's Browser. Here is the code added 

But when I place the control to PB, these above three things are not visible.

I'm not that good with programming these, so it may well be that I have missed something.

If there would be a simple application out there, that would be very helpful as I could then just copy it and see that it works and then use as it a basis for my control.

Thanks,

Kari

 

Attachments (1)
Comment
There are no comments made yet.
  1. Tuesday, 29 January 2019
  2. PowerBuilder
  3. # 2
Bruce Armstrong Accepted Answer Pending Moderation
0
Votes
Undo

Does your control implement InterfaceType(ComInterfaceType.InterfaceIsIDispatch) and are you defining DispID values for the events you are exposing through that?

Comment
There are no comments made yet.
  1. Monday, 28 January 2019
  2. PowerBuilder
  3. # 3
Kari Paukku Accepted Answer Pending Moderation
0
Votes
Undo

Chris,

yes, I did but the whole Event section appears to be missing for my control, other 3rd party controls do have it.

I'm thinking that I'm missing something from the Visual Studio (VB.Net) program/project used to create the ActiveX/Ole Object, something where one declares the events for the object.

Now I have those just as 

Public Class InteropUserControl
    Public WithEvents MyEvents As InteropUserControl

    Public Event MyEvent()

The function MyCustomFunction() is neither visible on the OLE Browser, but still can be called from PB using ole_1.object.MyCustomFunction(), so it's there. I also increase the assembly version number everytime to make sure that I'm working with the latest version of the Ole control.

It may be that I have something configured wronly in the VB.Net project. The project's application type is Class Library,

The "Register for COM interop" is set to yes (selected).

The problem is that without having the control's events visible in PB, I dont think I have a way to call PB from the OleControl.

ktp

 

 

 

 

Attachments (1)
Comment
There are no comments made yet.
  1. Monday, 28 January 2019
  2. PowerBuilder
  3. # 4
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi Kari;

   Did you try & use the PB IDE's "Object Browser" for this?

FYI:  https://www.appeon.com/support/documents/appeon_online_help/pb2018/application_techniques/ch21s07.html

HTH

Regards ... Chris

Comment
There are no comments made yet.
  1. Monday, 28 January 2019
  2. PowerBuilder
  3. # 5
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.