Delegate touch gesture handling to WebView's content - windows-8

In my WinRT (Metro/Store) XAML-based app I'd like to be able load an external web site in the WebView in a way that would propagate all the touch events (pinch zoom, slide horizontally and vertically) to the web site itself - instead of having the WebView handle them.
I tied to set WebView's ManipulationMode to "None".
I tried to set all the ScrollViewer properties to "False" or "Disabled".
I even tried to subsribe to WebView's ManipulationStarting, ManipulationDelta and ManipulationCompleted events (setting e.Handled = true for each of them).
WebView documentation indicates that the current implementation is quite limited, especially in terms of interactivity.
Does the fact that it actually uses IE10 in Document Mode mean that there is no way to reach the original (content) web site's interactivity level?
Update: mouse gestures (such as click and drag) are working OK, being properly passed on to the web content for handling; it's just the touch interactions that I need to figure out.

Related

Pass TappedEvent to a sibling controll in uwp

I have a user control with a bunch of buttons behind a scroll viewer that has a grid with a bunch of rows in it. The first row is empty. The buttons in user control need to respond to tap/click when not obscured by scroll viewer's content. My problem is that the scroll viewer caches the tap event and it is not passed to the user control because it is a sibling to the scroll viewer. I would like to somehow pass/propagate the tap event to the user control to get the buttons working. I can't find a good solution to this issue because there seems to be no RaiseEvent(e) method on UI elements in uwp. Due to specific requirements, the whole page needs to react to scroll and the buttons are required to be behind the scroll viewer content. Does anyone know if it is possible to pass the whole event to another element or somehow allow for both controls to handle it? Thanks in advance.

How to have multiple proxy icons in Cocoa document windows?

Most Cocoa applications, provided they call NSWindow's -setRepresentedFilename:, will display a nice little proxy icon at the top-centre of their NSWindows.
Here's an example of the Preview app with a PDF document:
Xcode, somehow, manages to display 2 proxy icons - one for the project file and the other for the current document in the source display.
Does anyone know how they do that? window:shouldPopUpDocumentPathMenu: in NSWindowDelegate seems very close - you could probably position your custom path menus with this. But there doesn't seem to be anything that would allow you to actually display the two proxy icons themselves.
Any ideas?
Unfortunately Apple has access to APIs the rest of us don’t. Messing with the title bar is really hard.
The best I can suggest is making your window NOT have a standard title bar, and then placing the buttons yourself by calling [self standardWindowButton:X] for each of the close, resize, and miniaturize buttons you want. Then place your own document icon and title textField.
You’ll likely have to track when the window loses or gains key or main status and modify the buttons accordingly (Cocoa fetches new buttons each time this happens, not sure why). Whee! Good luck!

iOS 6 AppStore apps list UIScrollView behaviour

Does anyone know how to implement the behaviour of scrollview in iOS 6 AppStore app lists? Particularly, paging of 3,5 icons (half of icon in the right side), and when the list ends - half of the icon in the left side.
Tried so far:
1. Custom gesture recognizer (looks a bit hacky + a lot of math in the code)
2. Different configurations of scrollview and its subviews (insets, frame, content size, etc.), but it's still not working as expected
I am not 100% sure if the App Store app actually uses UIScrollView - it used to be mainly HTML based.
Regardless, you should be able to use the relatively new delegate method scrollViewWillEndDragging:withVelocity:targetContentOffset:, introduced in iOS 5. This method is designed for you to move the scroll view to a custom position once the user lifts their finger without needing to worry about deceleration / velocity (i.e, custom paging offsets). You'll need to make sure your scroll view is set not to page for this delegate method to be triggered.
Once it is triggered (when the user lifts their finger off the screen) you can calculate the required content offset and set the passed in targetContentOffset property. The scroll view will then automatically decelerate to the appropriate content offset you supplied.

Cocoa - WebViews inside NSTabView

I am developing an application with an NSTabView with multiple NSTabViewItems. Each of the NSTabViewItems has a WebView subview. The WebView works as expected except when Flash or Silverlight are running in one of the WebViews. If, while Flash or Silverlight are running, a different tab is selected, the media will stop. When that tab is selected again, the media will restart. Is there any way around this (i.e. to allow the media to continue to run when a different NSTabViewItem is selected)? Does the NSTabViewItem send a message to its subviews when a different NSTabViewItem has been selected?
I'm not sure if this is why, but try check your webviews if their shouldUpdateWhileOffscreen is enabled. If it's enabled but the other tabs still doesn't load, then I'm guessing it's the design of the NSTabView, which is something on the lines of encoding it when the tab switches away, then decoding it when the user selects that tab again. In that case, I would probably do something like having a NSTabView with empty views and put the WebViews as subviews of the content view, overlaying each other and set the WebViews as hidden/visible whenever another tabview is selected.

Controlling NSSegmentedControl with the keyboard

I have a form in my Cocoa app that contains an NSSegmentedControl that I want to be controllable via the keyboard. It seems that NSSegmentedControl is very reluctant to become the first responder, however.
Setting the initial first responder of the window to the segmented control does nothing -- it will not have keyboard focus when the window is first loaded. It does receive focus if I manually set the first responder like this, however:
[segmentedControl.window makeFirstResponder: segmentedControl];
That will work fine if the only part of the form is the segmented control. If I add another field (say, an NSTextField), and I set the nextResponder of the segmented control to that field, the segmented control will never become first responder. Focus will immediately go to the text field, and pressing tab to switch back to the segmented control doesn't work.
I've tried subclassing NSSegmentedControl and overriding acceptsFirstResponder, becomeFirstResponder, etc. to no avail. The only one that makes any difference is resignFirstResponder -- if I return NO from that method then the segmented control will indeed retain focus, but obviously I don't want it to retain focus all the time.
Any ideas on how to get the control to behave like a normal responder?
It's behaving as intended. Not all controls participate in the "key view loop". Full keyboard navigation is turned on through Universal Access in System Preferences for all apps and it's not for individual apps to implement on their own.
It's best not to use a segmented control in a form intended for heavy keyboard entry. NSPopUpButton works more closely to what we all exepect in a web form so it's not as if it's necessarily the wrong choice in your app's UI.
Rather than answer exactly the question you asked (which someone else can do), I humbly suggest you choose on the side of functionality at the cost of a slightly prettier UI element since that prettier UI element wasn't intended to get along with the keyboard.