[EXAMPLE] How to create new windows

Page 1 of 2 12 LastLast
  1. #1

    [EXAMPLE] How to create new windows

    This is my way to create forms:

    add this js:

    <script language="javascript" type="text/javascript">
        function NewWindow(winURL, winTitle, winHeight, winWidth, winModal, winMax, winRes, winCollap) {
        if (winTitle == '' || winTitle == undefined) { winTitle = 'Teste' }
        if (winCollap == '' || winCollap == undefined) { winCollap = false }
        if (winRes == '' || winRes == undefined) { winRes = false }
        if (winModal == '' || winModal == undefined) { winModal = false }
        if (winHeight == '' || winHeight == undefined) { winHeight = 500 }
        if (winWidth == '' || winWidth == undefined) { winWidth = 500 }
        var win = new Ext.Window({ renderTo: Ext.getBody(), 
        maximizable: winMax,
        resizable: winRes,
        collapsible: winCollap,
        constrain: false,
        title: winTitle,
        height: winHeight,
        width: winWidth,
        modal: winModal, 
        frame: true, 
        autoLoad:{ maskMsg:"Carregando...", showMask:true, mode:"iframe", url: winURL }
        });
        win.show();
        }
    </script>
    then in buttons use:

    <ext:Button ID="Button3" runat="server" Text="Teste" Icon="ServerGo">
        <Listeners>
            <Click Handler="OpenWindow('teste.aspx', 'Exemplo',200,200,false,false,false)" />
        </Listeners>
    </ext:Button>
    *edit: fixed some bugs and added new vars
    please change topic name to How to create new windows
  2. #2

    RE: [EXAMPLE] How to create new windows

    It was EXCATELY what I was looking for :)

    You just need to change

    OpenWindow('teste.aspx', 'Exemplo',200,200,false,false,false)
    


    to

    NewWindow('teste.aspx', 'Exemplo',200,200,false,false,false)
    


    I can use your code now to create a desktop window from an iframe :)
  3. #3

    RE: [EXAMPLE] How to create new windows

    If I may offer a few suggestions, your function could be simplified to the following.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!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></title>
        <script type="text/javascript">
            var newWindow = function (url, config) {
                new Ext.Window(Ext.apply({
                    renderTo: Ext.getBody(),
                    resizable: false,
                    title: "Teste",
                    height: 500,
                    width: 500,
                    frame: true,
                    autoLoad: {
                        maskMsg: "Carregando...",
                        showMask: true,
                        mode: "iframe",
                        url: url
                    }
                }, config)).show();
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager runat="server" />
            
            <ext:Button ID="Button3" runat="server" Text="Teste" Icon="ServerGo">
                <Listeners>
                    <Click Handler="newWindow('teste.aspx', {title: 'Exemplo', height: 200, width: 200});" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    By passing a 'config' object instead of named parameters when calling newWindow(), you get the flexibility of passing as many or little config options as you like. You only have to override certain properties and the others will be set to their default values.

    Hope this helps.

    Geoffrey McGill
    Founder
  4. #4

    RE: [EXAMPLE] How to create new windows

    *How to call this function or other desktop windows in desktop shortcuts ????*
  5. #5

    RE: [EXAMPLE] How to create new windows

    Hi,

    In 0.8 version we added ShortcutClick*Listener/AjaxEvent to the Desktop


  6. #6

    RE: [EXAMPLE] How to create new windows

    *Great and thanks...
  7. #7

    RE: [EXAMPLE] How to create new windows

    I also await ShortcutClick Listener/AjaxEvent to the Desktop.
    Thank you.
  8. #8

    RE: [EXAMPLE] How to create new windows

    Using this example, how would I embed a UserControl inside of the body of the new window?
  9. #9

    RE: [EXAMPLE] How to create new windows

    is it possible to pass icon to this function?
    thanks
  10. #10

    RE: [EXAMPLE] How to create new windows

    I have added code so that the same window only appears once if anybody is interested.

    
    
    function createDynamicWindow(app, urls, descr, ids, vHeight, vWidth) {
    
    var desk = app.getDesktop();
    
    var windows = desk.getManager().getBy(function() { return true; });
    
    var i = 0;
    
    for (i = 0; i <= windows.length - 1; i++) {
    
    if (windows[i].id == ids) {
    
    windows[i].show();
    
    return
    
    }
    
    }
    
    var w = desk.createWindow({
    
    id: ids,
    
    title: descr,
    
    width: vWidth,
    
    height: vHeight,
    
    maximizable: true,
    
    minimizable: true,
    
    pageX: 10,
    
    pageY: 10,
    
    autoLoad: {
    
    url: urls,
    
    maskMsg: "Loading...",
    
    mode: "iframe",
    
    showMask: true,
    
    CenterOnLoad: "false"
    
    
    
    }
    
    });
    
    w.show();
    
    
    
    }

    usage

    
    
    
    <Click Handler="createDynamicWindow(#{MyDesktop}, 'CompanyStructure.aspx', 'CompanyStructure', 'idCompanyStructure', 700, 1200);" />
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] IIS7 Windows 7 x Windows 2008
    By majunior in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Nov 08, 2011, 6:56 PM
  2. [CLOSED] Create multiple windows..
    By mattwoberts in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 11, 2011, 12:11 PM
  3. [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
  4. Replies: 1
    Last Post: Mar 17, 2009, 1:17 AM
  5. Replies: 1
    Last Post: Mar 29, 2008, 7:04 PM

Posting Permissions