cancel
Showing results for 
Search instead for 
Did you mean: 

Hanling application events in Cpp

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

See

Ribeiro Santos

Former Member
0 Kudos

Hy Ty and Riberio!

Thanks for yours helps.

The Visual Basic application event handling is absolutely clear. And work it. But Basic and Cpp event handling (declare) has serious different. My basic problem is that i cant find the event pointer which is not necessary (declare) in Basic (just the application object with WithEvents) (simplistic).

Riberio, the link which you send is pointed to SAP's Calculator sample. I use this to handle Menu and Item events. That work well. But ive not found application event handling in this sample. Id like to handling sbo exit, language changed, etc...

May i need to handling this event with Item event? Or have an another way? Or im blind? Or i dont know...

Thanks.

Ciao!

Lanchèl.

Former Member
0 Kudos

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!