Results 1 to 7 of 7

Thread: Put Focus away ?

  1. #1

    Thread Starter
    Hyperactive Member Matt-D's Avatar
    Join Date
    Nov 1999
    Location
    Mettmann, Germany
    Posts
    305

    Put Focus away ?

    Hello vbers!

    Ho do I put the Focus away from an element?
    I'm doing a small picture viewer, which has only a PictureBox and two ScrollBars in it. The user can move the picture by keyboard and by using the ScrollBars.
    Now the problem: When the picture is moved by the ScrollBars first and then by keyboard the Focus reminds on the bars and the picture moves wrong.

    What can I do?

    Matt-D

  2. #2
    Lively Member
    Join Date
    Nov 2002
    Posts
    78
    SOMETHING LIKE

    VB Code:
    1. Private Sub VScroll1_KeyUp(KeyCode As Integer, Shift As Integer)
    2. Picture1.SetFocus
    3. End Sub

  3. #3
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    Or you can add another control that does nothing(like a textbox) and set the focus to that.


    Has someone helped you? Then you can Rate their helpful post.

  4. #4

    Thread Starter
    Hyperactive Member Matt-D's Avatar
    Join Date
    Nov 1999
    Location
    Mettmann, Germany
    Posts
    305
    • to yoey_yones
    You can't set the focus to a PictureBox!

    • to manavo11
    That's crap. I want to avoid something like this

    Matt-D

  5. #5
    Lively Member
    Join Date
    Nov 2002
    Posts
    78
    WELL SET FOCUS TO SOMETHING ELSE THEN,

    YOU SAID YOU WANTED TO SET FOCUS AWAY FROM THE SCROLL BAR OBJECT,

    THE ONLY WAY TO DO THIS IS TO SET FOCUS TO SOMETHING ELSE. TRY YOUR FORM

  6. #6

    Thread Starter
    Hyperactive Member Matt-D's Avatar
    Join Date
    Nov 1999
    Location
    Mettmann, Germany
    Posts
    305
    Ok, I'll take the way using a textbox...

    Thanks, anyway
    Matt

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Originally posted by joey_jones
    WELL SET FOCUS TO SOMETHING ELSE THEN,

    YOU SAID YOU WANTED TO SET FOCUS AWAY FROM THE SCROLL BAR OBJECT,

    THE ONLY WAY TO DO THIS IS TO SET FOCUS TO SOMETHING ELSE. TRY YOUR FORM
    Joey, do a caps check please..... feels like you are yelling and I don't think that is your intent.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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