I pieced together this example from the scripting manual, but something
is not right here.
Can somebody explain what is wrong with this listview dialog.
I Have to press downarrow five times to hear the entire data, but when I
get to the speak function, I still just get "Aaron".
Thanks,
Jeff Weiss
' We'll assume we have a list view whose ID is "listview1" which
contains no items by default using the following XML
' <listview id="listview1" view="report">
' <listviewcolumn>Name</listviewcolumn>
' <listviewcolumn>Favorite Color</listviewcolumn>
' <listviewcolumn>Favorite Number</listviewcolumn>
' </listview>
' ListView
Dim isVisible : isVisible = 0
Dim Mark : Mark = 0
Set myKey = Keyboard.Keys(vk_I)
myKey.RequireModifiers(kmControl + kmShift + kmAlt)
ConnectEvent myKey, "OnKeyProcessedUp", "LaunchDialog"
Sub LaunchDialog(k, km)
If isVisible = 0 Then
Queue "DisplayDialog"
End If
End Sub
Sub DisplayDialog()
Dialog "ListView.xml", "MyDialog1", "DialogEventHandler"
End Sub
Function DialogEventHandler(dObj, dEvent, dId, dControl)
DialogEventHandler = False
End Function
Function DialogEventHandler(dObj, dEvent, dId, dControl)
DialogEventHandler = False
' Now we'll add a single item to the list view
If Mark < 5 Then
Set newLVItem = dObj.Control("listview1").NewItem
newLVItem.Text = "Aaron"
newLVItem.Insert dObj.Control("listview1").Items.Count + 1
newLVItem.Text(1) = "Obsidian Blue"
newLVItem.Text(2) = "42"
Mark = Mark + 1
End If
' The list view now contains a single item, which Window-Eyes would read
(by default), "Aaron, Favorite Color Obsidian Blue, Favorite Number 42."
Select Case dId
Case "btn_ok"
If dEvent = buttonClicked Then
SpeakResult dObj, dEvent, dId, dControl
DialogEventHandler = True
Exit Function
End If
Case "btn_cancel"
If dEvent = buttonClicked Then
Speak "closing dialog "
Sleep 200
isVisible = 0
dObj.Close
DialogEventHandler = True
Exit Function
End If
Case Else
If dEvent = dialogCreated Then
isVisible = 1
DialogEventHandler = True
Exit Function
End If
End Select
End Function
Function SpeakResult(dObj, dEvent, dId, dControl)
Dim textToSpeak
TextToSpeak = dObj.Control("listview1").Text
Speak "You have chosen " & textToSpeak
End Function