ToolStripStatusLabel을 사용한 UIAUTOMATION
-
06-07-2019 - |
문제
WinForms 앱이 있고 A의 텍스트에 액세스 할 수없는 것 같습니다. ToolStripStatusLabel
uiautomation을 통해. 마이크로 소프트 암시합니다 그 지원 StatusStrip
S (그리고 아마도 그 안에있는 항목)는 제한적이지만, 이는 작동 해야하는 기본적인 사용 사례처럼 보입니다.
제어가 표시됩니다 ControlType.Edit
Uispy에서는 읽기 전용 텍스트 상자 인 것처럼 보이지만 그 값은 항상 텍스트가 아닌 이름과 동일합니다.
uispy의 속성은 다음과 같습니다.
AutomationElement
General Accessibility
AccessKey: ""
AcceleratorKey: ""
IsKeyboardFocusable: "False"
LabeledBy: "(null)"
HelpText: ""
State
IsEnabled: "True"
HasKeyboardFocus: "False"
Identification
ClassName: ""
ControlType: "ControlType.Edit"
Culture: "(null)"
AutomationId: "StatusBar.Pane0"
LocalizedControlType: "edit"
Name: "My Label"
ProcessId: "3972 (*****)"
RuntimeId: "42 134002 0"
IsPassword: "False"
IsControlElement: "True"
IsContentElement: "True"
Visibility
BoundingRectangle: "(9, 273, 79, 17)"
ClickablePoint: "48,281"
IsOffscreen: "False"
ControlPatterns
GridItem
Row: "0"
Column: "0"
RowSpan: "1"
ColumnSpan: "1"
ContainingGrid: ""status bar" "statusStrip""
Value
Value: "My Label"
IsReadOnly: "True"
기본적으로 나는 어떤 길을 갈 길을 바라고 있습니다 myLabel.Text = "something"
그리고 Uiautomation을 통해 어떻게 든 그 가치를 얻을 수 있습니다.
해결책
설정 AccessibleName
그 외에 재산 .Text
에 ToolStripStatusLabel
제어. 비슷한 시나리오에서 White를 사용하는 데 효과가 있습니다.
statusLabel.Text = statusLabel.AccessibleName = "New status value";
다른 팁
나는 다른 텍스트를 가진 두 개의 별도 레이블을 가지고 적절한 라벨을 보여주고 숨겨서 이것을 해결해야했습니다. 이것은 내 목적으로 충분하지만 (흰색으로 테스트) Uiautomation이 텍스트 값을 나타 내지 못한다는 사실에 매우 놀랐습니다. 기본적으로 Winforms 응용 프로그램의 상태 표시 줄의 모든 텍스트가 스크린 리더에게 액세스 할 수 없음을 의미합니다.
나는 당신이 설명하는 것과 비슷한 레이블의 텍스트를 검색하는 데 문제가 없었습니다. 사실 AutomationId
내 응용 프로그램에서도 동일합니다. 사실 그 ControlType
표시됩니다 ControlType.Edit
오해의 소지가 있습니다. 예를 들어 다음이 작동합니다
statusText = (string)automationElement.GetCurrentPropertyValue(ValuePattern.ValueProperty);
어디에 automationElement
찾기 메소드를 사용하여 위치했습니다 ControlType.Edit
와 함께 AutomationId
의 "StatusBar.Pane0"
.