Loading screen painter form via a menu event.

Hi,
In my application, I am trying to get my screen painter form (.srf) to display through a menu event. The thing is when I click on the menu the first time it loads okay but when I close it and try to open it by clicking it again nothing happens. I am doing it as below.
Anyone have any ideas?
private void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
            BubbleEvent = true;
            try
                if ((pVal.MenuUID == "vdetails") & (pVal.BeforeAction == false))
                    Form_1();
            catch (Exception ex)
                SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");
private void Form_1()
            string strTmp = "vclMgt.srf";
            LoadFromXML(ref strTmp);
            oForm = SBO_Application.Forms.Item("frmVMGT");
private void LoadFromXML(ref string FileName)
            System.Xml.XmlDocument oXmlDoc = null;
            oXmlDoc = new System.Xml.XmlDocument();
            string sPath = null;
            sPath =  System.IO.Directory.GetParent(System.IO.Directory.GetParent(Application.StartupPath).ToString()).ToString();
            oXmlDoc.Load(sPath + @"\" + FileName);
            string strXML = oXmlDoc.InnerXml.ToString();
            SBO_Application.LoadBatchActions(ref strXML);

Hi Binita,
Thank you for your suggestion but it hasnt worked, the form doesnt display and no errors appear.
This is how i've done it in C#
private void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
            BubbleEvent = true;
            try
                if ((pVal.MenuUID == "vdetails") & (pVal.BeforeAction == false))
                    foreach (SAPbouiCOM.Form oForm in SBO_Application.Forms)
                        if (oForm.UniqueID == "frmVMGT")
                            found = true;
                            MessageBox.Show("Found");
                    if (found == true)
                        SBO_Application.Forms.Item("frmVMGT").Select();
                    else
                        LoadFromXML("vclMgt.xml");
            catch (Exception ex)
                SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");
Where 'found' is global.
I saw a similar issue someone else had but it wasnt resolved.
Any more ideas?

Similar Messages

  • Connecting a Screen Painter From to a Menu

    I have created a form using the screen painter.
    I have created  a new menu entry for this form.
    I have added the screen painter form into my solution.
    I am catching the new menu item click.
    what i do not have is the code to activate the form.

    Try this code Dror
    If (pVal.MenuUID = "U_xxx") And (pVal.BeforeAction = True) Then
    Dim oXmlDoc As Xml.XmlDocument
            oXmlDoc = New Xml.XmlDocument
            Dim sPath As String
            sPath = IO.Directory.GetParent(System.Windows.Forms.Application.StartupPath).ToString
            Try ' If there's no file then the looding will fail
                oXmlDoc.Load(sPath & "\" & "FileName")
            Catch ' Loading  failed
                SBO_Application.MessageBox( " File not found")
                End
            End Try
            SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)
                oForm = SBO_Application.Forms.Item("FileUid")
            oForm.Visible = True
      End If
    Selin

  • Screen painter form

    is possible to use a screen painter form in the wizard that create user defined object?
    and then replace the new form in the user menu?
    regards

    Vasco,
    If I understand what you are asking ... the answer is no.  The forms that is generated when registering a UDO is part of the UDO wizard as you have stated.  There is not a way to interject a form created by the Screen Painter.
    Sorry ...
    Eddy

  • Publishing a screen painter form with full code

    Hi Dear;
    could you publish a sample of screen painter form with the coding that you use in it please?
    bets regards;

    Hi,
    Take a look at the following sample provided by SAP in the following path C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\04.WorkingWithXML\2003.
    In the above sample a form designed in Screen painter (MySimpleForm.xml) is used with the code. U can open the MySimpleForm.xml in screen painter.
    Vasu Natari.

  • Applicaiton form hangs when trying to make C# form visible from menu event

    I have a MDI windows app, running as an addon on Verion 2007A
    The applicaion is written in C# ( VS 2005)
    I am a newbee to C# ( VS too ) as well.
    All I want is to display the MDI container form when a menu is clicked. But the windows form hangs forever, and does not show.
    if I try to show the form within Main method then no issues! The problem happens only off the SBO menu event .
    I cannot have the form loaded all the time. so I need the services of the SBO menu click, so a user can open it whenever he wants.
    Note: I can open any other form off the menu click, but that , provided they are not MDI containers and they are opened with ShowDialog(); If I use Show(); then again hangs.
    I tried opening the MDI form in Main method, ( wich of course works) and hide it when not needed. I could hide the form, but when I issued a command myForm.visible = true;  through the SBO menu event, again hangs!
    my applicaion Main function is as follows. The class AA_SBO_MAIN  holds the SBO application events.
    static void Main()
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Classes.AA_SBO_MAIN oSBOMain = null;
                oSBOMain = new Classes.AA_SBO_MAIN(); 
                 Application.Run();        
    the menu event simply does
                  frmMain fm = new frmMain();
                  fm.Visible = true;

    Hi
    I try doing these few steps and it seems to work!  The code is in Visual Basic though!
    Declare the form variable
    Private mMDI As New frmMDI
    In your menu click event enter a code like this
    If mMDI Is Nothing Then mMDI = New frmMDI
    mMDI.Visible = True
    On your startup function do something like this
    Public Sub New()
           mMDI.Show() : mMDI.Visible = False
    End Sub
    And more important ... in the form class comment all the code inside the Dispose method
    and finally do the following
    Private Sub frmMDI_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
            Me.Hide()
    End Sub
    it seems to work for me . Hope it helps you too!

  • Menu Event - Loading srf or xml forms.

    Does anyone have working C# code that loads a form created using screen painter through a menu event?
    When i try loading my xml or srf forms through a menu event, the forms load the first time but when the user clicks on the menu the second time the form doesnt appear. I cannot seem to find a solution to this!!

    Vitor,
    Here is the code:
    private void SBO_Application_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent)
                BubbleEvent = true;
                try
                    if ((pVal.MenuUID == "vdetails") & (pVal.BeforeAction == false))
                            load();
                catch (Exception ex)
                    SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");
    private void load()
                string strTmp = "vclMgt.srf";
                LoadFromXML(ref strTmp);
                oForm = SBO_Application.Forms.Item("frmVMGT");
                oForm.Visible = true;
    private void LoadFromXML(ref string FileName)
                System.Xml.XmlDocument oXmlDoc = null;
                oXmlDoc = new System.Xml.XmlDocument();
                string sPath = null;
                sPath = System.IO.Directory.GetParent(System.IO.Directory.GetParent(Application.StartupPath).ToString()).ToString();
                oXmlDoc.Load(sPath + @"\" + FileName);
                string strXML = oXmlDoc.InnerXml.ToString();
                try
                    SBO_Application.LoadBatchActions(ref strXML);
                catch (Exception ex)
                    SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");

  • Load form created by screen painter

    hello every one,
    i've a problem. What are the steps to be followed to load a form created by screen painter?  might i have any  sample code In order to understand the various phases? thank a lot

    hi
    lorenzo pelati
      first u   create  a  form in   screen painter , nd after save this form , when  u save this form than this fom  extation is  .srf file,   after that  convert this file  to  .xml
      file ,  and after call  this form to   our application ,
    follow this code.........................................
    in this code  newpa.xml     is a one form xml file.
    in this code   SBOFormEditor_13  is a screen painter  form id,
      private void LoadFromXML( ref string FileName ) {
            System.Xml.XmlDocument oXmlDoc = null;
            oXmlDoc = new System.Xml.XmlDocument();
            // load the content of the XML File
            string sPath = null;
            sPath = System.IO.Directory.GetParent( Application.StartupPath ).ToString();     
              sPath = System.IO.Directory.GetParent( sPath ).ToString();
              oXmlDoc.Load( sPath + "
    " + FileName );
            // load the form to the SBO application in one batch
              string sXML = oXmlDoc.InnerXml.ToString();
            SBO_Application.LoadBatchActions(ref sXML);
        private void SaveAsXML( ref SAPbouiCOM.Form Form ) {
            System.Xml.XmlDocument oXmlDoc = null;
            string sXmlString = null;
            oXmlDoc = new System.Xml.XmlDocument();
            // get the form as an XML string
            sXmlString = Form.GetAsXML();
            // load the form's XML string to the
            // XML document object
            oXmlDoc.LoadXml( sXmlString );
            string sPath = null;
            sPath = System.IO.Directory.GetParent( Application.StartupPath ).ToString();
            SBO_Application.MessageBox("sahe ha " + sPath, 1, "OK", "", "");
            // save the XML Document
            oXmlDoc.Save( ( sPath + @"\newpa.xml" ) );
      public   call form() {
            SetApplication();
            string transTemp0 = "newpa.xml";
            LoadFromXML( ref transTemp0 );
                    oForm = SBO_Application.Forms.Item("SBOFormEditor_13");
            // Show the loaded Form
            oForm.Visible = true;
            SaveAsXML( ref oForm );
       fallow this code .

  • 6.7 Screen Painter error

    Hi all,
    I've just installed SBO version 6.7 and when I try to run the Screen Painter I get the following error message:
    Run-time error '-7000' (ffffe4a8)':
    Form - Invalid
    No forms have been opened, the error message displays when I click on the screen painter option in the menu. Does anyone have any suggestions of what's gone wrong? Perhaps I've installed 6.7 incorrectly?
    Lita

    I think the problem was fixed when I got SBO licensed? The 2004 version will not let you do things like upgrade to a patch unless you have a licensed version.

  • Really need help with a loading screen

    Ok, here's my problem, I'm making a puzzle game and I can't seem to make my loading screen work with my main menu. The loading screen is represented by an image filling up with colour where the colouring takes place by means of a thread (and there's a string as well that paints the %) . Now the loading screen is supposed to appear after i click the start button from the main menu and after completely filling up (or when the tread dies) the game panel is suppposed to be show on screen. Between the loading I initialize all the components for the game. Now, when I press the start button, the whole screen freezes (for the duration of the loading thread) after which the game screen appears. What puzzles me more is that if i don't add the game screen the loading screen works like a charm.
    Here's some of the code:
    public void actionPerformed(ActionEvent e){
    if(e.getActionCommand().compareTo("Start")==0){
    //initializing the panel for the loading
    ds=new Load();
    //initializing the thread that makes the panel rainbow dream
    anm=new Ompy();
    x.remove(pent); //pent is the jpanel containing the main menu with the customised buttons, and x is the reference to the current JFrame's content pane
    x.add(ds);
    pack();
    /* MediaTracker tracker=new MediaTracker(this);
    tracker.addImage(ds.pic.im,2); //i tried using a media tracker to wait for the image of the loading jpanel
    tracker.addImage(ds.fill.im,2);
    try{tracker.waitForID(2);}
    catch(InterruptedException ie){} */
    anm.start(); //i start the thread
    //without the folowing code the loading screen works perfectly
    some code
    Winx gs=new Winx(); //the panel containing the game interface
    some code
    while(anm.isAlive()){}
    x.remove(ds); // i remove the loading screen
    x.add(gs); //i add the game screen
    anm=null;
    ds=null;
    setVisible(true);
    gigaslave.requestFocusInWindow();
    pack();
    //here ends the code that shadows my loading screen :((
    else {System.exit(0);}}
    }I appreciate your help.

    Thanks for all your help ...this is what i have so far and am working with:
    import javax.swing.JOptionPane;
    public class TVRemote{
         int volume = 5;
         int channel = 5;
         public void channelUp(){
              if(channel < 25){
                   channel++;
         public void channelDown(){
              if(channel > 1){
                   channel--;
         public void volumeUp(){
              if(volume < 10){
                   volume++;
         public void volumeDown(){
              if(volume > 1){
                   volume--;
    public class VCRemote extends TVRemote{
         String tape = null;
         String mode = "Stop";
         public void insertTape(String t){
              tape = t;
         public void ejectTape(){
              tape = null;
         public void setMode(String m){
              mode = m;
         public String getMode(){
              return mode;
    public String getMode(){
              if(tape == null){
                   System.out.println("There is no tape");
              return mode;
    I know it does have to be set as 2 files....I still need to put in a rewind and fast forward option would that be done the same way that public void insetTape is done? also I was wondering how i will interface it with the user? Cause the only output i see is a display message that there isn't any tape in the vcr.
    Thankgs again for everyones help.

  • ChooseFromList for Customers by Screen Painter

    Hi,
    I don't know how to start on just adding a ChooseFromList for customers on my Screen Painter form.
    Any tutorials, videos anything out there to show me how to compelte this task ?

    aruntb wrote:
    ...Make sure that your edittext control must be binded with either DBDatasource or user data source of alphanumeric type.
    >
    > hope this helps
    >
    > Regards
    > Arun
    I already did all this and once run it wasn't working at all so I don't know if your last sentence above is made in Screen Painter also but if not, this was probably the missing piece for the whole thing to work.  Never read this anywhere not even in Screen painter documentation which is so poor actually.
    Well after all, I did everything by code and it seems to work ok.  I will make myself a favor ad add a nice single method that do it all and save it in my library.  I will even come here and give to everyone this method so it's easier for other people having a hard time with that.
    Thank you for the information

  • Related to screen painter

    hi,
      if i design screen painter form then how to connect that form to business one 2005B patch 36
    regards
      sandip adhav

    In that case u need to write the code behind ur form and should go for creation of ard file and must take ur form thro addon installation process. these are xplained in SDK Help file & Tutorial.
    Regards,
    Dhana.

  • UI: Event Handling of forms created with the Screen Painter

    Hi,
    I created a form with the Screen Painter and saved it as XML document. After that, I loaded this form with the following code:
    <i>Dim oXMLdoc As MSXML2.DOMDocument
    oXMLdoc = New MSXML2.DOMDocument
    oXMLdoc.load("C:\form1.xml")
    SBO_Application.LoadBatchActions(oXMLdoc.xml)</i>
    Then the loaded form appears in the SBO application with all added items.
    Now, I would like to know how I could handle an ITEM_PRESSED event for a button of this imported form.
    It would be great if someone could help me with this problem and post some example code.
    Regards,
    Dennis

    Dennis,
    you have to create a function that will handle all the event receive from B1
    <i>    Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
            If (pVal.FormUid = "YourUIDForm") Then
                If ((pVal.itemUID = "YourItemUID") And _
                    (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) And _
                    (pVal.Before_Action = False)) Then
                    ' Here write the coe you need....
                End If
            End If
        End Sub</i>
    Off course, you need your variable SBO_Appliation declared as follow :
    Private WithEvents SBO_Application As SAPbouiCOM.Application

  • Is it possible to open a form created with screen painter more than once?

    I have created a form with the screen painter. In the screen painter the form is assigned a FormUID. Probably because this is done, it is impossible to open the form more than once??
    Thanks,
    Kind regards

    Hi J.
    The answer is yes You just have to give your form a unique id.
    1) Give your form in screen painter a name like BTWO_DYNAMIC_UID (just plain text).
    2) Make sure your <i>FormType</i> and <i>appformnumber</i> have a unique number (i.e. 2000060001). You can do this in the xml source.
    3) By loading your document replace the BTWO_DYNAMIC_UID with an unique id. I have a counter that's a member of my class and increase that number to get a unique id (BTWO_F_1, BTWO_F_2 etc)
    I have added a code sample, SBOApplication is my SAP application object and mFormNumber is a member (integer) of my class.
    <i>Succes d'r mee, en als 't nie lukt hoor ik het wel... ;)</i>
    <b>Code (C#):</b>
    // New xml document
    XmlDocument oXmlDoc = new XmlDocument();
    private Form LoadUniqueForm(string AMyFile)
      // Define your path to
      sPath = @"Forms" + AMyFile;
      // Load the form
      oXmlDoc.Load(sPath);
      // Replace the string with an unique id
      mFormNumber++;
      string sXML = oXmlDoc.InnerXml.Replace("BTWO_DYNAMIC_UID", "BTWO_F_" + mFormNumber.ToString());
      // load the XML file in SAP
      SBOApplication.LoadBatchActions(ref sXML);
      // Return the form
      return SBOApplication.Forms.Item("BTWO_F_" + mFormNumber.ToString());

  • How to increase formUID to a form created with screen painter

    Hi,
    I've got a problem with my form. I created a form with screen painter but i can't succeed to increase my UID form.
    For example, when i open my first form, the UID is always at FP_0.
    My script:
    private string FormUID = null;
      public FP_Form(int NumInstance_)
                this.NumInstance = NumInstance_;
    this.FormUID = "FP" + NumInstance.ToString();
                load();
              oDBDataSource = oForm.DataSources.DBDataSources.Add(DBDataSourceTable);
              SBO_Application.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);
    private void SBO_Application_ItemEvent(string _FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
                BubbleEvent = true;
                try
    if (_FormUID == this.FormUID) //here "_FormUID" is increased but "this.FormUID" is still = FP_0
                        switch (pVal.EventType)// selon le type d'action executée
                            case SAPbouiCOM.BoEventTypes.et_FORM_LOAD:
                                if (pVal.BeforeAction == true)
                                    SAPbouiCOM.ComboBox List_reseau = (SAPbouiCOM.ComboBox)oForm.Items.Item("5").Specific;
                                    List_reseau.ValidValues.Add("1", "test");
                               break;
                           case ...
                              break;
    Please help.
    Regards,
    Zakia.

    Hi J.
    The answer is yes You just have to give your form a unique id.
    1) Give your form in screen painter a name like BTWO_DYNAMIC_UID (just plain text).
    2) Make sure your <i>FormType</i> and <i>appformnumber</i> have a unique number (i.e. 2000060001). You can do this in the xml source.
    3) By loading your document replace the BTWO_DYNAMIC_UID with an unique id. I have a counter that's a member of my class and increase that number to get a unique id (BTWO_F_1, BTWO_F_2 etc)
    I have added a code sample, SBOApplication is my SAP application object and mFormNumber is a member (integer) of my class.
    <i>Succes d'r mee, en als 't nie lukt hoor ik het wel... ;)</i>
    <b>Code (C#):</b>
    // New xml document
    XmlDocument oXmlDoc = new XmlDocument();
    private Form LoadUniqueForm(string AMyFile)
      // Define your path to
      sPath = @"Forms" + AMyFile;
      // Load the form
      oXmlDoc.Load(sPath);
      // Replace the string with an unique id
      mFormNumber++;
      string sXML = oXmlDoc.InnerXml.Replace("BTWO_DYNAMIC_UID", "BTWO_F_" + mFormNumber.ToString());
      // load the XML file in SAP
      SBOApplication.LoadBatchActions(ref sXML);
      // Return the form
      return SBOApplication.Forms.Item("BTWO_F_" + mFormNumber.ToString());

  • Cannot load XML file in Screen Painter in SAPB1

    Hi All,
    i am creating an xml file of existing purchase order through the following code
    Public Sub getxml(ByVal FormUID As String)
            Dim f As SAPbouiCOM.Form
            f = sbo_application.Forms.Item(FormUID)
            Dim oXmlDoc As Xml.XmlDocument
            Dim sXmlString As String
            oXmlDoc = New Xml.XmlDocument
            '// get the form as an XML string
            sXmlString = f.GetAsXML
            oXmlDoc.LoadXml(sXmlString)
            Dim sPath As String
            sPath = IO.Directory.GetParent(Application.StartupPath).ToString
            oXmlDoc.Save((sPath & "\ChangedXml.xml"))
        End Sub
    i am calling this function getxml in pageload of this form as
    Private Sub B1_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles sbo_application.ItemEvent
            If pVal.FormType = "142" And pVal.BeforeAction = False Then
                Dim oItem As SAPbouiCOM.Item
                Dim oFolder As SAPbouiCOM.Folder
                Dim oform As SAPbouiCOM.Form
                Dim oStaticText As SAPbouiCOM.Button
                Dim oEditText As SAPbouiCOM.EditText
                Select Case pVal.EventType
                    Case SAPbouiCOM.BoEventTypes.et_FORM_LOAD
                        getxml(FormUID)
                End Select
            End If
    End Sub
    it will create the xml file ChangedXml.xml in the destination folder, then i will copy that one and paste it and change the extension to .srf.
    then i will open screen painter and try to acceess this one it will open the form but it will give an error as Error: Menu - Image Type Not Supported
    it will open the screen but it won't open the matrix, the space which consists of matrix in the original form will come as blank.
    Please any one help me, it's urjent.
    Thanks,
    Vaithy
    09886807576

    Hi Vaithy,
    Not all the items you have in B1 forms are supported by the UI API and/or the ScreenPainter.
    If you need to reproduce a B1 system form you will have to remove all items giving you an error in the ScreenPainter and then have a reduced form.
    Why do you need the xml of the Purchase Order form? Please take care if you are trying to reproduce the behavior of the Purchase Order form, there can be some Formatted Searches or other customizations in the B1 form if you are using other addons.
    Hope it helps
    Trinidad.

Maybe you are looking for

  • Upgrade to Leopard seems to have broken Apple Intermediate Codec

    I recently upgraded my Macbook Pro to Leopard (clean install). Before doing so I made a bootable backup on my firewire drive (which I still have). Prior to the new install I was able to playback files encoded with Apple Intermediate Codec (And the Co

  • CRM Interactive reporting, error while running RSA1

    Hello Experts, I had configured CRM 7 with BI 7 system for reporting. Now I am trying to implement CRM interactive reporting using a different client (as reporting client) of the same CRM system. While my CRM - BI scenario is working perfect, I am no

  • Do I need specific disks for specific drive?

    Hello everyone, While trying to reinstall a system software, do I need to use the specific disks which came with the computer? I've been online trying to help a friend in Africa with her MacBook. She's lost her hard drive once and was able to reinsta

  • Itunes not connecting via airplay on wired and wireless network

    I have some computers on the wired part of my network, and others on wireless. My appletv2 shows in itunes on ALL (both wired and wireless) computers that there exists an AppleTv airplay speaker, but only the computers on the same "side" of the netwo

  • AIR-WLC4402-25-K9 with AP 1232

    Hello I need help! I have the  this controller AIR-WLC4402-25-K9 can I add the AP1232 to this controller?Is support this? How can I do that? Thanks