locked
how to detect when the charms bar is shown?

    Question

  • This question was asked in the "Building Windows Store apps using HTML5/Javascript" forum, but answer there doesn't seem to apply for C++ DirectX apps.

    How do I detect when the charms bar is displayed (the one that you bring up using Windows + C)?

    • Edited by _Allen_ Friday, October 19, 2012 1:41 AM
    Friday, October 19, 2012 1:41 AM

Answers

  • Hi _Allen_,

    There isn't a direct notification that the charms bar is displayed. In most cases listening to the Windows.Activated event or CoreApplicationView.Activated event to know when your main window is deactivated will give you the information you need.

    --Rob

    • Marked as answer by _Allen_ Saturday, October 20, 2012 1:13 AM
    Friday, October 19, 2012 1:56 AM
    Owner

All replies

  • Hi _Allen_,

    There isn't a direct notification that the charms bar is displayed. In most cases listening to the Windows.Activated event or CoreApplicationView.Activated event to know when your main window is deactivated will give you the information you need.

    --Rob

    • Marked as answer by _Allen_ Saturday, October 20, 2012 1:13 AM
    Friday, October 19, 2012 1:56 AM
    Owner
  •      Hi Everybody!!!

         This thread is rather old, but, since I couldn't find the answer anywhere, I thought I'd just add a post here so all other developers could have a reference if they happen to face this same challenge.

         In my case, the "Activated" event from neither the CoreWindow nor the CoreApplicationView detected the event of showing the Charm Bar. However, the "PointerCaptureLost" event from the CoreWindow did the trick.

         In a nutshell, during the game session, if the player accidentally summons the charm bar (which happens in a quick reaction to a game element), the "PointerCaptureLost" event is triggered announcing that something other than the game has focus. I'm using that event to "Pause" the game, so the player doesn't get brutally dismembered while figuring out how to close the charm bar.

         I hope it helps!!!

         Tarh Ik

    PS: This posting has been posted "AS IS"


    Tarh ik

    Wednesday, February 04, 2015 4:28 PM
  • That will only work in very narrow circumstances: you'll need to have the pointer captured before you'll get a PointerCaptureLost message.
    Saturday, February 07, 2015 3:33 AM
    Owner
  •      Hi Rob,

         I'd agree with you, but it happens to me everytime using touch devices: Assume a game using DirectX that uses touch as the primary input. During the gaming session, if the player drags a game element all the way to the right side of the screen and then he drags the element back towards the center, the Charm Bar appears.
     a) On a PC, the charms appear in the form of a white ghost, however the player is still in control of the game.
     b) On a tablet, though, the charm bar appear black solid, stamping the clock on the other side of the screen. These two black boxes pretty much surprises the player, taking him "out of the zone". At this point the player loses control of the game. It is in this situation when the "PointerCaptureLost" event is triggered, which I use to pause the game.

         It's just my two cents, though, and I'm posting the information as a "tip" to take into consideration.

         Best Regards,

         Tarh Ik

     


    Tarh ik

    Saturday, February 07, 2015 8:20 AM
  • Again: that's a specific touch pattern (you've touched down and captured the pointer), not a general pattern that one should rely on. It won't trigger if the user opens the charms normally rather than as a side-effect of dragging the game element. In cases like yours it may be a useful addition to more general handling.
    Tuesday, February 10, 2015 5:43 PM
    Owner