Popup Menus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am porting an app from VB6 to VS2005 (VB/Win Forms). It uses a context
sensitive pop up menu. You know, you right click on something and an
appropriately placed menu comes up. I can not find this control.

There a context menu, but I can't get it to come up anywhere but the upper
left.

Any help?
 
I am porting an app from VB6 to VS2005 (VB/Win Forms). It uses a context
sensitive pop up menu. You know, you right click on something and an
appropriately placed menu comes up. I can not find this control.

There a context menu, but I can't get it to come up anywhere but the upper
left.

Upper left corner of what -- the screen? The form? The control?

The Show() method should do what you're looking for.
 
Patrick Steele said:
Upper left corner of what -- the screen? The form? The control?

The Show() method should do what you're looking for.

Thanks for the response Patrick, but no, the show method does nothing more
for me than the visible method. Both display the context menu in the upper
left hand corner of the MDI form that is the parent of the form that contains
the control. There is nothing about the Show method that sets the location
for the menu.

Even here, as I type, I can right click and see a selection of the
following choices:

Undo, Cut, Copy, Paste, Delete and Select All.

And I see this right where the mouse is currently pointing.

This is the behavior I desire.
 
EdB said:
Thanks for the response Patrick, but no, the show method does nothing more
for me than the visible method. Both display the context menu in the upper
left hand corner of the MDI form that is the parent of the form that contains
the control. There is nothing about the Show method that sets the location
for the menu.

Even here, as I type, I can right click and see a selection of the
following choices:

Undo, Cut, Copy, Paste, Delete and Select All.

And I see this right where the mouse is currently pointing.

This is the behavior I desire.

Actually, the context menu appears in the upper left hand corner of the
screen, regardless of the MDI form.
 
Thanks for the response Patrick, but no, the show method does nothing more
Actually, the context menu appears in the upper left hand corner of the
screen, regardless of the MDI form.


Let 'MyControl as Control' be the control (or form) that originates the popup.
Let 'cm as ContextMenu' be the context menu that you want to pop up.
To pop up the menu near the current mouse position, try this:

cm.Show(MyControl, MyControl.PointToClient(MyControl.MousePosition()))

In this usage, I leave MyControl.ContextMenu=Nothing. In other words, cm is
built independantly of the originating form/control, and it is tied to the
form/control only when cm.Show is called.
 
AMercer said:
Let 'MyControl as Control' be the control (or form) that originates the popup.
Let 'cm as ContextMenu' be the context menu that you want to pop up.
To pop up the menu near the current mouse position, try this:

cm.Show(MyControl, MyControl.PointToClient(MyControl.MousePosition()))

In this usage, I leave MyControl.ContextMenu=Nothing. In other words, cm is
built independantly of the originating form/control, and it is tied to the
form/control only when cm.Show is called.

Shazzam. Thanks.

Is it just me or this process anything but intuitive?
 
Is it just me or this process anything but intuitive?

Some things are easy, some are really obscure. This one took me a while to
figure out - I guess about 4 hours off and on spread out over a couple of
weeks. I've been using it for a couple of years.
 
Back
Top