[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Finding the position where a Tmenuitem was clicked

Posted on 2006-11-25
7
Medium Priority
?
1,056 Views
Last Modified: 2010-04-05
Hi

I need to find out if the user clicked the image on a tmenuitem.

I tried the following :

   GetMenuItemRect(TMenuItem(Sender).GetParentMenu.WindowHandle, TMenuItem(Sender).GetParentMenu.Handle, TMenuItem(Sender).MenuIndex, Rect);
//   GetMenuItemRect(Ftube.WindowHandle, TMenuItem(Sender).GetParentMenu.Handle, TMenuItem(Sender).MenuIndex, Rect);
   Windows.GetCursorPos(CPos);

but i can't find the menuitemrect relative to the screen (or anything else for that matter).

Please help!

Regards Helge
0
Comment
Question by:UniqSoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:Ghitza
ID: 18012758
You mean like Mouse.CursorPos.X ?

0
 

Author Comment

by:UniqSoft
ID: 18012901
I mean how do i determine if the user clicked on the text or the icon in the menuitem. I want to do special processing if the user clicked on the icon.
0
 
LVL 16

Accepted Solution

by:
CodedK earned 500 total points
ID: 18012914
You can get the handle of the submenu associated with an item by using the
GetSubMenu or GetMenuItemInfo function.
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
GetSubMenu
( HMENU hMenu,      // handle of menu
  int nPos      // menu item position
);
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
See if this PAQ helps you :
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20256094.html
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:UniqSoft
ID: 18013149
It's not the submenu icon i'm interested in. The menu has items to the left of the text (TMenu.Imagelist, TMenuItem.ImageIndex)
0
 
LVL 4

Assisted Solution

by:Meldrachaun
Meldrachaun earned 500 total points
ID: 18015042
The problem here is that a menu item can be executed by the keyboard, as well as with the mouse, so the component is written to be independent of the mouse position.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21135801
Forced accept.

Computer101
EE Admin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question