While Visual Basic provides an easy way to create shortcut menus, some controls
such as rich text boxes don't inherently support pop-up menus. To overcome this
obstacle, you can take advantage of the MouseDown() event. Visual Basic triggers
this event when you press the mouse button. To provide a pop-up menu, create
a
shortcut menu, then simply call it in the control's MouseDown() event.
To see how this works, add a Rich Textbox control to a sample form. Next, select
Tools | Menu Editor from Visual Basic's IDE menu bar, and create a simple menu
with one or two items. Then, switch to the form's code window, and enter Private Sub RichTextBox1_MouseDown(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
Me.PopupMenu Menu
End IF
End Sub
Add pop-up menu support to the Rich Textbox control
By ElementK Journals, published on 14 Jul 2001
| Filed in
You might also like...
VB 6 forum discussion
-
CorelDRAW VBA: cdrTraceLineDrawing FAILS, producing single linear path instead of Centerline trace?
by dancemanj (0 replies)
-
client/server application using activex
by beautifulheart (0 replies)
-
System Error &H8007007E. The specifed module could not be found.
by swiftsafe (5 replies)
-
Invitation to take part in an academic research study
by researchlab (0 replies)
-
Send SMS with SMPP
by mmahmoud (0 replies)
VB 6 podcasts
-
Stack Overflow Podcast: Podcast #45 – Keeping it Sharp
Published 7 years ago, running time 0h54m
Our guest this week is Eric Lippert – language architect extraordinaire and famous for all his work at Microsoft in developing their languages Eric joined Microsoft right out of college and was originally working on VB It’s time for everyone’s favorite game: Name the Worst Feature of that Microso.
Comments