Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

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

Open
Nfactor26 opened this issue Oct 7, 2017 · 8 comments

Comments

@Nfactor26
Copy link

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

@01vadim10
Copy link

01vadim10 commented Sep 26, 2018

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

@Nfactor26
Copy link
Author

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.

@rpaquay
Copy link
Contributor

rpaquay commented Sep 26, 2018

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

@01vadim10
Copy link

01vadim10 commented Sep 27, 2018

@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

@thikon
Copy link

thikon commented Mar 12, 2020

Does anyone know what is the solution?

@Srivasanthioruganti
Copy link

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.

@thikon
Copy link

thikon commented Mar 14, 2020

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.

@AngelinaPl
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants