Hi Jeff,
These are the dialog box events to watch and you would want to capture the
focus event for the list box to make sure you have the right list box and also
the listboxSelectionChange if in the list box you are on.
Most likely only the listboxSelectionChange event is the one you would need
to watch. For all item, data, and text can be gotten, using the index number
returned on the focused item.
All List Box Events:
listboxMemoryError
-2
List box can't allocate enough memory to display content
listboxSelectionChange
1
Selection changed in a list box
listboxDoubleClicked
2
A list box was double clicked
listboxSelectionCancel
3
Selection was canceled in a list box
listboxFocus
4
A list box was focused
listboxBlur
5
A list box was blurred
Sent: Saturday, January 11, 2014 10:19 PM
Subject: Re: listbox change
Hi Again Jeff,
This is a list box in my Clipboard app where I move items up and down a
list. It also has 2 items for I break out paths and names so there is a sub
item in the list, or a second column.
So when you have moved up or down using the cursor in the list you will
use the focused method.
Sub MoveUpList()
'Move Up List View.
Dim text, text1, row
On Error Resume Next
row = LV_Control.Items.focused.Index
text = LV_Control.Items.focused.text
text1 = LV_Control.Items.focused.text(1)
If row > 1 Then
Silence
row = row - 2
Speak " Moving Up "
AddListItem LV_Obj, FileListName, row, text & text1
LV_Control.Items.focused.Delete()
End If
End Sub
Sub MoveDownList()
'Move Down List View.
Dim text, text1, row
On Error Resume Next
row = LV_Control.Items.focused.Index
text = LV_Control.Items.focused.text
text1 = LV_Control.Items.focused.text(1)
If row < LV_Control.Items.Count Then
row = row + 1
Speak " Moving Down "
AddListItem LV_Obj, FileListName, row, text & text1
LV_Control.Items.focused.Delete()
End If
End Sub
Bruce
Sent: Saturday, January 11, 2014 9:31 PM
Subject: Re: listbox change
Hi Again Jeff,
Now for a list box you have all rolled into one and the property
using FocusedIndex or method using SelectedIndex will give you the object index
of the one which has focus or is selected.
Long_Value = Object.FocusedIndex
Long_Value = Object.SelectedIndex
then you can get the data and text with the index in parens.
Bruce
Sent: Saturday, January 11, 2014 9:01 PM
Subject: listbox change
How can you find out when a focused listitem changes in a dialog?
I am trying to use select case and it works fine when a button is
pressed, but I want to find out when the user presses the up or down arrow in
the list itself.
thanks
Jeff Weiss
--------------------------------------------------------------------------
This email is free from viruses and malware because avast!
Antivirus protection is active.
----------------------------------------------------------------------------
This email is free from viruses and malware because avast!
Antivirus protection is active.
------------------------------------------------------------------------------
This email is free from viruses and malware because avast! Antivirus
protection is active.
---
This email is free from viruses and malware because avast! Antivirus protection
is active.
http://www.avast.com