Home > Software engineering >  PopupMenu want to right-click popup FileMenu menu, the results have a don't know what to have n
PopupMenu want to right-click popup FileMenu menu, the results have a don't know what to have n

Time:12-22

The code is:
 Private Sub Text1_MouseDown (Button As an Integer, Shift the As an Integer, As Single X, Y As Single) 
If the Button=3 Then PopupMenu FileMenu
End Sub

Pop-up strange menu for:

Program interface for:

The menu editor for:


Which people know what the right-click pop-up menu??????
I want the menu, right click to play out but left after modify the program If the Button=1 Then PopupMenu FileMenu could want a pop-up menu:


Something important to say again: why is set to right-click menu will pop up strange? The pop-up menu of strange? The pop-up menu of strange? !!!!!!!!!

CodePudding user response:

1, you is the default menu that pops up;
2, If the Button=3 Then PopupMenu FileMenu
This button should only 1 4-trichlorobenzene, where come of 3?

CodePudding user response:

Thank you for your reply, that should be 2, how does that do not display the default menu? I want to show their right-click menu

CodePudding user response:

Shielding the textbox right-click menu, if use the API, you search for, need a lot of,

Here to provide a professional but very efficient code:
 Option Explicit 
Private Sub Text1_MouseDown (Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If the Button=2 Then
Text1. Enabled=False
Timer1. Interval=300 'use timer to restore
"' PopupMenu FileMenu '
there pop up your own menu"' Text1. Enabled=True 'restore invalid here!
End the If
End Sub
Private Sub Timer1_Timer ()
Text1. Enabled=True
Timer1. Interval=0
End Sub


.

CodePudding user response:

Don't know whether there is a more simple and effective method...

CodePudding user response:

Don't need to use the timer,
 
If (Button=2) Then
Text1. Enabled=False
DoEvents
Text1. Enabled=True
The PopupMenu FileMenu
End the If

CodePudding user response:

Upstairs said to test, don't use the menu, so he didn't succeed, testing, now completely feasible:
 Option Explicit 
Private Sub Text1_MouseDown (Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If the Button=2 Then
Text1. Enabled=False
PopupMenu wer '
there pop up your own menuText1. Enabled=True
End the If
End Sub


.

CodePudding user response:

Text box has its own default right-click menu,
Do you want to replace, of course, have to do something about it,

CodePudding user response:

refer to 6th floor Topc008 response:
 Option Explicit 
Private Sub Text1_MouseDown (Button As an Integer, Shift the As an Integer, As Single X, Y As Single)
If the Button=2 Then
Text1. Enabled=False
PopupMenu wer '
there pop up your own menuText1. Enabled=True
End the If
End Sub

Test, this should is right, but wer should be modified for your own menu name, behind can have menu display information such as location,
  • Related