How to disable a right click menu item - sapb1

I am trying to disable the "copy line" item in the right click menu when pressing a matrix on a user form.
I found a way to remove this menu item with "menu.RemoveMenu("1294");" but not a way to bring it back after one use without shutting sap down.
I am looking for a way to bring back this item \ disable it
I didn't find any good answer on the "archive.sap.com" too
Thanks

Instead of removing the menu you can disable it when you want and enable it again when necessary. For example, you can do it in the right click event or in any event from the FormTypeEx you want. If you use the right click event code would be something similar to this.
If oApplication.Forms.Item(eventInfo.FormUID).TypeEx = "MyForm" And eventInfo.BeforeAction Then
oApplication.Menus.Item("1294").Enabled = False
End If
If oApplication.Forms.Item(eventInfo.FormUID).TypeEx = "MyForm" And Not eventInfo.BeforeAction Then
oApplication.Menus.Item("1294").Enabled = True
End If

Related

Disable "Config structure" button in VA02 Item detail?

I would like to hide the "Config structure" button in the header of the screen "Item derails: configuration" in the VA* transactions, for a certain item status.
I am debugging the Dynpro logic but it's quite difficult to find the right spot where I can implement my additional logic and what button it actually is (technically).
Any help and guidance is appreciated.
Thanks in advance.
Here is a way to locate the code which defines the buttons of the Application Toolbar in any Dynpro. You may then change the code to hide a button, etc.
The "Application Toolbar" is the line of buttons which appears at the top of the main screen area (what is shown in your screenshot), and it's selected by the ABAP statement SET PF-STATUS during the Process Before Output event of the Dynpro screen, right before the screen is displayed.
If you put the focus on the button (click without releasing and drag out of the button) and press the F1 key, you will see both the function code of the button and the GUI status it belongs to (screenshot for transaction code SE38):
Double-click the "Function" field to display the GUI Status:
You may then start the debugger (/h in the command field for instance) and use the feature "breakpoint at statement", to stop at every SET PF-STATUS. After the EXCLUDING word, you may exclude (hide) any function code you want (button, menu item or keyboard key; for information, here SYCR is not even defined in the GUI status, so it's ignored). As you can see, you may modify the code here:

Disable right click menu of shapes

Is there a way to disable the right click menu for shapes like e.g. rectangles in VBA?
I tried:
Private Sub Workbook_Open()
' Application.WindowState = xlMaximized
Application.DisplayFullScreen = True
Application.CommandBars("Ply").Enabled = False
Application.CommandBars("Shapes").Enabled = False
End Sub
but this does not seem to work.
The right-click menu (aka, context menu) is not a Command Bar.
You may know Command Bars by their older name, Toolbars, or their newer name, Ribbons.
Although you can capture and/or disable a right-click event on a worksheet, this doesn't apply to objects like shapes.
However, you can prevent the context menu from showing by protecting the worksheet from changes (with or without a password).
If necessary you can allow some changes, but not others, to be made by the user. More information at this link.
I have attached some screenshots of my application just to describe what I want to archive.
The problem is that the menu is realy annoying when trying to select more than one shape.

Word 2010 - Trying to open Check Accessiblity and Properties panel from a macro

I tried recording opening the "Check Accessibility" option under the File>info>prepare for sharing, but nothing gets recorded. I have tried going through all of the Dialog show commands, but cannot find any that will open the menu.
I also tried to turn on the "Show Document Panel", and I can't get that to toggle either.
How can I have these open with the macro? I want to setup the workspace with a single button.
Try
Application.DisplayDocumentInformationPanel = True
Try this.
Application.CommandBars("Accessibility Checker").Visible = true

How can I remove windows right click menu?

I have a group of text boxes within my form. Whenever I right click on them or the panel they are in, I get this menu:
I want to remove this menu from showing, and leave the right click to be nothing. However, the mouseclick event never fires for any of these. Therefore, I am having trouble getting rid of it. It usually shows up when my text is highlighted.
Is there a way to remove it? Or am I looking in the wrong event?
Another option is to set the ShortcutsEnabled Property of the TextBoxes to False:
Use the ShortcutsEnabled property to enable or disable the
following shortcut key combinations and the control’s shortcut
menu
This disables the keyboard shortcuts as well; not sure if that is applicable to your scenario.

Triggering Visual Basic Keydown events without a specific function

I'm building on top of code that a previous developer has left me, and he left something that intrigued me quite a bit.
Basically on his menus, he has a TextBox to take in user input and a button next to it to submit the value of the TextBox (for example if the user wanted to select option 1, he would input 1 into the TextBox and click the button). However, the user could also press the Enter key while focusing the TextBox, and it would be treated as the submit button was clicked.
Now this is simple enough to do, but when I check the VB code behind the menu, there's no TextBox_Keydown(...) Handles TextBox.Keydown function anywhere, only the button click event. How is he doing this? He has several menus that are similar and I can't figure out how.
A standard dialog box, if not told to act otherwise, enter does default command button and escape does cancel. In VB look at the properties Default for the command button.
I discovered how he was doing it. He basically mapped the AcceptButton and CancelButton properties of the entire Windows Form to various button functions.