Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Combo Buttons and Physical Buttons

Right now I have an app that has numbers and if a button is clicked, the number goes up (btntr) or down (btnbr). How can I get it so that the physical side buttons do the same thing as the on screen buttons?

I've posted another like this, but kind of different.

 

I'll post what code I have here:

 

import document from "document";

var totalscore = 0;

const hole = document.getElementById("hole");
const btnbl = document.getElementById("btnbl");

const counter2 = 1

btnbl.addEventListener("click", () => {
  counter2 = counter2 + 1;
  hole.text = `${counter2} `;
  console.log("BOTTOM LEFT");
  counter = 0;
})

import document from "document";

btntr.onclick = function(e) {
  console.log("Key pressed: " + e.key);
  counter = counter + 1;
  score.text = `${counter} `;
}
Best Answer
0 Votes
2 REPLIES 2

I guess my question is how can I get a response from a single physical button, as to any button in my code sample above?

Best Answer
0 Votes

If you use Combo buttons the activate event will work with both physical and touch screen actions

Best Answer
0 Votes