Hy all!
Ive written an application in VCpp v6 prof. based on SAP's cpp calculator sample. And id like to handling the sbo application's events (like: when sbo exit i need to terminate my add-on). But unfortunately there is no application event handling in calculator sample. Additionally, i cant find the IApplicationEventPtr object (SDK 6.5) to create my handling...
So, have anyone some idea how could i handling this events in C++?
Thanks.
Ciao!
Lanchèl.
I am sorry I don't have source code for you in c++. I am sure you have looked at the vb.net source code example in "Catching Events". It is usually located in SAP Manage\SAP Business One SDK\Samples\COM UI\VB.NET\02.CatchingEvents
The gist is this:
You need to declare a sub that handles SBO_Application_ItemEvent
It should accept the following parameters
ByVal FormUID As String
ByRef pVal As SAPbouiCOM.ItemEvent
ByRef BubbleEvent As Boolean
Description
Occurs when an UI event (click, form load, etc.) takes place on form (or its aggregates) in the SAP Business One application. Use this event to handle UI events on forms and items.
Syntax
Public Event ItemEvent( _
ByVal FormUID As String, _
ByVal pVal As ItemEvent, _
ByRef BubbleEvent As Boolean _
)
Parameters
FormUID
A string specifying the unique ID of the form on which the event occurs.
pVal
An ItemEvent object holding all the properties that describe the event that is taking place.
BubbleEvent
A boolean value specifying how the application will handle this event. Available only when ItemEvent.BeforeAction=True.
True - Default. The application continues processing this event regularly after returning from the event handler.
False - The application stops handling this event.
So, in a vb.net application, the way you "catch events" is write your own event handling sub that is declared something like this:
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
End Sub
You then go on to evaluate the parameters and take action based on their values.
Sorry I can't give you some c++. I hope some of this helped.
Good luck!
Add a comment