How to make TideSDK window not closeable?

无人久伴 提交于 2020-01-05 07:46:06

问题


I am trying to make a TideSDK application that cannot be closed and minimizes to the system tray.

I have the system tray part figured out for the most part, but when I specify "closeable" in tiapp.xml it doesn't do anything. i.e. I still see the "close" button and it closes the app entirely.

<window>
    <id>someApp</id>
    <title>Alerts</title>
    <url>app://index.html</url>
    <width>800</width>
    <max-width>800</max-width>
    <min-width>800</min-width>
    <height>600</height>
    <max-height>600</max-height>
    <min-height>600</min-height>
    <fullscreen>false</fullscreen>
    <resizable>false</resizable>
    <chrome scrollbars="false">true</chrome>
    <maximizable>false</maximizable>
    <minimizable>true</minimizable>
    <closeable>false</closeable>
</window>

How to make it not closeable?


回答1:


Have a look at this solution - https://gist.github.com/4639473




回答2:


I've learned that the most flexible way to manage an app that "minimizes/closes to systray" is to use a hidden main window that launches a secondary window.

Secondary windows appear to be more flexible, plus you have the ability to manage them from the main hidden window.

This is all I left in my main window's code:

<head>
    <script src="app://js/jquery.min.js"></script>

    <script>
        $(function(){
            Ti.UI.currentWindow.hide();

            var alert_window = Ti.UI.createWindow({
                id: "alertWindow",
                url: "app://alert.html",
                title: "My New Window",
                baseURL: "app://alert.html",
                x: 100,
                y: 100,
                width: 500,
                minWidth: 500,
                maxWidth: 500,
                height: 500,
                minHeight: 500,
                maxHeight: 500,
                maximizable: true,
                minimizable: true,
                center: true,
                closeable: false,
                resizable: false,
                fullscreen: false,
                maximized: false,
                minimized: false,
                usingChrome: false,
                topMost: true,
                visible: true,
                transparentBackground: false,
                transparency: false
            });

            alert_window.open();
            alert_window.setTopMost( true );
        });
    </script>
</head>

<body>
</body>



来源:https://stackoverflow.com/questions/14652830/how-to-make-tidesdk-window-not-closeable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!