applibgroup / HarmonyOS-Knowledgebase

This repository contains code samples of HarmonyOS Training
Apache License 2.0
17 stars 6 forks source link

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

Open kanaksony opened 3 years ago

kanaksony commented 3 years ago

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

applibengineering commented 3 years ago

Good idea we can discuss further on this.