Hide Shortcutmenu on form, but enable on control

D

Dale Fye

I've got a form where I want to disable the default shortcut menu, but want
to display a custom menu for a listbox on the form.

I've tried a number of settings of the forms shortcutmenu property (Yes/No)
and combinations of other items, but cannot seem to figure this out.

I even tried creating a rectangle on the form and placing it around the
listbox, then I used the mousemove event to set me.shortcutmenu = false when
passing over the rectangle and me.shortcutmenu = true when passing over the
listbox, but this doesn't work either.

any bright ideas out there?
 
D

Dale Fye

OK,

I resolved this by using the detail sections mousemove event, as well as the
listboxes MouseMove events. Initially, I just set the forms shortcutmenu
propert to true or false in the MouseMove event, but this resulted in too
much flickering, so I modified it to test the value first, and only change it
if it was wrong.

Still think there ought to be an easier, less time consuming (this fires
every time the mouse moves over the form) method to accomplish this, so would
love to hear of any other solutions.

Private Sub Detail_MouseMove(Button As Integer, _
Shift As Integer, X As Single, Y As Single)

If Me.ShortcutMenu = True Then Me.ShortcutMenu = False

End Sub

Private Sub lst_MyList_MouseMove(Button As Integer, _
Shift As Integer, X As Single, Y As Single)

If Me.ShortcutMenu = False Then Me.ShortcutMenu = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top