Repository: nvaccess/nvda

Issue:
UIA: Handle combo boxes with value pattern
Hi,

May apply to Windows 8 and later: there are combo boxes that does expose value pattern (for example, Settings/Devices/Auto play). As of now, NVDA handles ones without value pattern, but it might be helpful to work with ones that does expose this pattern.

Thanks.



Discussion:
We already use the value pattern where it's available. In fact, that's 
the way we already get the value from this particular combo box.

We don't report changes here because even though it supports the value 
pattern, it does not fire value property change events. Narrator gets 
around this by reporting the selection change event on child items. We 
can probably do the same in this specific case.

Hi, In that case, it might be best to follow conventions unless MS does something interesting in Redstone 2. Thanks for letting us know about this.

From: James Teh [mailto:notifications@github.com] 
Sent: Monday, September 5, 2016 6:00 PM
To: nvaccess/nvda
Cc: Joseph Lee; Author
Subject: Re: [nvaccess/nvda] UIA: Handle combo boxes with value pattern (#6337)

We already use the value pattern where it's available. In fact, that's 
the way we already get the value from this particular combo box.

We don't report changes here because even though it supports the value 
pattern, it does not fire value property change events. Narrator gets 
around this by reporting the selection change event on child items. We 
can probably do the same in this specific case.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/nvaccess/nvda/issues/6337#issuecomment-244827128 , or mute the thread https://github.com/notifications/unsubscribe-auth/AHgLkDG6u2qPBtdPH7F0mhAf6A5VBx7bks5qnLsTgaJpZM4J1YAm .Image removed by sender.

Hi,
Returning to this issue...

Redstone 2 did not change this, so I guess a PR might be in order. Thanks.

Resolving patch:
diff --git a/source/NVDAObjects/UIA/__init__.py b/source/NVDAObjects/UIA/__init__.py
--- a/source/NVDAObjects/UIA/__init__.py
+++ b/source/NVDAObjects/UIA/__init__.py
@@ -2,7 +2,7 @@
 #A part of NonVisual Desktop Access (NVDA)
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
-#Copyright (C) 2009-2016 NV Access Limited, Joseph Lee, Mohammad Suliman
+#Copyright (C) 2009-2017 NV Access Limited, Joseph Lee, Mohammad Suliman
 
 from ctypes import byref
 from ctypes.wintypes import POINT, RECT
@@ -1389,7 +1389,7 @@ def _get_UIASelectionPattern(self):
 	def _get_value(self):
 		try:
 			return self.UIASelectionPattern.GetCurrentSelection().GetElement(0).CurrentName
-		except COMError:
+		except (COMError, AttributeError):
 			return None
 
 class ListItem(UIA):
@@ -1398,8 +1398,9 @@ def event_stateChange(self):
 		if not self.hasFocus:
 			parent = self.parent
 			focus=api.getFocusObject()
-			if parent and isinstance(parent, ComboBoxWithoutValuePattern) and parent==focus: 
-				# This is an item in a combo box without the Value pattern.
+			if parent and parent==focus and (isinstance(parent, ComboBoxWithoutValuePattern)
+				or (parent._getUIACacheablePropertyValue(UIAHandler.UIA_IsValuePatternAvailablePropertyId) and parent.windowClassName.startswith("Windows.UI.Core"))):
+				# #6337: This is an item in a combo box without the Value pattern or does not raise value change event.
 				# This item has been selected, so notify the combo box that its value has changed.
 				focus.event_valueChange()
 		super(ListItem, self).event_stateChange()


Test patch: