PDA

View Full Version : [CLOSED] Initially maximized window does not restore to fixed size



AaronDev
Oct 16, 2014, 12:49 AM
In the desktop module windows with Hidden=True and Maximized=True do not restore to the fixed sizes set in the window. If Hidden= false the window will restore to the correct size but obviously shows as soon as the desktop is loaded. I would imagine the Hidden=true should work the same as the not Hidden window but as a workaround is it better to open the window normally and then maximize in code, or listen to the restore and override the height & width?



@(
Html.X().Window()
.ID("WindowTest")
.Width(1000)
.Height(500)
.Maximizable(true)
.Maximized(true)
.Hidden(false)
.Items(Html.X().Label().Text("Window Hidden False"))

)

@( Html.X().Window()
.ID("WindowTest2")
.Width(1000)
.Height(500)
.Maximizable(true)
.Maximized(true)
.Hidden(true)
.Items(Html.X().Label().Text("Window2 Hidden True"))
)

@(Html.X().DesktopModuleProxy().Module(
Html.X().DesktopModule()
.ModuleID("WindowTestmod")
.Shortcut(
Html.X().DesktopShortcut()
.Name("open")
.Handler("App.WindowTest.show(this);")
)
)
)

Daniil
Oct 16, 2014, 3:08 PM
Hi @AaronDev,

As a solution I would suggest the following.

If you need a Window to be hidden initially and to be maximized at the initial appearance, please keep .Hidden(true), remove .Maximized(true) and and this Show listener for the Window:


.Listeners(events =>
{
events.Show.Handler = "this.maximize();";
events.Show.Single = true;
})

AaronDev
Oct 16, 2014, 4:40 PM
Thanks Daniil

I ended up adding maximise() as you suggest (but didn't know about .Single, very handy).
Doesn't look great opening and then re-sizing but it's doing what I need.

Your help is much appreciated.

Daniil
Oct 22, 2014, 7:52 AM
Doesn't look great opening and then re-sizing

Agree. It looks there is a better workaround.

Example

@{
var X = Html.X();
}

<!DOCTYPE html>
<html>
<head>
<title>Ext.Net.MVC v2 Example</title>
</head>
<body>
@X.ResourceManager()

@(X.Desktop()
.Modules(
X.DesktopModule()
.ModuleID("DesktopModule1")
.Shortcut(X.DesktopShortcut().Name("Open").Handler("App.Window1.show(this);"))
)
)

@(X.Window()
.ID("Window1")
.Title("Window")
.Hidden(true)
.Maximized(true)
.Tools(X.Tool().Type(ToolType.Restore).Handler("owner.ownerCt.restore();"))
.Listeners(events =>
{
events.Restore.Handler = "this.center();";
events.Restore.Single = true;
})
)
</body>
</html>

AaronDev
Oct 22, 2014, 9:23 AM
Fantastic, works perfectly

Thanks again Daniil