cancel
Showing results for 
Search instead for 
Did you mean: 

Trapping event for changes to form mode

Former Member
0 Kudos

When a B1 form in "OK" mode has any control changed the button "1" changes its caption to "Update" and the form mode changes as well.

How can this be done with a user defined form? Is there an event that fires and can be trapped when any control on a user defined form changes? It does seem that the mode of the form is changing but how can that event be trapped?

Thanks for any help.

Mel Dodd

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Dodd,

Thanks for your questions, please check out answers below.

<i><u>How can this be done with a user defined form?</u></i>

Button caption and form mode change is automatic if you set a button UID to "1". So when you design your user form, please create two buttons, and set UID to "1" and "2" respectively.

<i><u>Is there an event that fires and can be trapped when any control on a user defined form changes?</u></i>

Yes, when a form mode is changed, a menu event is fired. And the menu item is under menu Data=>Find, Add. So, in case you want to monitor whether form mode is changed to to Find, please add your code in menu event. Check out the sample below.

Private Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.MenuEvent
        If pVal.BeforeAction = False Then
            If pVal.MenuUID = "1281" Then '1281 is Find menu UID
                SBO_Application.MessageBox("Form mode is changed to Find now!")
            End If
        End If
End Sub

<i><u>It does seem that the mode of the form is changing but how can that event be trapped?</u></i>

Please refer to the second answer.

Hope this helps,

Nick

Answers (0)