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

SBO v2004 - Add a button on an existing form - .net

Hello. I have searched the forums and the UI API examples but I am having trouble accomplishing the following task:

I would like to add a button to form 134 (Business partner master data) on the "address" folder "tab". I would like the button to only be visible when the "address" folder tab is active. I need to toggle the visibility of the button if someone leaves the tab or changes mode from "add" to "find".

Example code would be really helpful. vb.net or c#.

Any help would be greatly appreciated.

TIA

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2005 at 08:49 PM

    Ty,

    Here is VB 6 code that adds a button to the contact tab. The key points are to set the FromPane and ToPane to match the tab you want. I would check another control on the same tab by dumping the XML for the form. You could also capture the form level while you are on that tab.

    '=============================================

    Private Sub AddButton()

    Dim oItem As SAPbouiCOM.Item

    Dim oButton As SAPbouiCOM.Button

    If Not ItemExists(oForm, BUTTON1) Then

    oForm.Freeze True

    Set oItem = oForm.Items.Add(BUTTON1, it_BUTTON)

    Set oButton = oItem.Specific

    oButton.Caption = "Attributes"

    MoveButton

    oForm.Freeze False

    End If

    End Sub

    Private Sub MoveButton()

    Dim oItem As SAPbouiCOM.Item

    Dim oItemAlt As SAPbouiCOM.Item

    oForm.Freeze True

    Set oItem = oForm(BUTTON1)

    Set oItemAlt = oForm("115") ' "Set as Default" button

    oItem.Top = oItemAlt.Top + 25

    oItem.Left = oItemAlt.Left

    oItem.Height = oItemAlt.Height

    oItem.Width = 100

    oItem.FromPane = 3

    oItem.ToPane = 3

    oForm.Freeze False

    End Sub

    '===========================================

    You can catch the change to Add or Find mode by catching the menu event (and being sure that this form has focus). The menu event will fire even if they use ^A. You can catch the press event on the OK/Add/Find (item uid "1") when they execute the find and change to OK mode (if they are successful). That may take a little testing.

    Hope this helps,

    Bruce

    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.