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

B1DE / PrintEvent ..

I am trying to think of a way to capture the output from a document print ( a sales invoice) so that i can do some additional processing on a subset of the printed items (export them to an external file) . I am using B1DE to create my application and the event handlers but i'm having a a problem with the printEvent - namely where to put it and how to name it ? I can add a handler to the "ok" button on the Document print dialog but this receives an ItemEvent and i'm not sure that this can or should be cast to a printEvent .. Is it just a case of capturing the print event from the main menu and doing all my processing within there ? I'm hoping the printEvent will hold the necessary info for me to extract what i want . In the main class B1DE generates a number of event handlers (eg OnShutDown(), OnCompanyChange() ...) that i can overide but i dont see anything related to printEvents ..

How can I handle this within B1DE framework ?

Thanks ..

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Apr 08, 2008 at 07:51 AM

    Hi Rob,

    i don't know b1de but why you don't put this vb.net code

    Private Sub SBO_Application_PrintEvent(ByRef printEventInfo As SAPbouiCOM.printEventInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.PrintEvent
    
    End Sub
    

    in the class where you have the other event handlers ?

    regards

    David

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for the reply .. I did try this within the main addon event handling application class generated by B1DE ..

      In the constructor ..

      
       public Sample() {
                  
                  // ADD YOUR INITIALIZATION CODE HERE	...
      
                  // Add an event handler for the print event  ... 
      
                  B1Connections.theAppl.PrintEvent += new  SAPbouiCOM._IApplicationEvents_PrintEventEventHandler(myPrintEventHandler);
              }
      
      

      and this for the event handler in the same class ..

      
        private void myPrintEventHandler(ref SAPbouiCOM.PrintEventInfo pVal, out bool BubbleEvent)
              {
                  BubbleEvent = true;
                  B1Connections.theAppl.MessageBox("The Print event has been sent", 1, "Ok", "", "");
              }   
      
      

      But the code is never called .. Would you happen to know if this is the correct way to add this handler

      via B1DE ?

      As an aside i tried one of the samples provided in the SDK(2007A) but with a couple of small amendments ..

      I used the "CatchingEvents" example but added the following 2 lines to register additional listeners ..

      
       // Try these additional events  ..  
      
              SBO_Application.PrintEvent += new SAPbouiCOM._IApplicationEvents_PrintEventEventHandler(SBO_Application_PrintEvent);
             
              SBO_Application.ReportDataEvent += new SAPbouiCOM._IApplicationEvents_ReportDataEventEventHandler(SBO_Application_ReportDataEvent);
      
      

      with this handling code ..

      
          private void SBO_Application_PrintEvent(ref SAPbouiCOM.PrintEventInfo pVal, out bool BubbleEvent){
              BubbleEvent = true;
              SBO_Application.MessageBox("The Print event has been sent", 1, "Ok", "", "");    
          }
      
          private void SBO_Application_ReportDataEvent(ref SAPbouiCOM.ReportDataInfo pVal, out bool BubbleEvent)
          {
              BubbleEvent = true;
              SBO_Application.MessageBox("The ReportData event has been sent", 1, "Ok", "", "");    
          }
      
      

      These events didn't fire as expected either - they didn't fire at all . Can anyone see a problem with my implementation or my interpretation of the event handling ? ..

      Edited by: Rob Morning on Apr 8, 2008 2:59 PM

  • Posted on Apr 09, 2008 at 09:08 AM

    Hi Rob,

    The print events can be added to a form in B1DE wizard.

    If you right click on the Form step (last step of the wizard) you have the possibility to select the PRINT and PRINT_DATA events and then the code for them will be autogenerated in the corresponding B1DE form class.

    Is that what you are looking for?

    PS: Your code is also correct in the case you want to manage the print event for all the forms.

    What must be blocking your code are the filters (automatically set by B1DE when your addon is loaded). Just take the current filters in your code + add one extra filter for the PRINT event (without specifying any form), it should work. Do it after the new of your main addon class.

    Hope it helps

    Trinidad.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 14, 2008 at 10:13 AM

    Thanks Trinidad, that worked fine

    Add a comment
    10|10000 characters needed characters exceeded

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.