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 <mailto:[email protected]> 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 _____ <http://www.avast.com/> Image removed by sender. This email is free from viruses and malware because avast! Antivirus <http://www.avast.com/> protection is active.
