06-07-2018 13:26
06-07-2018 13:26
I know others have had similar problems with the combo-button and events not working but I haven't found a solution yet. I'm using the combo-button-lower-right button on an Ionic. An onclick event is triggered when I touch the screen over the button, this is working as expected. However, if I click the lower right button, I expect the onkeypress event to be triggered but it's not. The onkeypress event worked for the LR button until I added the combo-button. Seems like the combo-button is causing the issue.
index.gui snippet
<use id="btn-br" href="#combo-button-lower-right" fill="fb-peach">
<set href="combo-button-icon" attributeName="href" to="pin.png"/>
<set href="combo-button-icon-press" attributeName="href" to="pin-press.png"/>
<set href="combo-button-stroke" attributeName="display" to="inline"/>
</use>index.js snippet
let mainScreen = document.getElementById( "main-screen" );
let btnBR = mainScreen.getElementById("btn-br");
btnBR.enabled = true;
btnBR.onactivate = function(evt) {
console.log("BOTTOM RIGHT ONACTIVATE!");
}
btnBR.onclick = function(evt) {
console.log("BOTTOM RIGHT ON CLICK!");
}
// Physical Key events
document.onkeypress = function(evt) {
console.log("ONKEYPRESS " + evt.key);
evt.preventDefault();
if ( evt.key === "up" ) {
console.log("UP");
} else if (evt.key === "down") {
console.log("DOWN");
} else if (evt.key === "back") {
console.log("BACK");
}
}
Answered! Go to the Best Answer.
Best Answer06-14-2018 07:32
06-14-2018 07:32
This is not going to help much, but I had the exact same problem. The combo buttons override the onkeypress when on the right side. The combo button even overrides the onkeypress when the button is not visible.
What I needed up doing was just creating my own button by using and image and circle and setting the x and y so that it shows in the corner ( I'd suggest using percentages something like x="100%-50" ).
Best Answer06-14-2018 07:32
06-14-2018 07:32
This is not going to help much, but I had the exact same problem. The combo buttons override the onkeypress when on the right side. The combo button even overrides the onkeypress when the button is not visible.
What I needed up doing was just creating my own button by using and image and circle and setting the x and y so that it shows in the corner ( I'd suggest using percentages something like x="100%-50" ).
Best Answer