Public Sub testAccessiblity
acc.Initialize
setLanguageForAll(Page1.RootPanel, "en-US")
' Set Description for ui elements
acc.setAccessibilityHint("This is the first Label", Label1)
acc.setAccessibilityHint("This is the last Label", Label4)
acc.setAccessibilityHint("Please enter the first text.", TextField1)
acc.setAccessibilityHint("Please enter the last text.", TextField4)
acc.setAccessibilityHint("This is the button on the bottom of the page.", Button1)
' Set Label for Textfield
setLabelsForAll(Page1.RootPanel)
' Focus
setFocusForAll(Page1.RootPanel, True)
acc.setNextFocus(Button1, TextField1)
End Sub
Private Sub TextField1_EnterPressed
acc.focusNext(Sender)
End Sub
Private Sub TextField2_EnterPressed
acc.focusNext(Sender)
End Sub
Private Sub TextField3_EnterPressed
acc.focusNext(Sender)
End Sub
Private Sub TextField4_EnterPressed
acc.focusNext(Sender)
End Sub
private Sub setLanguageForAll(pPanel As Panel, pstrLanguage As String)
Dim vw As View
For Each vw As View In pPanel.GetAllViewsRecursive
acc.setAccessibilityLanguage(pstrLanguage, vw)
Next
End Sub
Public Sub setLabelsForAll(pPanel As Panel)
Dim i As Int
Dim vwCurrent As B4XView
Dim vwNext As B4XView
If pPanel = Null Or Not(pPanel.IsInitialized) Then
Log($"Failed due to missing or null param."$)
Return
End If
For i = 0 To pPanel.NumberOfViews - 1
vwCurrent = pPanel.GetView(i)
If vwCurrent Is Panel Then
setLabelsForAll(vwCurrent)
Else If vwCurrent Is Label And i <= pPanel.NumberOfViews - 2 Then
vwNext = pPanel.GetView(i + 1)
If Not(vwNext = Null) And vwNext.IsInitialized Then
acc.setAccessibilityLabel(vwCurrent, vwNext)
End If
End If
Next
End Sub