Context Menu in desktop

  1. #1

    Context Menu in desktop

    I am not able get contex tmenu work on desktop background ...

    Please guide me on this ..

    My sample test case is as below ..

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    <script runat="server">
       
    
       
        protected void Logout_Click(object sender, DirectEventArgs e)
        {
            // Logout from Authenticated Session
            this.Response.Redirect("Default.aspx");
        }
    
        
    
        protected void GetQuickSearchItems(object sender, StoreRefreshDataEventArgs e)
        {
            string filter = e.Parameters["Filter"];
    
            if (!string.IsNullOrEmpty(filter))
            {
                QuickSearchStore.DataSource = new List<object>
                  {
                      new { SearchItem = filter + " 1" },
                      new { SearchItem = filter + " 2" },
                      new { SearchItem = filter + " 3" },
                      new { SearchItem = filter + " 4" },
                      new { SearchItem = filter + " 5" },
                      new { SearchItem = filter + " 6" },
                      new { SearchItem = filter + " 7" },
                      new { SearchItem = filter + " 8" },
                      new { SearchItem = filter + " 9" },
                      new { SearchItem = filter + " 10" }
                  };
            }
    
            QuickSearchStore.DataBind();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Desktop - Ext.NET Examples</title>
        <style type="text/css">
            .start-button
            {
                background-image: url(vista_start_button.gif) !important;
            }
            .shortcut-icon
            {
                width: 48px;
                height: 48px;
                filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="window.png", sizingMethod="scale");
            }
            .icon-grid48
            {
                background-image: url(grid48x48.png) !important;
                filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="grid48x48.png", sizingMethod="scale");
            }
            .icon-user48
            {
                background-image: url(user48x48.png) !important;
                filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="user48x48.png", sizingMethod="scale");
            }
            .icon-window48
            {
                background-image: url(window48x48.png) !important;
                filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="window48x48.png", sizingMethod="scale");
            }
            .desktopEl
            {
                position: absolute !important;
            }
        </style>
    
        <script type="text/javascript">
            var alignPanels = function() {
    //            pnlSample.getEl().alignTo(Ext.getBody(), "tr", [-505, 5], false)
            };
    
            var template = '<span style="color:{0};">{1}</span>';
    
            
        </script>
    
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server">
            <Listeners>
                <DocumentReady Handler="alignPanels();" />
                <WindowResize Handler="alignPanels();" />
            </Listeners>
        </ext:ResourceManager>
        <%--Quick Search--%>
        <ext:Store ID="QuickSearchStore" runat="server" AutoLoad="false" OnRefreshData="GetQuickSearchItems">
            <Proxy>
                <ext:PageProxy />
            </Proxy>
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="SearchItem" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <BaseParams>
                <ext:Parameter Name="Filter" Value="#{QuickSearchFilter}.getValue()" Mode="Raw" />
            </BaseParams>
        </ext:Store>
        <%--End Quick Search--%>
        <ext:Desktop ID="MyDesktop" runat="server" BackgroundColor="Black" ShortcutTextColor="White"
            Wallpaper="desktop.jpg" ContextMenuID="ColorMenu1">
            <StartButton Text="Start" IconCls="start-button" />
            <%-- NOTE: Body Controls must be added to a container with position:absolute --%>
           
            
            <Shortcuts>
                <ext:DesktopShortcut ModuleID="DesktopModule1" Text="Add Customer" IconCls="shortcut-icon icon-user48" />
                <ext:DesktopShortcut ModuleID="DesktopModule2" Text="Company Info" IconCls="shortcut-icon icon-grid48" />
                <ext:DesktopShortcut ModuleID="modMisc" Text="Shortcut" IconCls="shortcut-icon icon-window48"
                    X="{DX}-90" Y="{DY}-90" />
            </Shortcuts>
            <StartMenu Width="400" Height="400" ToolsWidth="227" Title="Start Menu">
                <ToolItems>
                    <ext:MenuItem Text="Settings" Icon="Wrench">
                        <Listeners>
                            <Click Handler="Ext.Msg.alert('Message', 'Settings Clicked');" />
                        </Listeners>
                    </ext:MenuItem>
                    <ext:MenuItem Text="Logout" Icon="Disconnect">
                        <DirectEvents>
                            <Click OnEvent="Logout_Click">
                                <EventMask ShowMask="true" Msg="Good Bye..." MinDelay="1000" />
                            </Click>
                        </DirectEvents>
                    </ext:MenuItem>
                    <ext:MenuSeparator />
                    <ext:ComponentMenuItem runat="server" Shift="false">
                        <Component>
                            <ext:GridPanel ID="QuickSearchGrid" runat="server" Width="210" Height="275" StoreID="QuickSearchStore"
                                AutoExpandColumn="SearchItem">
                                <ColumnModel>
                                    <Columns>
                                        <ext:CommandColumn Width="30">
                                            <Commands>
                                                <ext:GridCommand Icon="Note" />
                                            </Commands>
                                        </ext:CommandColumn>
                                        <ext:Column ColumnID="SearchItem" Header="SearchItem" DataIndex="SearchItem" />
                                    </Columns>
                                </ColumnModel>
                                <SelectionModel>
                                    <ext:RowSelectionModel runat="server" SingleSelect="true" />
                                </SelectionModel>
                                <LoadMask ShowMask="true" />
                            </ext:GridPanel>
                        </Component>
                    </ext:ComponentMenuItem>
                    <ext:ComponentMenuItem runat="server" Target="#{QuickSearchFilter}" Shift="false"
                        ComponentElement="Wrap">
                        <Component>
                            <ext:TriggerField ID="QuickSearchFilter" runat="server" Width="210">
                                <Triggers>
                                    <ext:FieldTrigger Icon="Search" />
                                    <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
                                </Triggers>
                                <Listeners>
                                    <TriggerClick Handler="if (index === 1) { trigger.hide(); this.setValue(''); } else { this.triggers[1].show(); } #{QuickSearchGrid}.reload();" />
                                </Listeners>
                            </ext:TriggerField>
                        </Component>
                    </ext:ComponentMenuItem>
                </ToolItems>
                <Items>
                    <ext:MenuItem ID="MenuItem1" runat="server" Text="All" Icon="Folder" HideOnClick="false">
                        <Menu>
                            <ext:Menu ID="Menu1" runat="server">
                                <Items>
                                    <ext:MenuItem Text="Add Customer" Icon="Add">
                                       
                                    </ext:MenuItem>
                                    <ext:MenuItem Text="Company Info" Icon="Lorry">
                                        
                                    </ext:MenuItem>
                                    <ext:MenuItem Text="Web Browser" Icon="World">
                                       
                                    </ext:MenuItem>
                                    <ext:MenuItem Text="Create dynamic" Icon="World">
                                        
                                    </ext:MenuItem>
                                </Items>
                            </ext:Menu>
                        </Menu>
                    </ext:MenuItem>
                    <ext:MenuSeparator />
                </Items>
            </StartMenu>
        </ext:Desktop>
        <ext:ColorMenu ID="ColorMenu1" runat="server">
            <Listeners>
                <Select Handler="setColor(#{ColorMenu1}, color);" />
            </Listeners>
        </ext:ColorMenu>       
        </form>
    </body>
    </html>
  2. #2

    I am also looking for this one.

    Sometime back i too was looking for this.But could not find a workaround.Guess its not included in the desktop.js . so it wont work .Probably in 1.0 final we can expect this, but it would be great if Geofrey can give us some work around for now atleast.
  3. #3
    Hi ...

    Any ideas on this ... I kinda stuck here ...
  4. #4
    can any one help me. Your help will be greatly appreciated.
  5. #5
    Still I am not able to get it worked.
  6. #6
    Hi,

    Add the following listener to the Desktop
    <Ready Handler="Ext.get('x-desktop').on('contextmenu', function(e){e.stopEvent();e.preventDefault();ColorMenu1.showAt(e.getPoint());});" />
  7. #7
    Quote Originally Posted by vladimir View Post
    Hi,

    Add the following listener to the Desktop
    <Ready Handler="Ext.get('x-desktop').on('contextmenu', function(e){e.stopEvent();e.preventDefault();ColorMenu1.showAt(e.getPoint());});" />

    Thanks a ton Vlad, works like a charm.

    Regards,

    DotNet
  8. #8
    One weird question, What is the configuration of your Brain?

    100 GB of RAM, 100 TB of HDD ?????

    Once again thanks a lot.

Similar Threads

  1. Replies: 0
    Last Post: Mar 29, 2012, 12:50 PM
  2. Context menu in Gridview row
    By gayancc in forum 1.x Help
    Replies: 3
    Last Post: Nov 19, 2010, 5:32 PM
  3. [CLOSED] BUG desktop modal windows doen't show context menu in FF
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: May 28, 2010, 7:22 AM
  4. Context menu on Desktop
    By flaviodamaia in forum 1.x Help
    Replies: 0
    Last Post: May 12, 2009, 9:42 AM
  5. [CLOSED] context menu
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 07, 2009, 6:06 AM

Posting Permissions