Solved

Popup Menu

Posted on 2001-06-13
5
358 Views
Last Modified: 2010-04-06
The popup menu automatically closes when the user clicks on another component outside it.  Is there a way to know when this will occur?  Or is there a way to know when the user has clicked the mouse on any other part of the form except the pop up menu?
0
Comment
Question by:TheBreeze
[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
5 Comments
 
LVL 9

Expert Comment

by:ITugay
ID: 6190333
listenning.....
0
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 6191316
Every event goes into the Windows Message "queue".  Capture the message and you can control the response to that event.
0
 
LVL 5

Expert Comment

by:Gwena
ID: 6192801
listening :-)
0
 

Author Comment

by:TheBreeze
ID: 6193578
KnowIton,

Pardon my ignorance, but how do I actually capture the message?
0
 
LVL 1

Accepted Solution

by:
Greyman earned 50 total points
ID: 6194063
Looking through the source code (D3) for TPopupMenu and the WIN API - I don't see any messages that can be trapped for this purpose.

However, TrackPopupMenu (the Win API function that displays a popup menu) does have a parameter that you can set that defines a rectangle where clicking does not make the popup menu go away (HTH).

To do that, instead of calling MyPopupMenu.Popup(XPos,YPos), you would need to do this:

var
  MyRect : TRect;
begin
// Set the Left, Right, Top and Bottom parts of MyRect
//to the boundaries of the rectangle where we can click
//without losing the menu

TrackPopupMenu(MyPopupMenu.Handle,TPM_LEFTALIGN or TPM_RIGHTBUTTON, XPos,YPos,0 {reserved}, Ptr(MyRect));

HTH
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month5 days, 18 hours left to enroll

626 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