Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General / July 2008



Tip: Looking for answers? Try searching our database.

Menu Help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lorin - 29 Jul 2008 02:19 GMT
VB6
How do I get the mouse click x, y when a top menu or submenu is clicked?
There seems to only be a mouse_click event.
Bruce W. Roeser - 29 Jul 2008 02:32 GMT
Lorin,

Technically, when you're clicking on that menu you are actually clicking on
a window element that is hiding the client area of the window you're trying
to retrieve the coordinates from.  I don't believe you will get any of the
other mouse events (mouseOver, etc.) in that situation.

-b

> VB6
> How do I get the mouse click x, y when a top menu or submenu is clicked?
> There seems to only be a mouse_click event.
MikeD - 29 Jul 2008 02:44 GMT
> VB6
> How do I get the mouse click x, y when a top menu or submenu is clicked?
> There seems to only be a mouse_click event.

It might help if you explain for what purpose you need the x,y mouse
coordinates. Normally, all you need to know is that the menu command was
clicked. I, for one, can't think of a reason why you'd need the actual
mousepointer coordinates.

Signature

Mike
Microsoft MVP Visual Basic

Lorin - 29 Jul 2008 18:21 GMT
Well, think about this...
I am creating a replacement for a sub menu that I want to fall under the top
menu that I click, therefore I need to know where the top menu is so I can
properly place it.  I can create this menu without using any API call or
subclassing, but how to I locate it?  Seems that Y=0 under the menu on the
form, but what about X?

Bottom line, I am creating a menu that shows font names and also shows a
sample of the font dynamically (per user sample text).  All is working except
nice programmable X placement.

So how do I get the coordinates?

> > VB6
> > How do I get the mouse click x, y when a top menu or submenu is clicked?
[quoted text clipped - 4 lines]
> clicked. I, for one, can't think of a reason why you'd need the actual
> mousepointer coordinates.
Jeff Johnson - 29 Jul 2008 18:27 GMT
> Well, think about this...
> I am creating a replacement for a sub menu that I want to fall under the
[quoted text clipped - 10 lines]
>
> So how do I get the coordinates?

Seriously: scrap that whole idea and look into the concept of owner-drawn
menus. Yes, it requires using API functions. Yes, they're very C-like and
not very intuitive to use for a die-hard VBer. But there should be some
existing code out there that you can steal huge chunks of (if not all).
Lorin - 29 Jul 2008 21:19 GMT
I previously look.
None had mixed font capability.
mine does.

> > Well, think about this...
> > I am creating a replacement for a sub menu that I want to fall under the
[quoted text clipped - 15 lines]
> not very intuitive to use for a die-hard VBer. But there should be some
> existing code out there that you can steal huge chunks of (if not all).
Jeff Johnson - 29 Jul 2008 21:54 GMT
>I previously look.
> None had mixed font capability.
> mine does.

Well, if you're willing to combine the code from two projects, look at

http://vbaccelerator.com/home/VB/Code/Controls/Combo_and_List_Boxes/Owner_Draw_C
ombo_and_List_Box/article.asp


and

http://vbaccelerator.com/home/VB/Code/Controls/Menus/PopupMenu_-_OwnerDraw_Menu_
Items/article.asp

Lorin - 30 Jul 2008 00:12 GMT
Thanks, but I'll stick with my superior implementation.  It is more robust
and simpler and easier to understand.  It is all rolled in to one .bas
I found how to get access to global mouse operation and then find the mouse
location on the form when the menu is clicked.  There are several methods.  
So I will try the simpler one first.

> >I previously look.
> > None had mixed font capability.
[quoted text clipped - 7 lines]
>
> http://vbaccelerator.com/home/VB/Code/Controls/Menus/PopupMenu_-_OwnerDraw_Menu_
Items/article.asp
 
expvb - 30 Jul 2008 04:45 GMT
Maybe GetCursorPos() is what you want? It gives pixel coordinates of the
mouse pointer whenever you call it. Also check ScreenToClient/ClientToScreen
to convert from screen coordinates to a position relative to the upper left
corner of the client area inside the form.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.