The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

[OPEN] [#1556] [4.4.1] Desktop - context menu on Start

  1. #1

    [OPEN] [#1556] [4.4.1] Desktop - context menu on Start

    Hello support team,
    when searching for a suitable solution for creating a desktop shortcut from the start menu item, I tested also the possibility to use the context menu for this purpose. Implementation is simple, but is the behaviour correct? Even with AllowOtherMenus(true) the start menu is hidden when it loses focus:

    @using Ext.Net;
    @using Ext.Net.MVC;
        ViewBag.Title = "Context Menu on Desktop Start Example";
        Layout = null;
        var X = Html.X();
        List<MenuItem> startMenu = new List<Ext.Net.MenuItem>();
        startMenu.Add(new Ext.Net.MenuItem() { ID = "EU", Icon = Icon.FlagEuropeanunion, Text = "European Union", ContextMenuID = "_nelisDesktop_ContextMenu" });
        startMenu.Add(new Ext.Net.MenuItem() { ID = "US", Icon = Icon.FlagUs, Text = "United States", ContextMenuID = "_nelisDesktop_ContextMenu" });
    <!DOCTYPE html>
        <title>Ext.NET MVC Test Case</title>
        <script type="text/javascript">
            var itemClicked;
            function startReady() {
                Ext.get("EU").on('contextmenu', function (e) { itemClicked =; });
                Ext.get("US").on('contextmenu', function (e) { itemClicked =; });
                .Text("Create Shortcut")
                .Listeners(l => l.Click.Handler = "console.log('Create ShortCut:', itemClicked)")
                    .Title("Allegro Desktop")
                    .Listeners(l => l.AfterRender.Fn = "startReady")
    A small sub-question: is there a more reliable way to get an item on which the context menu was triggered? Using seems to me too tricky.

    Thank you.

    Last edited by fabricio.murta; Oct 02, 2017 at 6:41 PM.
  2. #2
    Hello, Dan!

    I am afraid we are talking here of the same issue to #1406 and possibly related to #799.

    The problem here is, when a standalone menu is created, as it is not drawn, HTML-wise, inside the container where the context menu may be triggered from. And it is also not moved within said container when the right-click happens, maybe for performance reasons and avoiding cascade-erasure of the menu in the DOM, or just by its generic nature (can be displayed anywhere in the page when called).

    For this reason, when you show it from the start menu and hover the mouse right over the context menu, it gets focus, ExtJS sees something "outside" the menu gained focus (as if you hit tab, clicked outside, etc), and then dismisses the start menu in its right.

    So, the generic menu is not fit to fill the context menu role in submenus for this reason. I can think of some pragmatic solutions like also considering "focus inside start menu" whenever the immediate or inner DOM components from that context menu are focused, or maybe a more "constrained" and concise option like actually drawing the context menu from within each icon (so one instance of the menu for each button, placed, DOM-wise, inside the menu HTML hierarchy). So that the menu is not just moved around and displayed, but also belong the clicked container.

    Okay, but this should be all confusing for you. In short, it is not, at first, an easy case and we have some related open issues related to it. I should put a little more time on this to offer an acceptable solution in that regard. Tried some alternatives, but couldn't just move the menu inside the components, but will try a little more and update you if I get something usable.

    So at the moment, we can consider this a bug, or a non-implemented feature. Not impossible though, as I said, the menu can be "fooled" to interpret the generic context menu as an inner DOM element and not dismiss the start menu when it is focused.

    I hope this helps, will try to get back to you with some alternative in a while.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi Fabrício,
    thank you for an exhausting explanation. There are often no easy solutions... life would be too simple. The current solution is not very nice and user-friendly, but somehow it works. Please let me know if a better conception is available. Thank you.

  4. #4
    Hello @MewLink!

    I believe if we leave the thread as it is, nothing is going to happen at all, so maybe I should log a feature request to support context menus inside menus. That seems to best apply to your needs here, am I right?
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Yes Fabrício, you are right.

    Thank you.
  6. #6
    Hello Dan!

    Done! Issue is #1556.

    Please notice this thread will not be moved within the Bugs forum because the nature of it (a feature).

    We'll update here as soon as we have this, or a feature supporting this, available!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Changing start menu desktop control
    By ucaneto in forum 3.x Help
    Replies: 1
    Last Post: Jul 08, 2015, 7:52 AM
  2. Programmatically open start menu in desktop
    By markusn in forum 2.x Help
    Replies: 2
    Last Post: Mar 30, 2014, 1:27 PM
  3. Replies: 8
    Last Post: Jul 29, 2012, 10:58 AM
  4. Context Menu in desktop
    By dotnet in forum 1.x Help
    Replies: 7
    Last Post: Sep 16, 2010, 4:30 PM
  5. Context menu on Desktop
    By flaviodamaia in forum 1.x Help
    Replies: 0
    Last Post: May 12, 2009, 9:42 AM

Tags for this Thread

Posting Permissions