HarmonyOS-Knowledgebase icon indicating copy to clipboard operation
HarmonyOS-Knowledgebase copied to clipboard

OnClick() does not trigger when implement OnClickListener for Button in HMOS

Open kanaksony opened this issue 4 years ago • 1 comments
trafficstars

Describe the bug Overriden method onClick() does not trigger when implement OnClickListener for default Button component

Background Scenario: With the Current SDK Version, whenever a developer needs a button with some functionality to execute in overridden method onClick() action, s/he need to perform the following steps mentioned under steps to reproduce:

Steps to reproduce the behavior:

  1. Define a button component either in XML or in java code
  2. Implement onClickListener and set the same in java code
  3. Add some functionality in the listener implementation

Expected behavior Functionality added in step 3 must be executed immediately after following all above steps

Current Behavior: Functionality added in step 3 doesn't get executed because by default clickable property of Button is not set as true

Possible Resolution: By default clickable property of the Button must be set as true

Additional information

Developer Platform: Windows DevEco Studio version: 2.1.0.501 SDK API version: 5 SDK version: 2.1.1.21 Device: Simulator and device both

-- Regards, Kanak Sony

kanaksony avatar Oct 06 '21 09:10 kanaksony

Good idea we can discuss further on this.

applibengineering avatar Oct 06 '21 10:10 applibengineering