PDA

View Full Version : [CLOSED] How to align a Window?



vadym.f
Aug 02, 2013, 2:34 PM
Hi,

I've noticed that InitCenter property has been removed from the Window object config. In this regard, I'm curious how to make a Window aligned to a specific element on the page on the very first show. The old 1.7 code doesn't work and the Window ends up centered initially. Please suggest the necessary adjustments.


<%@ 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 id="Head1" runat="server">
<title>Ext.Net 2.x</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
<script type="text/javascript">
var showWindow = function () {
var wnd = App.Window1;
wnd.alignTo(App.Button1.el);
wnd.setVisible(true);
};

</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:Viewport runat="server" Layout="FitLayout">
<Items>
<ext:Panel runat="server">
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:ToolbarFill>
</ext:ToolbarFill>
<ext:Button ID="Button1" runat="server" Text="Show Window">
<Listeners>
<Click Handler="showWindow();">
</Click>
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:Panel>
</Items>
</ext:Viewport>
<ext:Window ID="Window1" runat="server" Icon="CogEdit" Title="Edit" Width="500" Height="400"
Resizable="false" Collapsible="false" Hidden="true" Modal="true" Draggable="true">
<Items>
</Items>
</ext:Window>
</form>
</body>
</html>

Daniil
Aug 02, 2013, 4:01 PM
Hi Vadym,

Please use a show callback.

var showWindow = function () {
var wnd = App.Window1;

wnd.show(null, function () {
this.alignTo(App.Button1.el);
});
};

vadym.f
Aug 02, 2013, 4:24 PM
That was it, thanks much Daniil!