Solved

Check for event in event queue

Posted on 2006-11-16
2
255 Views
Last Modified: 2010-04-16
When a context menu item is clicked, the click event isn't handled immediately. Instead, the context menu is dismissed, subsequent statements (statements following the calling of the Show method of the menu) are executed, and only then the menuitem's click event is handled.

I need that, immedately after calling Show, before any other statement is executed, to determine if a certain menuitem was clicked.

I thought of checking whether the click event of the menuitem is in the event queue, but how to do that? Or maybe there is another solution?
0
Comment
Question by:campinas
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 17963283
contextMenu1.Show(...);
Application.DoEvents();    // here context menu item handler is called
// ... other code

In item handler you can set some variable which can show you that item was selected.

0
 

Author Comment

by:campinas
ID: 17963368
Thank you, appreciate your help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now