We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Context Menu and Mouse Position

I am trying to setup the Context Menu such that it is "tweaked" just before it is displayed based on where the mouse click event happened. However the popup event doesn''t give the mouse position??

9 Replies

AD Administrator Syncfusion Team April 6, 2004 09:59 PM UTC

Hi, You would have to derive from our PopupMenu class and override the ShowChildrenUI method. public virtual IPopupChild ShowChildrenUI(Point pos, IPopupParent parentUI) { } Within the ShowChildrenUI method''s argument list you could specify the custom position where you wish to display the PopupMenu. Please try this and let me know if you need further assistance. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team April 6, 2004 10:31 PM UTC

hmm We what I want to do to is not display the menu at a pt. But rather findout the pt it is displayed at? Make sense? This way if the context menu happens over the column headers I can tweak the menu differently than if it comes up over a cell.. So basically what I want is to findout if you are able to detect the pt the the context menu is being displayed at.


AD Administrator Syncfusion Team April 7, 2004 03:54 PM UTC

Hi, Thanks for the update. I now understand your requirements better. For this purpose, you have to handle the PopupMenu.ParentBarItem''s BeforePopup event and within that event handler ger the Point at which it was invoked using Control.MousePosition property. Based on this Point value, you could then display the desired PopupMenu. Please refer to the sample_attached which shows how this can be done. Try this sample and let me know if it meets your requirements. We appreciate your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team April 8, 2004 10:28 AM UTC

Ok, this is very close. However, the problem is that this sample rely''s on Control.Mouseposition which isn''t always correct. Technically if a user invokes the Contextmenu from the "keyboard", the menu display point will be the cursor position (if it is a text editing program) or the top-left (if a generic usercontrol) not the mouse position.. This is why I expected the pt to come through on the event args (as they do in win32 on the lParam for WM_CONTEXTMENU) Other ideas? I override the wndproc and crack the WM_CONTEXTMENU message, however this seems like a very common problem that I would think has already been adressed? Comments?


AD Administrator Syncfusion Team April 8, 2004 11:21 PM UTC

Hi, Thanks for the update. I have requested the folks at the development team for their inputs on this, and will update you as soon as I hear from them. We appreciate your patience and cooperation. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team April 11, 2004 08:44 AM UTC

Hi, ''Shift + F10'' is the ''PopupMenu display key'' and hitting that will show the PopupMenu on the currently active control. If you wish to display the PopupMenu in response to some other key stroke, then you would have to invoke PopupMenu''s Show method at the desired position (for example : the cursor position in a text editor), in the Key Down event handler. Please let me know if this works for you. We appreciate your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team April 12, 2004 12:42 PM UTC

This doesn''t help at all.. I want to know "the pt that the contextmenu is invoked at" Reread this post.. Ok, this is very close. However, the problem is that this sample rely''''s on Control.Mouseposition which isn''''t always correct. Technically if a user invokes the Contextmenu from the "keyboard", the menu display point will be the cursor position (if it is a text editing program) or the top-left (if a generic usercontrol) not the mouse position.. This is why I expected the pt to come through on the event args (as they do in win32 on the lParam for WM_CONTEXTMENU) Other ideas? I override the wndproc and crack the WM_CONTEXTMENU message, however this seems like a very common problem that I would think has already been adressed?


AD Administrator Syncfusion Team April 13, 2004 01:01 AM UTC

Hi, Thanks for the update. I have consulted the development team in this regard, and will update you with more information as soon as possible. We appreciate your patience and cooperation. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team April 15, 2004 05:19 PM UTC

Hi A new PopupMenu.BeforePopup event has been added internally to provide the mouse position where the context menu will be shown. This feature will be available in the next release of Essential Suite (post v2.0.3.0 releases). We appreciate your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon