Skip to Content
author's profile photo
Former Member

Adding Button to specific folder tab

Hi,

I want add new button to specific form tab. I know how to add button, but I dont know how to add button to specific form tab at form. I tried use FromPane and ToPane. It doesnt work. Im writing code at C#. Can u help me.

nForm = SBO_Application.Forms.GetFormByTypeAndCount(60100,1);
					nForm.Freeze(true);
				
					

										
					nForm.PaneLevel = 24;
					nItem = nForm.Items.Item(61);
					
										nNewItem = nForm.Items.Add("U_001", SAPbouiCOM.BoFormItemTypes.it_BUTTON);
					nNewItem.Left = nItem.Left;
					nNewItem.Width = nItem.Width;
					nNewItem.Top = nItem.Top + (nItem.Height * 3) - 10;
					nNewItem.Height = nItem.Height;
					nNewItem.FromPane = 24;
					
					nNewItem.ToPane = 24;
					nNewItem.Visible = true;
					
					nBttn = (SAPbouiCOM.Button)nNewItem.Specific;
					nBttn.Caption = "New";

								
					
					
					nForm.Freeze(false);
					nForm.Visible = true;
					nForm.Update();

Thanks for all

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Posted on Mar 09, 2005 at 10:08 AM

    Hi Vit,

    Here is some code I posted a few days ago:

    In the form load:

    'Define variables
    Dim oFolder As SAPbouiCOM.Folder        
    Dim oNewItem, oNewItem2, oItem As SAPbouiCOM.Item
    'Use an existing folder to get values
    oItem = oForm.Items.Item("39") '39 is an existing folder
    'Create new folder
    oNewItem = oForm.Items.Add("Folder1", SAPbouiCOM.BoFormItemTypes.it_FOLDER)
    oNewItem.Top = oItem.Top
    oNewItem.Height = oItem.Height
    oNewItem.Width = oItem.Width
    oNewItem.Left = oItem.Left + oItem.Width - 70
    oFolder = oNewItem.Specific
    oFolder.Caption = "Folder 1"
    oFolder.GroupWith("39")
    

    The click event:

    If pVal.ItemUID = "Folder1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK And pVal.Before_Action = True Then   
    'Change Pane level
       Dim oForm As SAPbouiCOM.Form
       oForm = con.Forms.Item(FormUID)
       oForm.PaneLevel = 9
       'This PaneLevel is the one asigned to the new folder.
       'Be sure it doesn´t already exist.
    End If
    

    And finally, when you create the controls that should be in the folder:

    Private oNewItem1 As SAPbouiCOM.Item
    oNewItem1.FromPane = Pane
    oNewItem1.ToPane = Pane
    

    I think you are forgetting to handle the click event on the folder.

    Hope helps,

    Ibai Peñ

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Mar 09, 2005 at 10:24 AM

    Hi,

    Thanks a lot. I hope that helps me. 😊

    Add comment
    10|10000 characters needed characters exceeded