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