Hi Chip and Jeff,
I think I know now what is going on. Jeff my examples earlier were correct
and what Chip is saying and I think but have not tested yet, is a selection
change has to happen if something has been selected. Below is from voice rotor
and I will test it on my Clipboard app.
In order to get your app to work I think you have to set a selection such
as 1 and select the first one on the list. In voice rotor it is done when the
list is first given focus and you set it to the first item on the list.
Once you have an item selected then when moving from that item you have a
selection change. I just did not think of that and it makes sense. You have to
have a selected item before you have a change.
Example:
voicePos = RetrieveVoicePosition
If voicePos < 1 Then voicePos = 1
dObj.Control("lstSynths").FocusedIndex = voicePos
dObj.Control("lstSynths").Selected(voicePos) = True
So as you see above, it retrieves a item number and if 0 or less it has not
been set, so it sets the item number and selects it.
This is what you should do for your list, make a selection choice to where
you want to start on the list and see what happens once you have done that and
I think the event will then happen, but not until.
My first response I placed it under the Audiokit which is a python issue
and not a listbox issue. Wrong place just did not look at the header to which
one I was responding to.
Original Response:
Hi Chip,
Will look at the other apps you speak of. I had said what I said for when
monitoring
events none is triggered for just cursoring up and down a list. I thought
maybe the
speak was being erased but when doing key up and down the events are spoken.
I do not know why this is but will look at the other apps and see what I
may
be doing wrong. Maybe not looking at the correct object for this event, but
you did
point out the Dialog Event which I had mentioned and the values are hidden
inside
the EventInfo.
Will look into it and see what I may be doing wrong, but I was just
looking for
an event number.
Bruce
Sent: Monday, January 13, 2014 1:17 PM
Subject: RE: listbox change
I’m sorry, but I disagree with Bruce’s comments here. You can use a dialog
handler with an xml dialog, and you can test for a listBoxSelectionChange event
in the dialog event handler.
See the apps listed below, which are the ones I happen to have installed
which all do this:
Show All Scripts
Virtual Explorer
Voice Rotor
Homer Shared Object
Chip
From: LB [mailto:[email protected]]
Sent: Monday, January 13, 2014 7:22 AM
To: [email protected]
Subject: Re: listbox change
Hi Jeff,
It will not work and you are doing nothing wrong. The event has to be
under connectevent and using the listbox, or you use the keyboard event using
keydown as the trigger and key up to see the result.
Now the listbox even is inside the eventinfo to see what had happened.
so if you use the "OnListboxSelectionChange" in the connectEvent then
what the EventInfo for the change you will get the result.
Or you use the Keyboard and and the ConnectEvent "OnKeyUp" then look at
the FocusItem number you will see the change.
It is a pain but the direct way below is not the way for this sadly.
Bruce
Sent: Sunday, January 12, 2014 10:33 PM
Subject: Re: listbox change
Thank you for all of the suggestions.
This is indeed my own xml listbox dialog and I can get the button to work
but not the listbox change to register where I can do something when it changes.
The list works fine and displays 12 spelling words.
Here is the function:
Function DialogEventHandler3(fObj, fEvent, fId, fControl)
DialogEventHandler3 = False
Dim Result : Result = ""
fObj.Control("lst").Width = 200
If fEvent = dialogCreated Then
BuildList fObj, Result
End If
DialogEventHandler3 = False
Select Case fId
Case fId = "lst"
If fEvent = listboxSelectionChange Then
If fObj("lst").FocusedIndex <> Temp Then
Temp = fObj.Control("lst").FocusedIndex
Result = fObj.Control("lst").Text
Speak Result
Speak Temp
Speak "this is a test."
Result = ""
Exit Function
End If
End If
Case "button_MainMenu"
If fEvent = buttonClicked Then
Speak ""
Sleep 200
Speak "Returning to Main Menu"
Sleep 200
fObj.Control("lst").Clear
fObj.Close
DialogEventHandler3 = True
Exit Function
End If
Case Else
If fEvent = dialogCreated Then
DialogEventHandler3 = True
Exit Function
End If
End Select
End Function
I must be missing something here. Please let me know what I am missing
here.
thanks
Jeff Weiss
From: Chip Orange
Sent: Sunday, January 12, 2014 12:49 PM
To: [email protected]
Subject: RE: listbox change
Hi Jeff,
I think you’re asking for a way to know using an event, as to when a
listbox selected item is changed (do I have that right)? If so, and if this is
your own xml dialog (and not a dialog belonging to some other program, then
you can use a predefined xml event type for listbox selection changes in the
dialog event handler, like so below:
Function myDialogEvent(dlg, dlgEvent, id, ctrl)
Select case id
Case id = “myListBox”
‘ this is my listbox control
If dlgEvent = listboxSelectionChange Then
‘ and now I see the selected item of the listbox has just changed
If you are trying to find out when a listbox changes, and the listbox is
not in an xml dialog of yours, but in some program you’re writing an app for;
then you can use an MSAA event to notify you when the listbox selection changes
(assuming this program is generating MSAA events, not always guaranteed). Let
me know if you need an MSAA example and I’ll put one together for you.
Hth,
Chip
From: Jeff Weiss [mailto:[email protected]]
Sent: Saturday, January 11, 2014 9:01 PM
To: [email protected]
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.
http://www.avast.com