access-bridge-explorer icon indicating copy to clipboard operation
access-bridge-explorer copied to clipboard

Trying to select a value in combobox changes the selection but change is not triggered.

Open Nfactor26 opened this issue 6 years ago • 8 comments

I am trying to automate UI of "FileChooserDemo.jar" application distributed with jdk-8u121-windows-x64-demos. There is a button on the UI "Show FileChooser". There is a drop down labelled "Look and Feel" on this application. Possible values are "Metal","Nimbus","Windows",etc. I am selecting the "Windows" options using following code :

//targetControl is AccessibleContextNode and has been looked up already
 targetControl.AccessBridge.Functions.ClearAccessibleSelectionFromContext(targetControl.JvmId, targetControl.AccessibleContextHandle);          

//index is the position of "Windows" in the dropdown
          targetControl.AccessBridge.Functions.AddAccessibleSelectionFromContext(targetControl.JvmId, targetControl.AccessibleContextHandle, index);

Expected behavior : Theme of the application should change to selected value in drop down like it happens when manually making the selection using mouse.

Current behavior : Theme of the application doesn't change. Also, changing the value in drop down now manually using mouse has no effect on UI.

Regards, Nish26

Nfactor26 avatar Oct 07 '17 12:10 Nfactor26

Hi, @Nfactor26! I have the same problem with ComboBox in SwingSet2 from JDK demo samples. Did you solve it?

01vadim10 avatar Sep 26 '18 13:09 01vadim10

No. I spent several hours but could not get it working . Since i had the dropdown control and option control already looked up , i retrieved their bounding box and then used mouse simulation to actually move the mouse and perform click on dropdown control followed by option to select.

Nfactor26 avatar Sep 26 '18 13:09 Nfactor26

Have you tried calling the "click" action on the newly selected item of the combo box? (using the DoAccessibleActions method).

rpaquay avatar Sep 26 '18 22:09 rpaquay

@rpaquay yes. I tried all possible ways to add selection item to ComboBox. I used to

  1. AddAccessibleSelectionFromContext()
  2. Created RequestFocus() for different items(ComboBox, List, ListItem)
  3. Actions for ComboBox and ListItem(label).

About "click". It works similarly to AddAccessibleSelectionFromContext() method, after DoAccessibleActions() list item would be selected but action "click" doesn't occur

01vadim10 avatar Sep 27 '18 07:09 01vadim10

Does anyone know what is the solution?

thikon avatar Mar 12 '20 08:03 thikon

Events_PropertySelectionChange is being triggered whenever we try to change the selection in the combo box,but is there any specific event that will capture once the value is changed in the combo box. Anyone have a solution,Please let me know how to capture the data every time value is changed in the combo box.

Srivasanthioruganti avatar Mar 13 '20 11:03 Srivasanthioruganti

For selected index on combobox please try to use Functions.AddAccessibleSelectionFromContext()

void AddAccessibleSelectionFromContext(int vmid, JavaObjectHandle asel, int i)

int i -> means index of value in combobox.

thikon avatar Mar 14 '20 05:03 thikon

After calling AddAccessibleSelectionFromContext(int vmid, JavaObjectHandle asel, int i) you should simulate key stroke AccessibleKeyCode.ACCESSIBLE_VK_ENTER. It works for me.

AngelinaPl avatar May 26 '21 09:05 AngelinaPl