locked
Persistent Flyout? Control that asks for user input?

    Question

  • Hi,

    I would like to display a pop up window to ask users for comments in my application. I searched in the development center and found the flyout control maybe a good option to collect user input. But flyout control will dismiss when it lose focus. In my case, I don't want this to happen. So is there any properties of flyout control to set so that it doesn't disappear? 

    If the flyout control is not the best option for this case, please also advise what would be the best control.

    Thanks,

     

    Wednesday, January 11, 2012 11:19 PM

Answers

  • Unfortunately No.  That logic is not built into that control.

    Add code to capture the beforehide event and in your shouldHide function that you define, put a breakpoint.  You will see that the div that captures the mouse click does not look to see if this event is canceled. 

    WinJS.UI.getControl(flyout).addEventListener("beforehide", shouldHide);


    You could of course do something similar in your control but look for the cancel or always refuse to close it and only close when the user hits a button on your control.

    -Jeff


    Jeff Sanders (MSFT)
    Thursday, January 12, 2012 7:11 PM
    Moderator

All replies

  • Hi Louis,

    It sounds like you should use the MessageDialog class: http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.popups.messagedialog.aspx

    -Jeff


    Jeff Sanders (MSFT)
    Thursday, January 12, 2012 1:13 PM
    Moderator
  • Hi Jeff,

    I checked MessageDialog too, but I thought MessageDialog is for asking user simple questions. But in my case, I am asking user to input text. Isn't MessageDialog only good for simple answers with "yes/no" buttons?

     

    Thanks,

    Thursday, January 12, 2012 3:56 PM
  • Hi Louis,

    Sorry I missed the input part of your question.  Flyout is the closest thing you will find.  The flyout sample shows giving feedback to the user if they did not complete the order (or login information). 

    If you do not think that type of interaction would work for you, you could create something similar and put a div behind the object to eat mouse clicks so that the user could not put focus on another element.  Maybe even a semi transparent item over the whole screen to make it appear dim.

    The code for Popups and Flyout controls is in your WinJS files if you want to get an idea of how it is done in the library.

    -Jeff


    Jeff Sanders (MSFT)
    Thursday, January 12, 2012 6:35 PM
    Moderator
  • Hi Jeff,

    Thanks for the quick reply.

    Since flyout control disappears when lose focus, is it possible to eat mouse click for flyout control?

     

    Thanks,

    Louis

    Thursday, January 12, 2012 7:06 PM
  • Unfortunately No.  That logic is not built into that control.

    Add code to capture the beforehide event and in your shouldHide function that you define, put a breakpoint.  You will see that the div that captures the mouse click does not look to see if this event is canceled. 

    WinJS.UI.getControl(flyout).addEventListener("beforehide", shouldHide);


    You could of course do something similar in your control but look for the cancel or always refuse to close it and only close when the user hits a button on your control.

    -Jeff


    Jeff Sanders (MSFT)
    Thursday, January 12, 2012 7:11 PM
    Moderator
  • Thank you very much Jeff.
    Thursday, January 12, 2012 8:38 PM
  • Hey Jeff,

    I came up with the idea using Setting Charm to bring out 2nd level of charm to get user's feedback. Can setting charm be made persistent?

    Friday, January 13, 2012 12:31 AM