locked
how to detect when settings bar (charms bar) is shown?

    Question

  • How do I detect when the right hand side bar is shown?

    The one with the charms on it. Not sure what the proper name for it is.

    Saturday, June 16, 2012 5:15 AM

Answers

  • Can you use the onblur or onfocus events on window?  I'm not sure if they fire as soon as the charms bar is shown, but they definitely fire once you invoke anything on it (search, settings, etc.).

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, June 19, 2012 12:59 AM

All replies

  • Hi Patrick,

    I think you are talking about the Flyout.  You know when it is up since a user action makes it appear.  It will not pop up unless you tell it to in code.  Why do you need to know this and why can't you determine this yourself in code?

    -Jeff


    Jeff Sanders (MSFT)

    Monday, June 18, 2012 1:59 PM
    Moderator
  • Hi Jeff,

    I don't mean Flyouts, I mean the charms bar itself. The reason I want to detect this is that I want to pause my game as soon as the charms bar is visible not just when the user clicks on the settings charm.

    Hope this clarifies it.


    • Edited by PatrickKlug Tuesday, June 19, 2012 12:34 AM
    Tuesday, June 19, 2012 12:17 AM
  • Well, one thing i can say is, the documentation for WinJS.UI.ApplicationSettings won't help you since even the code examples contains bugs (as i previously pointed out in other topic here http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/16bc827e-0322-47be-97f2-2e2d808c97e1

    I read thoroughly the documentation for WinJS.UI.ApplicationSettings , i believe you're out of luck if you wanted to know whether the settings app is opened or not. I could be wrong though. You COULD however use the event listener for the event of opening setting charm. So, you pause your app when that event fires, and then resume it back after that event fires the second time ( the event for opening and closing setting charm is the same event, the name of the event is WinJS.Application.onsettings )

    Example :

    WinJS.Application.onsettings = function (e) {
     
      if (e.blaBlaBla) {
    
       // stop your app
      } else if (e.BlablaBla2) {
    
       // or resume your app 
      }
    }; 
    The above code solves your problem. Is it the answer you wanted ? ^_^




    Tuesday, June 19, 2012 12:33 AM
  • I don't mean just the settings charm. I want to know as soon as the entire right hand side 'charms bar' is shown. The one with Search, Share, Start, Devices etc.

    Tuesday, June 19, 2012 12:36 AM
    • Proposed as answer by Raymond Goldman Tuesday, June 19, 2012 12:43 AM
    • Unproposed as answer by PatrickKlug Tuesday, June 19, 2012 12:59 AM
    Tuesday, June 19, 2012 12:42 AM
  • No, this will let me know when the Settings charm is clicked not when the charms bar appears. As I've said, I want to know when the charms bar itself appears.
    • Edited by PatrickKlug Tuesday, June 19, 2012 12:58 AM
    Tuesday, June 19, 2012 12:48 AM
  • Then i am afraid, you're out of luck. I could be wrong, maybe later after i read the documentation more i will try to answer your question.
    Tuesday, June 19, 2012 12:57 AM
  • No problem. Thanks for trying to help me out :)
    Tuesday, June 19, 2012 12:59 AM
  • Can you use the onblur or onfocus events on window?  I'm not sure if they fire as soon as the charms bar is shown, but they definitely fire once you invoke anything on it (search, settings, etc.).

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, June 19, 2012 12:59 AM
  • I'm looking for the exact same thing.  Did you ever find a solution to this?  I'm creating a C++ Direct3D metro app.  I'm not seeing an OnBlur or OnFocus event in CoreWindow.

    • Edited by _Allen_ Friday, October 19, 2012 1:24 AM
    Friday, October 19, 2012 1:19 AM
  • Blur and Focus are HTML concepts. For a DirectX app look at the CoreWindow.Activated event.
    Friday, October 19, 2012 2:06 AM
    Owner
  • if (args.WindowActivationState == CoreWindowActivationState.Deactivated)
                {// Operation for Pause the game. . .
                }
    Monday, June 03, 2013 12:59 PM