Results 1 to 3 of 3

Thread: stupid, but i know someone can help ...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    166

    stupid, but i know someone can help ...

    hello everyone !

    i've a cmd_PageDown button on a form, which is hidden.

    i'm trapping the pagedown key of keyboard and caling the cmdPageDown_click
    (i'm using pagedown to scroll down a picturebox control, its my application's demand !!)

    now my problem is that if a keep the pagedown key pressed continously, till the key is remain pressed, it will not display the page of the picturebox. only when i release the key , can i see the final page.

    is there any way by which, while my key is pressed, the command button is called continously and i can see the effect also simultaneously.

    its quite imp !!!!
    pls help

    shruti !

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    There might be other better methods, but one thats coming to my mind right now, is that u keep a timer, and enable it the moment the pagedown key is pressed, and disable it on when the key up event.

    In the timer event code, u can keep calling the btnPageDown_click sub, to get the desired effect

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106
    My suggestion would depend on the structure of the program. What I am thinking of would be that you set a global boolean on the KeyDown event, then clear the boolean on the KeyUp event. Have a function running a perpetual loop (or start a perpetual loop on the keydown event) that keeps recalling the desired function. You would also want a DoEvents in the loop, or else the thing would never end.

    Having written that, it seems that the simplest way would be for the keydown event to set a boolean and call a sub that started the perpetual loop. The loop continues while the boolean is True. The KeyUp event would set the boolean to False, which would terminate the perpetual loop. It's a bit ugly, but functional.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width