PDA

View Full Version : [CLOSED] How to make a window belonging to a desktop?



feanor91
Apr 19, 2012, 9:01 AM
Hello

As desktopWindow element has disapeared, I want to know how I can achive that:

I have define an about window called from my start menu like that :



<ext:DesktopModule ModuleID="About">
<Launcher Text="About..." Icon="Information" />
<Window>
<ext:Window
runat="server"
Icon="Information"
Width="250"
Height="200"
Layout="Fit"
Hidden="True"
ExpandOnShow="True"
MinHeight="100"
MinWidth="100"
Maximizable="False"
Resizable="False"
Title="About"
Html="<br /><br /><center><b>ResMed KPIs global Version 2.0.0.0 Alpha 1</b></center><br /><br /><center><b><a href='javascript:#{wndNews}.show();'>What's new in this version</a></b></center><br /><br /><center>For query, information, help: <a href='mailto:bruno.teuile@resmed.fr'>contact</a></center>"
Minimizable="False"
Modal="True">
</ext:Window>
</Window>
</ext:DesktopModule>


In this window, I have a link that will open my changelog window define like that somewhere in the aspx page:



<ext:Window
ID="wndNews"
runat="server"
Icon="Help"
Width="1000"
Height="600"
Layout="Fit"
Hidden="True"
ExpandOnShow="True"
MinHeight="100"
MinWidth="100"
Maximizable="False"
Minimizable="True"
Resizable="False"
Title="What's new in this version"
Html="<embed id='DOC' src='documentation/NewVersion.pdf' width='980' height='600'>"
Modal="False">
</ext:Window>


Question : how can I connect this window to Desktop so I can see it in the taskbar and minimized it if needed?

Daniil
Apr 19, 2012, 3:42 PM
Hi,

You should create a Window using the Desktop CreateWindow server method.

this.Desktop1.CreateWindow(new Window()
{
Title = "Dynamic Window"
});
or client side

App.Desktop1.desktop.showWindow({
id : "MyWindow1",
title : "Dynamic Window",
width : 200,
height : 100
});

feanor91
Apr 19, 2012, 3:54 PM
Wow! this is a big drawback from version 1.3, it was so easy to create a desktop window with DesktopWindow element...Helas, I was fear it was the only answer.

If I undrstand well, all elements contained by the window must be create this way, this means, gridpanel, store for grid, top/bottom bar, and so on have to be created by code and not by using ext.net elements. Am I right.

a module could be added only at first level menu?

Daniil
Apr 19, 2012, 4:26 PM
Please clarify what way do you attach that DesktopWindow to the Desktop in v1?

feanor91
Apr 19, 2012, 4:36 PM
I simply create


<DesktoWindow Id="toto">

</DesktoWindow>

and in the menu, on the click listener:


#{toto}.show()

More details taken from here http://examples1.ext.net/#/Desktop/Introduction/Overview/ (http://examples1.ext.net/#/Desktop/Introduction/Overview/) :


<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">
<Listeners>
<Click Handler="#{winCustomer}.show();" />
</Listeners>
</ext:MenuItem>
<ext:MenuItem Text="Company Info" Icon="Lorry">
<Listeners>
<Click Handler="#{winCompany}.show();" />
</Listeners>
</ext:MenuItem>
<ext:MenuItem Text="Web Browser" Icon="World">
<Listeners>
<Click Handler="#{winBrowser}.show();" />
</Listeners>
</ext:MenuItem>
<ext:MenuItem Text="Create dynamic" Icon="World">
<Listeners>
<Click Handler="createDynamicWindow(#{MyDesktop});" />
</Listeners>
</ext:MenuItem>
</Items>
</ext:Menu>
</Menu>
</ext:MenuItem>
<ext:MenuSeparator />
</Items>


<ext:DesktopWindow
ID="winCompany"
runat="server"
InitCenter="false"
Title="Company Info"
Icon="Lorry"
Width="550"
Height="320"
PageX="200"
PageY="125"
Layout="Fit">
<TopBar>
<ext:Toolbar ID="ToolBar1" runat="server">
<Items>
<ext:Button ID="btnSave" runat="server" Text="Save" Icon="Disk">
<Listeners>
<Click Handler="#{GridPanel1}.save();" />
</Listeners>
</ext:Button>
<ext:Button ID="btnLoad" runat="server" Text="Reload" Icon="ArrowRefresh">
<Listeners>
<Click Handler="#{GridPanel1}.load();" />
</Listeners>
</ext:Button>
<ext:Button ID="extbtnedit" runat="server" Icon="Add">
<ToolTips>
<ext:ToolTip ID="ToolTip2" Title="Edit Entry" runat="server" Html="Edit" />
</ToolTips>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Items>
<ext:GridPanel
ID="GridPanel1"
runat="server"
StoreID="Store1"
StripeRows="true"
Border="false"
AutoExpandColumn="Company">
<ColumnModel runat="server">
<Columns>
<ext:Column ColumnID="Company" Header="Company" Width="160" DataIndex="company" />
<ext:Column Header="Price" Width="75" DataIndex="price">
<Renderer Format="UsMoney" />
</ext:Column>
<ext:Column Header="Change" Width="75" DataIndex="change">
<Renderer Fn="change" />
</ext:Column>
<ext:Column Header="Change" Width="75" DataIndex="pctChange">
<Renderer Fn="pctChange" />
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<LoadMask ShowMask="true" />
<BottomBar>
<ext:PagingToolbar ID="PagingToolBar2" runat="server" PageSize="10" StoreID="Store1" />
</BottomBar>
</ext:GridPanel>
</Items>
</ext:DesktopWindow>

Daniil
Apr 19, 2012, 5:52 PM
Honestly, I was surprised that it works in v1.

In v2 you can set up a DesktopModule and open its Window from anywhere.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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 runat="server">
<title>Ext.NET Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />

<ext:Desktop ID="Desktop1" runat="server" BackgroundColor="black">
<Modules>
<ext:DesktopModule ModuleID="Module1">
<Window>
<ext:Window runat="server" Title="Greeting" Html="Hello!" />
</Window>
</ext:DesktopModule>
</Modules>
<StartMenu runat="server" Height="300">
<MenuItems>
<ext:MenuItem runat="server" Text="Open Window">
<Listeners>
<Click Handler="#{Desktop1}.getModule('Module1').createWindow();" />
</Listeners>
</ext:MenuItem>
</MenuItems>
</StartMenu>
</ext:Desktop>
</body>
</html>

feanor91
Apr 19, 2012, 5:56 PM
Perfecto, I think it will make the work. By the way, for v1, it id your own desktop example.

Daniil
Apr 19, 2012, 6:02 PM
By the way, for v1, it id your own desktop example.

Well, yes. But I thought you wanted to avoid defining Modules for these windows. Never mind.