PDA

View Full Version : [CLOSED] desktop start menu subitem open up in wrong position



susanz
Dec 01, 2014, 11:36 PM
Hi, I use your desktop demo and changed the start menu to group items using button + menu items. When I click the button, the menu items opens up to the left-top corner of the desktop. Am I missing anything?
Thanks
-susan zhang



desktop.cshtml

@{
ViewBag.Title = "Desktop";
Layout = "~/Views/Shared/_Layout.cshtml";
}

@section headtag
{
<link href="/Areas/Desktop/Content/desktop.css" rel="stylesheet" />

<script>

var tile = function () {
Ext.net.Desktop.desktop.tileWindows();
};

var cascade = function () {
Ext.net.Desktop.desktop.cascadeWindows();
};


//var initSlidePanel = function () {
// this.setHeight(Ext.net.Desktop.desktop.body.getHei ght());

// if (!this.windowListen) {
// this.windowListen = true;

// this.el.alignTo(Ext.net.Desktop.desktop.body, 'tl-tr', [0, 0]);
// Ext.EventManager.onWindowResize(initSlidePanel, this);
// }
//};
</script>
}
@using Ext.Net;
@using Ext.Net.MVC;


@section content
{
@(
Html.X().Desktop()
.ID("FABDesktop")
.Listeners(l =>
{
l.Ready.BroadcastOnBus = "App.Desktop.ready";
})
.Modules(
Html.X().DesktopModule()
.ModuleID("Hello")
.AutoRun(false)
.Window(
Html.X().Window()
.Plain(true)
.Padding(10)
.Width(150)
.Height(100)
.Title("Greeting")
.CloseAction(CloseAction.Destroy)
.Maximizable(false)
.Minimizable(false)
.Html("Welcome to CPM FAB Application!")
)


)
.DesktopConfig(
Html.X().DesktopConfig()
.ShortcutDragSelector(true)
.ShortcutDefaults(defaults =>
{
defaults.IconCls = "x-default-shortcut";
})
)
.StartMenu(
Html.X().DesktopStartMenu()
.Title("Ext.Net Desktop")
.Icon(Icon.Application)
.Height(200)

.ToolConfig(
Html.X().Toolbar()
.Width(100)
.Items(
Html.X().Button().Text("Application")
.Menu(Html.X().Menu()
.Items(
Html.X().MenuItem()
.Text("Save Application Layout")
.OnClientClick("alert('clicked')")
.Icon(Icon.DatabaseSave),
Html.X().MenuItem()
.Text("Restore Application Layout")
.OnClientClick("alert('clicked')")
.Icon(Icon.Reload)
)
)

)
)
)//end of start menu
.TaskBar(
Html.X().DesktopTaskBar()
.TrayWidth(200)
.QuickStart(
Html.X().Toolbar()
.Items(
Html.X().Button()
.Handler("tile")
.Icon(Icon.ApplicationTileHorizontal)
.ToolTip("Tile Horizontal"),

Html.X().Button()
.Handler("tile")
.Icon(Icon.ApplicationTileVertical)
.ToolTip("Tile Vertical"),
Html.X().Button()
.Handler("cascade")
.Icon(Icon.ApplicationCascade)
.ToolTip("Cascade windows")
)
)
.Tray(
Html.X().Toolbar()
.Items(
Html.X().Button()
.ID("")
.Text("FAB % in Key")
.MenuArrow(false)
.Cls("x-bold-text")
.MenuAlign("br-tr")
.MenuItem(
Html.X().CheckMenuItem()
.Group("Application")
.Text("FAB % in Key")
.Checked(true)
.CheckHandler("function(item, checked) {checked && App.LangButton.setText('FAB % in Key');}"),

Html.X().CheckMenuItem()
.Group("Application")
.Text("????")
.Checked(true)
.CheckHandler("function(item, checked) {checked && App.LangButton.setText('????');}"),

Html.X().MenuSeparator(),

Html.X().MenuItem()
.Text("Show Job Status")
),
Html.X().StatusBar()
.ID ("StatusBar1")
.DefaultText("Ready"),

Html.X().ToolbarFill()
)
)
)

)



}

Daniil
Dec 03, 2014, 10:59 AM
Hi @susanz,

We can suggest this solution.


.ToolConfig(
Html.X().Toolbar()
.Width(100)
.Items(
Html.X().Button()
.Text("Application Menu")
.Menu(Html.X().Menu()
.AllowOtherMenus(true)
.Items(
Html.X().MenuItem()
.Text("Save Application Layout")
.OnClientClick("alert('clicked')")
.Icon(Icon.DatabaseSave),
Html.X().MenuItem()
.Text("Restore Application Layout")
.OnClientClick("alert('clicked')")
.Icon(Icon.Reload)
)
)

)
.Listeners(events => events.Add.Handler = @"var me = this;

if (!item.menu) {
item.on({
click: function() {
me.hide();
}
});
}")
)

susanz
Dec 03, 2014, 3:16 PM
Daniil, That works great! Thanks for your help!
-zhang