23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

function confirmOrder() {<br />

bought = true;<br />

document.getElementById("confirmFlyout").winControl.hide();<br />

}<br />

// On dismiss of the flyout, determine if it closed because the user pressed the buy button.<br />

// If not, then the flyout was light dismissed.<br />

function onDismiss() {<br />

if (!bought) {<br />

// (Sample displays a dismissal message on the canvas)<br />

}<br />

}<br />

Handling the login controls in Scenario 2 is pretty much the same, with some added code to make<br />

sure that both a username and password have been given. If not, the Login button handler displays an<br />

inline error and sets the focus to the appropriate input field:<br />

As the flyout of Scenario 2 is a little larger, the default placement of 'auto' on a 1366x768 display (as<br />

in the simulator) makes it appear below the button that invokes it. There isn’t quite enough room above<br />

that button. So try setting placement to 'top' in the call to show:<br />

function showLoginFlyout() {<br />

// ...<br />

document.getElementById("loginFlyout").winControl.show(loginButton, "top");<br />

}<br />

Then you can see how the flyout gets scrollbars because the overall control element is too short:<br />

297

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!