Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Windows 8.1, 10, WindowsPhone, Windows UWP
  • Page:
  • 1

TOPIC:

scrolling via buttons 5 years 8 months ago #14049

  • MrFox
  • MrFox's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
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?

Please Log in or Create an account to join the conversation.

scrolling via buttons 5 years 8 months ago #14050

  • MrFox
  • MrFox's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
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?

Please Log in or Create an account to join the conversation.

scrolling via buttons 5 years 8 months ago #14059

  • goldkyo
  • goldkyo's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 18
  • Thank you received: 2
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
KeyDown += PDFReaderPage_KeyDown;
LostFocus += PDFReaderPage_LostFocus;
2. Deal with focus lost event
private void PDFReaderPage_LostFocus(object sender, RoutedEventArgs e)
{
Focus(FocusState.Keyboard);
}
3 Deal with the key down event
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);
    }
}
The following user(s) said Thank You: MrFox

Please Log in or Create an account to join the conversation.

scrolling via buttons 5 years 8 months ago #14065

  • MrFox
  • MrFox's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
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?

Please Log in or Create an account to join the conversation.

scrolling via buttons 5 years 8 months ago #14068

  • goldkyo
  • goldkyo's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 18
  • Thank you received: 2
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.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum