Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Windows 8.1, 10, WindowsPhone, Windows UWP

scrolling via buttons

More
IP: 80.87.117.26 7 years 6 months ago #14049 by MrFox
scrolling via buttons was created by MrFox
Hello.
Where do I have to look or what do I have to change to make it possible to scroll in the PDF Viewer with the key buttons?
For example scrolling up by pressing the "up" key and scrolling down for pressing the "down" key?
More
IP: 80.87.117.26 7 years 6 months ago #14050 by MrFox
Replied by MrFox on topic scrolling via buttons
I found a way to scroll via the arrow keys.
In PDFView.cs:
public PDFView(Canvas parent)
{
//your code here
m_scroller.IsTabStop = true;
}

But I have a problem now. If I click on the PDF I can pull my mouse up and down. When doing so the PDF also moves up and down.
When I move my mouse out of PDF Reader the problem does not exist anymore (till I click into the pdf again). Any suggestions so I can click into the pdf without allowing the mouse to scroll up/down?
More
IP: 212.97.62.176 7 years 6 months ago #14059 by goldkyo
Replied by goldkyo on topic scrolling via buttons
Hi,
The "IsTabStop" property is not designed for this purpose it's for navigating from different UI components by using the TAB key. It will take the focus from canvas and hold it which may introduce the issue. I suggest you to implement the "scroll via arrow keys" function in following way.
1. Set the necessary listeners to the PARENT WINDOW
Code:
KeyDown += PDFReaderPage_KeyDown; LostFocus += PDFReaderPage_LostFocus;
2. Deal with focus lost event
Code:
private void PDFReaderPage_LostFocus(object sender, RoutedEventArgs e) { Focus(FocusState.Keyboard); }
3 Deal with the key down event
Code:
private void PDFReaderPage_KeyDown(object sender, KeyRoutedEventArgs e) { if (e.Key == Windows.System.VirtualKey.Down) { PDFPos pos = m_view.vGetPos(0, 0); m_view.vSetPos(pos, 0, -50); } else if (e.Key == Windows.System.VirtualKey.Up) { PDFPos pos = m_view.vGetPos(0, 0); m_view.vSetPos(pos, 0, 50); } }
More
IP: 80.87.117.26 7 years 6 months ago #14065 by MrFox
Replied by MrFox on topic scrolling via buttons
Hey.
It works but i found an issue.
When you click on the thumbnail Button and select a page the arrow-key scrolling does not work anymore. Any Ideas why?
More
IP: 212.97.62.176 7 years 6 months ago #14068 by goldkyo
Replied by goldkyo on topic scrolling via buttons
Hi,

I just tried to reproduce the issue according to your description. But it works fine with/without thumbnail displaying; before & after clicking on the thumbnail and jump to another page. One possible cause I can imagine is that the object you set the KeyDown event handler lost the focus and cannot receive the KeyDown event any more. That is why I was emphasizing that you should set the listener to the PARENT WINDOW. Would you please check that? Thank you.
Time to create page: 0.419 seconds
Powered by Kunena Forum