locked
Is there any event when using "alt+tap" or "swipe gesture" to switch to other app from mine, except 'onblur'? RRS feed

  • Question

  • Hi,

    I want to do something when  using "alt+tap" or "swipe gesture" to switch to other app from mine. I try window.onblur event.

    But when I click 'Settings' or other buttons on 'Charm', 'onblur' event is fired which I do not expect.


    • Edited by Lattimore Friday, April 12, 2013 9:59 AM
    Friday, April 12, 2013 9:58 AM

Answers

  • What exactly are you trying to do when the focus goes away from your app to another app? Are you trying to save "state" of your app when some other app comes to the foreground? If you are trying to save the state when your app is being suspended, then there are better ways of doing this - such as registering for the checkpoint event and then saving the data. If that's the case then the following link should help: http://msdn.microsoft.com/en-us/library/windows/apps/hh465138.aspx If not, please clarify what exactly is the end goal of registering for the onblur event.

    Thanks,

    Prashant


    @prashantphadke || Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog! http://aka.ms/t4vuvz

    • Marked as answer by Lattimore Monday, April 15, 2013 6:53 AM
    Friday, April 12, 2013 9:20 PM
    Moderator
  • I find document.onmsvisibilitychange event that I can use.
    • Marked as answer by Lattimore Monday, April 15, 2013 6:53 AM
    Monday, April 15, 2013 6:53 AM

All replies

  • What exactly are you trying to do when the focus goes away from your app to another app? Are you trying to save "state" of your app when some other app comes to the foreground? If you are trying to save the state when your app is being suspended, then there are better ways of doing this - such as registering for the checkpoint event and then saving the data. If that's the case then the following link should help: http://msdn.microsoft.com/en-us/library/windows/apps/hh465138.aspx If not, please clarify what exactly is the end goal of registering for the onblur event.

    Thanks,

    Prashant


    @prashantphadke || Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog! http://aka.ms/t4vuvz

    • Marked as answer by Lattimore Monday, April 15, 2013 6:53 AM
    Friday, April 12, 2013 9:20 PM
    Moderator
  • What exactly are you trying to do when the focus goes away from your app to another app? Are you trying to save "state" of your app when some other app comes to the foreground? If you are trying to save the state when your app is being suspended, then there are better ways of doing this - such as registering for the checkpoint event and then saving the data. If that's the case then the following link should help: http://msdn.microsoft.com/en-us/library/windows/apps/hh465138.aspx If not, please clarify what exactly is the end goal of registering for the onblur event.

    Thanks,

    Prashant


    @prashantphadke || Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog! http://aka.ms/t4vuvz

    Hi,

    I try to stop a playing video in my app when the focus goes away from my app. The 'onsuspended' event will be fired after 10 seconds when I switch to another app from mine. It is a little late. And if I use 'onblur' event, when I click a button on Charm, the video will be paused which I do not expect.

    Monday, April 15, 2013 1:07 AM
  • I find document.onmsvisibilitychange event that I can use.
    • Marked as answer by Lattimore Monday, April 15, 2013 6:53 AM
    Monday, April 15, 2013 6:53 AM