Tile and Cascade Desktop Windows

  1. #1

    Tile and Cascade Desktop Windows

    In my scenario, i am dynamically adding desktop windows to the page which has Usercontrols loaded in it. which is working all fine.

    Now what i want is to tile the windows on page load or whenever a new desktop window is added on a button click and also an option to minimize the window from javascript. Can someone help me please, I hade tried the options in example but it gives error saying 'Object doesn't support this property'.

    Please guys try to give the reply as soon as possible.

    Thanks in advance.
  2. #2
    Hi,

    I hade tried the options in example but it gives error saying 'Object doesn't support this property'.
    Did you mean the following example?
    https://examples1.ext.net/#/Desktop/...tion/Overview/

    Please provide a simplified sample to reproduce the problem. See Example (Very Helpful)
    http://forums.ext.net/showthread.php...ing-New-Topics
  3. #3

    Tile and Cascade Desktop Windows

    I am using Ext.NET 1.0, .Net Framework 3.5 with C#. Here's the code of my Desktop control on page:
    <ext:Desktop ID="desktop" runat="server" BackgroundColor="white" ShortcutTextColor="Black"
                Width="900px" >
                <Body>
                    <div style="float: right;">
                        <ext:Panel ID="Panel1" runat="server" Title="Select a Widget" Cls="deskEl" Height="160"
                            Width="450" BodyStyle="padding:5px;" Collapsible="true" AutoScroll="true"
                             Draggable="true">
                            <Body>
                                <div>
                                    <asp:DataList ID="dlWidgetList" OnItemCommand="dlWidgetList_ItemCommand" runat="server"
                                        RepeatDirection="Vertical" RepeatColumns="5" RepeatLayout="Table" CellPadding="3"
                                        Visible="true" CellSpacing="0" ShowFooter="False" ShowHeader="False" Width="100%">
                                        <ItemTemplate>
                                            <div class="new_widget" id="new_widget">
                                                <table border="0" width="100%" cellspacing="0" cellpadding="2" style="margin-left: 1px;
                                                    margin-right: 1px; margin-top: 5px; margin-bottom: 5px">
                                                    <tr>
                                                        <td align="center" valign="middle">
                                                            <asp:LinkButton CommandArgument='<%# Eval("ID")  %>' CommandName="AddWidget" ID="AddWidget"
                                                                runat="server" CssClass="widgetitem" ToolTip='<%# Eval("Description")  %>' Text='<%# Eval("Name") %>'></asp:LinkButton>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </ItemTemplate>
                                    </asp:DataList>
                                </div>
                            </Body>
                        </ext:Panel>
                    </div>
                </Body>
                <Modules />
                <StartButton Text="" Icon="None" />
                <StartMenu Height="1"></StartMenu>
                <Shortcuts>
                    <ext:DesktopShortcut ShortcutID="scTile" Text="Tile windows" IconCls="shortcut-icon icon-window48"
                        X="{DX}-90" Y="{DY}-90" />
                    <ext:DesktopShortcut ShortcutID="scCascade" Text="Cascade windows" IconCls="shortcut-icon icon-window48"
                        X="{DX}-90" Y="{DY}-170" />
                    <ext:DesktopShortcut ShortcutID="scMinimize" Text="Minimize windows" IconCls="shortcut-icon icon-window48"
                        X="{DX}-90" Y="{DY}-270" />
                </Shortcuts>
                <Listeners>
                    <ShortcutClick Handler="var d=#{desktop}.getDesktop(); if(id == 'scTile'){d.tile();}else if(id == 'scCascade'){d.cascade();}   else if(id == 'scMinimize'){HideAllWin()}" />
                </Listeners>
            </ext:Desktop>
    i am dynamically adding desktop windows to the page on the ItemCommand Event of the Datalist. which is working all fine.

    Now what i want is to tile/Cascade the windows on the click of the respective ShortCut added to the Desktop. Or else it would be great if i can tile the windows on page Init / Load or whenever a new desktop window is added on the ItemCommand Event of the Datalist.

    I hade tried the options in example,
    https://examples1.ext.net/#/Desktop/In...tion/Overview/
    but clicking on the shortcut for Tile/Cascade gives error saying 'Object doesn't support this property' dont know y.

    I had also tried calling the below javascript on pageload event (This javascript i found in one of the threads realted to tile windows)
    function HideAllWin() {
                Ext.WindowMgr.each(function(w) {
                    if (w.isVisible()) w.minimize();
                });
            }
    
            var CascAllWin = function() {
                var xTick = Math.max(1, 20);
                var yTick = Math.max(1, 20);
                var x = xTick;
                var y = yTick;
                Ext.WindowMgr.each(function(w) {
                    if (w.isVisible() && !w.maximized) {
                        w.setPosition(x, y);
                        x += xTick;
                        y += yTick;
                    }
                });
            }
            var TileAllWin = function() {
                var availWidth = Ext.lib.Dom.getViewWidth();
                var x = 1;
                var y = 1;
                var nextY = y;
                Ext.WindowMgr.each(function(w) {
                    if (w.isVisible() && !w.maximized) {
                        w.setHeight(300);             //remove if you don't want to resize <SPAN class=highlight>windows</SPAN>                 
                        w.setWidth(300);             //remove if you don't want to resize <SPAN class=highlight>windows</SPAN>                 
                        var wi = w.el.getWidth();                     //Wrap to next row if this Window will go off the end                 
                        if ((x > 1) && (x + wi > availWidth)) {
                            x = 1;
                            y = nextY;
                        }
                        w.setPosition(x, y);
                        x += wi + 1;
                        nextY = Math.max(nextY, y + w.el.getHeight() + 1);
                    }
                });
            }
    but even this did not work.

    Please guys try to give the reply as soon as possible.

    Thanks in advance.
  4. #4
    Quote Originally Posted by vickygajula View Post
    I am using Ext.NET 1.0
    You are using 0.8.x (or older) :)

    There is no <Body> in Ext.Net.

    So, the problem is the following: there are no .tile() and .cascade() methods in 0.8.x (and older).

    So, it would be best for you to use Ext.Net 1.0.
    http://www.ext.net/download/

    Also, you could look at Ext.Net sources to know how these methods are implemented.
  5. #5
    Quote Originally Posted by Daniil View Post
    You are using 0.8.x (or older) :)
    Thanks for the reply. Actually i was using an older version and thought its d same.Its working fine now.

    One more thing i would to like to know is, If i want to tile the dynamically added windows on pageload event how can i dot it? Is there any serverside method to tile the windows.
  6. #6
    There are respective .Tile() and .Cascade() server side methods.

    Example
    Desktop1.Tile();
    Desktop1.Cascade();

Similar Threads

  1. Problem with creating Dynamic Windows on Desktop
    By marcelodecon in forum 1.x Help
    Replies: 0
    Last Post: Apr 16, 2010, 11:25 AM
  2. desktop windows and tabs
    By lhalfon in forum 1.x Help
    Replies: 0
    Last Post: Mar 04, 2010, 2:12 PM
  3. on opening windows in a desktop
    By [WP]joju in forum 1.x Help
    Replies: 6
    Last Post: Oct 28, 2009, 7:36 AM
  4. [CLOSED] Desktop BUG: Modal windows can be minimized and you can interact with the other windows
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 31, 2009, 2:49 PM
  5. Replies: 1
    Last Post: Mar 17, 2009, 1:17 AM

Tags for this Thread

Posting Permissions