【问题标题】:TideSDK bring window to top level on click of system notificationTideSDK 在点击系统通知时将窗口带到顶层
【发布时间】:2014-03-17 10:21:12
【问题描述】:

我正在使用tideSDK创建桌面应用。

我想显示某些事件的系统通知。下面的代码运行良好。

    //Create a callback function for the notification
var doSomething = function() {
    //Do something!
}

//Creating a notification and displaying it.
var notification = Ti.Notification.createNotification({
    'title' : 'Notification from App',
    'message' : 'Click here for updates!',
    'timeout' : 10,
    'callback' : doSomething,
    'icon' : 'app://images/notificationIcon.png'        
});

notification.show();

来自http://tidesdk.multipart.net/docs/user-dev/generated/#!/api/Ti.Notification

doSomething 方法中,我想将tideSDK 应用程序窗口带到顶层。

我试过Ti.UI.currentWindow.focus();

【问题讨论】:

    标签: windows desktop-application tidesdk


    【解决方案1】:

    setTopMostshow 可用于实现这一目标

    var window = Ti.UI.currentWindow;
    window.setTopMost(true);
    window.show()
    window.setTopMost(false);
    

    setTopMost(false)很重要,否则即使你想打开其他窗口,窗口也会一直显示在其他窗口之上

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-16
      • 1970-01-01
      • 2011-08-03
      • 1970-01-01
      • 2010-11-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多