Repository: nvaccess/nvda

Issue:
GUI: Look in the element list for the edit box, activate button, move to button, cancel button. Visually invisible.
### Steps to reproduce:

Open the browser nvda + f7 startup element list, tab to find search box, activate button, move to button, cancel button. The controls are not visible visually.

![image](https://user-images.githubusercontent.com/59390108/71891165-f6897580-3180-11ea-88e1-9d2dbdc2bfa1.png)


### Actual behavior:

Invisible

### Expected behavior:

visible

### System configuration
#### NVDA installed/portable/running from source:
Installed

#### NVDA version:

alpha-19460

#### Windows version:

Windows 10 pro1909

#### Name and version of other software in use when reproducing the issue:

#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?

Yes

#### Have you tried any other versions of NVDA? If so, please report their behaviors.

no



Discussion:
cc
@feerrenrut 
and
@leonardder 
thanks
On my side with Win10 French and NVDA 2019.3beta1 French on this page in Firefox, I an see all the controls of the dialog.

I have also tried to switch NVDA in Chinese Simplified and can also see that the various controls of the dialog appear.

Here are some questions and tracks to help investigate this issue:

* What is the language of Windows?
* What is the language of NVDA's UI
* Does the issue occur on any webpage or on a specific webpage?
* In which browser(s) does the issue occur?
* Does the issue occur with NVDA 2019.2.1?




@CyrilleB79  Hello。
1.Windows language：Simplified Chinese

2.NVDA UI language：Simplified Chinese and English

3.Any webpage

4.IE、Chrome、Firefox 、Edge Will happen

5.This issue will occur in 2019.2.1

My English is bad。Sorry for the language barrier。

Regards.
@lijianwei2019:

* do you have the opportunity to test on another computer?
* When you are on an invisible control tat should be visible could you press NVDA+F1 to get the developper's info for this object and paste this information here?

@ Ohter Chinese people:
Do you experience the same issue (with Windows zh-CN)?

I have tested with the same alpha version (last alhpa) as temporary installer's copy. Unfortunately I could not reproduce this issue. 

From the image posted by @lijianwei2019, I can see something thats seems the focus squeezed at the bottom of the window (with focus highlighting enabled). Yet to be confirmed by someone that have a better vision than me. If provided, dev info on navigator object should confirm this.

Sorry, I do not have any other idea to investigate this issue. Is there anybody who could continue this investigation?

@JulienCochuyt 
Are you interested in solving this problem?
> @JulienCochuyt
> Are you interested in solving this problem?

I was indeed considering to, as I guess there might be a quick fix, but I sadly couldn't spare lately as much time as I would have liked to. I'll try to have a look probably next week.
@JulienCochuyt I'm in a similar position. My best guess is that this user has a different level of display scaling set in Windows display settings, and the explicit size of the tree control is pushing the controls of the screen. You could try scaling the sizes when creating the treeview.

I notice that it calls `mainsizer.Fit()`, I had some issues when using this incorrectly for `VisionProviderSubPanel_Wrapper`
Ah, I can reproduce this now if I set my monitor resolution lower. I noticed in the image the the elements list dialog is taking up the whole screen. @lijianwei2019 if possible, you may have better luck with a higher screen resolution but using the "scaling" setting in Windows to make application bigger.

We have a hard-coded size for the tree-view in this dialog, I'm going to see if I can make it adapt to the screen resolution better. 

Resolving patch:
diff --git a/source/browseMode.py b/source/browseMode.py
--- a/source/browseMode.py
+++ b/source/browseMode.py
@@ -35,6 +35,7 @@
 import inputCore
 import api
 import gui.guiHelper
+from gui.dpiScalingHelper import DpiScalingHelperMixinWithoutInit
 from NVDAObjects import NVDAObject
 from abc import ABCMeta, abstractmethod
 from typing import Optional
@@ -847,7 +848,8 @@ def script_disablePassThrough(self, gesture):
 )
 del qn
 
-class ElementsListDialog(wx.Dialog):
+
+class ElementsListDialog(DpiScalingHelperMixinWithoutInit, wx.Dialog):
 	ELEMENT_TYPES = (
 		# Translators: The label of a radio button to select the type of element
 		# in the browse mode Elements List dialog.
@@ -871,9 +873,12 @@ class ElementsListDialog(wx.Dialog):
 	lastSelectedElementType=0
 
 	def __init__(self, document):
+		super().__init__(
+			parent=gui.mainFrame,
+			# Translators: The title of the browse mode Elements List dialog.
+			title=_("Elements List")
+		)
 		self.document = document
-		# Translators: The title of the browse mode Elements List dialog.
-		super(ElementsListDialog, self).__init__(gui.mainFrame, wx.ID_ANY, _("Elements List"))
 		mainSizer = wx.BoxSizer(wx.VERTICAL)
 		contentsSizer = wx.BoxSizer(wx.VERTICAL)
 
@@ -885,7 +890,11 @@ def __init__(self, document):
 		contentsSizer.Add(child, flag=wx.EXPAND)
 		contentsSizer.AddSpacer(gui.guiHelper.SPACE_BETWEEN_VERTICAL_DIALOG_ITEMS)
 
-		self.tree = wx.TreeCtrl(self, size=wx.Size(500, 600), style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT | wx.TR_SINGLE | wx.TR_EDIT_LABELS)
+		self.tree = wx.TreeCtrl(
+			self,
+			size=self.scaleSize((500, 300)),  # height is chosen to ensure the dialog will fit on an 800x600 screen
+			style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT | wx.TR_SINGLE | wx.TR_EDIT_LABELS
+		)
 		self.tree.Bind(wx.EVT_SET_FOCUS, self.onTreeSetFocus)
 		self.tree.Bind(wx.EVT_CHAR, self.onTreeChar)
 		self.tree.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.onTreeLabelEditBegin)
diff --git a/source/gui/dpiScalingHelper.py b/source/gui/dpiScalingHelper.py
--- a/source/gui/dpiScalingHelper.py
+++ b/source/gui/dpiScalingHelper.py
@@ -3,6 +3,7 @@
 #Copyright (C) 2018 NV Access Limited
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
+from typing import Optional, Any, Callable
 
 
 def scaleSize(scaleFactor, size):
@@ -20,11 +21,29 @@ def getScaleFactor(windowHandle):
 	import windowUtils
 	return windowUtils.getWindowScalingFactor(windowHandle)
 
+
 class DpiScalingHelperMixin(object):
-	""" mixin to provide size scaling """
+	""" mixin to provide size scaling intended to be used with wx.Window (usually wx.Dialog)
+			Sub-classes are responsible for calling wx.Window init
+	"""
+
 	def __init__(self, windowHandle):
 		self._scaleFactor = getScaleFactor(windowHandle)
 
 	def scaleSize(self, size):
 		assert getattr(self, u"_scaleFactor", None)
 		return scaleSize(self._scaleFactor, size)
+
+
+class DpiScalingHelperMixinWithoutInit:
+	"""Same concept as DpiScalingHelperMixin, but ensures you do not have to explicitly call the init
+		of wx.Window or this mixin
+	"""
+	GetHandle: Callable[[], Any]  # Should be provided by wx.Window
+	_scaleFactor: Optional[float] = None
+
+	def scaleSize(self, size):
+		if self._scaleFactor is None:
+			windowHandle = self.GetHandle()
+			self._scaleFactor = getScaleFactor(windowHandle)
+		return scaleSize(self._scaleFactor, size)


Test patch: