Skip to Content
author's profile photo Former Member
Former Member

Hanling application events in Cpp

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++?




Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2005 at 03:31 PM

    I am sorry I don't have source code for you in c++. I am sure you have looked at the 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


    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.


    Public Event ItemEvent( _

    ByVal FormUID As String, _

    ByVal pVal As ItemEvent, _

    ByRef BubbleEvent As Boolean _




    A string specifying the unique ID of the form on which the event occurs.


    An ItemEvent object holding all the properties that describe the event that is taking place.


    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 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
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2005 at 03:42 PM




    Ribeiro Santos

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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...




Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.