-->

How to make TideSDK window not closeable?

2019-08-09 23:37发布

问题:

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>



标签: tidesdk