Jeff,

 

I don’t see that you’re initializing the variable Temp anywhere, and I also 
don’t see that you are setting the focusedIndex property of the listbox 
anywhere (which is usually done when you add items to the listbox; you usually 
set it to 1 when you add your listbox items).

 

Take out the line:

If fObj("lst").FocusedIndex <> Temp Then

And you should then hear something spoken each time your listbox item is 
changed.

 

Chip

 

 

From: Jeff Weiss [mailto:[email protected]] 
Sent: Sunday, January 12, 2014 10:33 PM
To: [email protected]
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

 

Reply via email to