?
Solved

Finding the position where a Tmenuitem was clicked

Posted on 2006-11-25
7
Medium Priority
?
1,041 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
Technology Partners: 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
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

770 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