totalcross
totalcross copied to clipboard
Button is clicking twice using knowcodeXML
Issue Title
Button is clicking twice using knowcodeXML
Describe the bug
The button is used to simulate a slider, when clicked, it clicks twice(It calls the event when the mouse is clicked, and when it's released)
To Reproduce
https://github.com/TotalCross/KnowcodePrivateCases/tree/main/demo set the createSlider function like this
public void createSlider(Button button, Label label) throws InvalidNumberException, IOException, ImageException {
int state = Convert.toInt(label.getText());
if (state == 5) {
state = 1;
button.setImage(new Image("drawable/slider" + state + ".png").getHwScaledInstance(button.getWidth(), button.getHeight()));
label.setText(Convert.toString(state));
} else {
state++;
button.setImage(new Image("drawable/slider" + state + ".png").getHwScaledInstance(button.getWidth(), button.getHeight()));
label.setText(Convert.toString(state));
}
}
Run this application,and go to step, click on any slider,and you should see the issue
Expected behavior
The listener should be called only when pressed, not released
Devices:
Please complete the following information:
- Device: Simulator
- OS: Windows
- OS Version: 10
- TotalCross Version: 6.1.1(Also present in master)
Maybe it is related to https://github.com/TotalCross/totalcross/issues/184 ?
This bug still happens with totalcross v7
To reproduce
Create a button with button.effect=null; I have attached a minimum project with the code. EasyUI.zip