How to make an app - Andromo App Maker


No announcement yet.

Enter key = mouse click?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Enter key = mouse click?

    I wanted to start a new thread on this, since I've seen the question a few times. Is there any way to make the "enter" key simulate a left mouse click? I've got my arrow key navigation down, so I don't need to move a mouse cursor around my pages (thanks, Corey!!!), but now I want to be able to have a specific button launch a specific action (open a file) when the enter key (or any other normal keyboard key that could be mapped to a remote) is pressed.

    Is there a general On Key command that will make an enter stroke simulate a mouse click?

  • #2
    More info: I actually tried mapping a left-click command to a remote control, but the problem is, the mouse cursor doesn't move around with the arrow keys - just the active position. This means that, even with a hotspot or a button action enabled, a left click will just be a left click somewhere on the screen (wherever the mouse is).


    • #3
      If I might make a suggestion:

      Instead of putting all of your code in the object that you need to click, create a Global Function and call the function in the click event.

      Then for the enter key use a variable to track where you are in the menu so that when you detect the enter key, you know which function to call.


      • #4
        This would certainly be the hard way to do it, but it does show some of the of possibilites the KeyStrokes DLL gives you.
        Attached Files


        • #5
          Hmmm. . . that feels like it has potential. Let's try this: I'm attaching a sample file that Corey created which allows one to navigate with the arrow keys. Can a function be added that allows an "enter" keystroke to trigger something different for each button?
          Attached Files


          • #6
            Here ya go, this is by far not the most optimized code at all, but it should give you a good starting point.
            Attached Files


            • #7
              Worm, you just made the hero list! Thanks for playing along. And it's good to know that a simple if/then can be used, too. I had that thought, but I just couldn't get my brain around it for some reason.

              I love these forums.


              • #8
                Haha! I tried something based on the comments you put in that code, Worm. You said an if/then command would work, and I was wondering how the heck I could make it specific for each button. But I had a spark, and wondered just how intuitive this software is. Would "and" fit in anywhere?

                if (e_Key == 13) and button == 1 then
                File.Open("something.txt", "", SW_SHOWNORMAL);

                And lo, it does work! Great work, team. You've started me on a great path.