Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Join Date
    Aug 2002
    Posts
    33

    Question Unanswered: Intercept a Right Click

    I want to be able to change the way the right click works just for my access program. Basically, I want a right click be the equivalent to a space bar key press (or enter key).

    I realize you can use Microsoft intellipoint and remap the right click, problem is that I only want it to function this way for my access program and for nothing else.

    Again, currently the right click sets focus on whereever the pointer is, then a right click menu pops out. I want to be able to intercept it, and process it as a space bar (or enter key) key press.

    Any ideas?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why?

    you users have a perfectly good action to do this.. its called the space bar. YOu are changing the default behaviour, so you are possibly creating confusion in the minds of your users.

    right click in the windows world has a very specific meaning, which you have alrady identified

    just tell you users to either tab to the control or selct using the mouse.. persoanlly Id agree that a mouse driven UI can be a great boon.. if you look at how users in high intensity data capture ebvironments work.. they dont (or at most rarely) use the mouse.. its the keyboard. theres a lesson there... get your keyboard interface right first
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Take a look at help for the OnMouseDown Event. You can capture left and right clicks with that.
    Inspiration Through Fermentation

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I tend to agree with healdem; the whole driving point of the Windows environment is that no matter what Windows program the user is in, a given action will result in the same task being carried out! <Ctrl> + <S> will always save a record/file, <F1> will always call up help. This is what cuts down the learning curve for a program compared to the pre-Windows days, and this is why the basics shouldn't be messed with.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Aug 2002
    Posts
    33
    wow.

    I didn't know I had to justify why I need what I need. For those of you who just have to know, my users will not have the luxury of having a keyboard in front of them. My program is being designed to be touch & mouse click only. I need the right click enter (or space) for speed. This way after they select a checked option, the focus gets set to the ok button, then they can press that button without having to move the mouse. The problem with the mouse down is that it changes the focus before it is triggered. Anyone out there with comments that will help?

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    The only mouse event prior to the MouseDown is the MouseMove ... What is the exact sequence of interaction that you want to remap? MouseDown is the 1st mouse event to trigger on a click of any mouse button ... And why is focus such an issue? Do you want the right click to act as a quasi tab event? Where it doesn't matter where on the screen you right click, you get the tab/enter action on the controls ...
    Back to Access ... ADO is not the way to go for speed ...

  7. #7
    Join Date
    Aug 2002
    Posts
    33
    What I want is:

    User left clicks a check mark.
    After update moves the focus to an ok button.
    Right click pushes the ok button regardless of where the pointer is.

    It is important that it only pushes whereever the focus was. I can't just map the right click to a single button, as the right click will be used several times per form.
    Last edited by absoffthewake; 01-24-07 at 11:46.

  8. #8
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by absoffthewake
    What I want is:

    User left clicks a check mark.
    After update moves the focus to an ok button.
    Right click pushes the ok button regardless of where the pointer is.

    It is important that it only pushes whereever the focus was. I can't just map the right click to a single button, as the right click will be used several times per form.
    What does this "It is important that it only pushes whereever the focus was" mean?

    What activities is the right click supposed to do on your form? Is the activity dependent on where/what you click on?

    The only other issue I see going forward is that you're gonna need a click event for EVERY single control on your form (including 1 for the form itself) in order to "map" the desired result action ...
    Back to Access ... ADO is not the way to go for speed ...

  9. #9
    Join Date
    Aug 2002
    Posts
    33
    Quote Originally Posted by M Owen
    The only other issue I see going forward is that you're gonna need a click event for EVERY single control on your form (including 1 for the form itself) in order to "map" the desired result action ...
    That is exactly what I don't want. I'll put this as simply as I can:

    When I use the right button on my mouse, I want it to do nothing but the equivalent of an enter key press on your keyboard.

    I don't want it to fuction as a right mouse click. I don't want it to move the focus, I don't want it to show me a menu, I don't want access to process it as a right mouse click. I want it to process like an enter key press. PERIOD. Don't overcomplicate it please!!!! Right Click = Enter key press


    I want the functionality of Microsoft Intellipoint, where you can remap the button, but only for my access program.

  10. #10
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by absoffthewake
    That is exactly what I don't want. I'll put this as simply as I can:

    When I use the right button on my mouse, I want it to do nothing but the equivalent of an enter key press on your keyboard.

    I don't want it to fuction as a right mouse click. I don't want it to move the focus, I don't want it to show me a menu, I don't want access to process it as a right mouse click. I want it to process like an enter key press. PERIOD. Don't overcomplicate it please!!!! Right Click = Enter key press


    I want the functionality of Microsoft Intellipoint, where you can remap the button, but only for my access program.
    I'm not trying to overcomplicate ... You ARE using MS Access here ... Not exactly the flagship product from Microsoft ... About to only other way to do this might be to write an interceptor using API calls ...
    Back to Access ... ADO is not the way to go for speed ...

  11. #11
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    google around for 'mouse hook'. there are many VB implementations that look port-able and i believe that i have seen some VBA implementations in the past but i don't remember where.

    the process seems pretty much the same as API-messing with the scroll wheel (so don't ignore mouse hook code that concentrates on the scroll wheel - it is probably only +/- one constant 'wrong').

    i've only looked at hooks for the general background 'education'. can't offer any detail, but a caution: hooks can be either system-wide or looking at a single thread ...you need the second flavour.

    izy
    Last edited by izyrider; 01-25-07 at 10:50.
    currently using SS 2008R2

  12. #12
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    why not copy the code from behind your save and stick it behind right mouse click events?

    Or is that too simple?
    --------------------------------------------------------------------------------------
    Scratch that - I just tried it and realised it was a wee bit more complex then that.
    gunna go play with that idea now.
    George
    Home | Blog

  13. #13
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Ok, I got it for you.

    On your mousedown or mouseup event try stick this code in

    Code:
    If (Button = acRightButton) Then
       MsgBox ("Problem solved!")
    End If
    Just stick the code behind your save in that if statement.

    How's that for you?
    George
    Home | Blog

  14. #14
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    if anyone knows how to assign event handlers on the fly in VBA let me know and i can make this 100 times better

    until then you'll have to add this to every control on the form
    Code:
    Private Sub Form_MouseUp(Button As Integer, Shift As Integer, _
    X As Single, Y As Single)
        If (Button = acRightButton) Then
            yourButton_Click()
        End If
    End Sub
    on the fly method
    Code:
    Private Sub Form_Load()
        Dim ctrl as Control
        For Each obj in Me.Controls
            ctrl = obj
            add control_MouseUp event handler to ctrl's MouseUp event
        Next
        add the control_MouseUp event handler to Form's MouseUp event
    Snd Sub
    
    Private Sub control_MouseUp(Button As Integer, Shift As Integer, _
    X As Single, Y As Single)
        If (Button = acRightButton) Then
            yourButton_Click()
        End If
    End Sub
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  15. #15
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    True - I didnt think as far ahead as having to implement this on every form - I just presumed it was a small enough database for that not to matter.

    How about you just make it a function in a module - this will reduce the amount of code throughout.

    This is more useful if you dont always want to save by right click EVERYWHERE in your database.
    George
    Home | Blog

Posting Permissions

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