So you're saying:
sleep 10
dObj.Control("lvResults").Focus
dObj.Control("lvResults").Items(1).Focused = True

still doesn't speak anything here.
This is pretty mind-boggling.

----- Original Message ----- From: "Chip Orange" <[email protected]>
To: <[email protected]>
Sent: Tuesday, February 08, 2011 10:03 PM
Subject: RE: Timing Issue


you're right; I just tried it again and 1 out of 3 tries it did not speak
automatically. but it was focused on this control when it didn't speak, so
I did agree with your thinking that there's some odd timing issue.

so I looked at the code, and I see you select the first item in the list
after you make the control have the focus, and I wondered if the item was
already selected when the control got the focus, would that make it read all
the time?  so I took the two lines you have, and I reversed them so the
selection of item 1 happens first, then the control gets focus, and in my
test I always heard it speak the first item every time!  here are the two
lines I mean below; they are immediately after the sleep command:

dObj.Control("lvResults").Focus
dObj.Control("lvResults").Items(1).Focused = True


hth,

Chip


-----Original Message-----
From: J.J. Meddaugh [mailto:[email protected]]
Sent: Tuesday, February 08, 2011 6:50 PM
To: [email protected]
Subject: Re: Timing Issue

Which is odd. Did it speak the first result automatically for you, though?

----- Original Message -----
From: "Chip Orange" <[email protected]>
To: <[email protected]>
Sent: Tuesday, February 08, 2011 5:33 PM
Subject: RE: Timing Issue


Yep; I took a look at your existing code and you already had it.

so I ran several test searches, and it always focused for me and I always had a selected item. when I looked at the code, it all looked good to me.



-----Original Message-----
From: J.J. Meddaugh [mailto:[email protected]]
Sent: Tuesday, February 08, 2011 4:22 PM
To: [email protected]
Subject: Re: Timing Issue

That one doesn't seem to help.
It could always be a bug, but more likely it's my code.
----- Original Message -----
From: "Chip Orange" <[email protected]>
To: <[email protected]>
Sent: Tuesday, February 08, 2011 4:19 PM
Subject: RE: Timing Issue


ok, if I had paid attention I'd have seen you say listview and not
listbox.
still, the idea I had is that no item may be selected by default.  so I
looked at the manual for listview controls, and then line below might
work
for a listview:

If dObj.Control("lvResults").Items.Count > 0 Then
dObj.Control("lvResults").Items(1).focused = true

hth,

Chip

-----Original Message-----
From: J.J. Meddaugh [mailto:[email protected]]
Sent: Tuesday, February 08, 2011 3:47 PM
To: [email protected]
Subject: Re: Timing Issue

I must be off a step, and my scripting manual won't currently open.

If dObj.Control("lvResults").Items.Count > 0 Then
dObj.Control("lvResults").Items.FocusedIndex = 1


----- Original Message ----- From: "Chip Orange" <[email protected]>
To: <[email protected]>
Sent: Tuesday, February 08, 2011 3:37 PM
Subject: RE: Timing Issue


No, more like this one:

' after listbox has had data added to it
If oListbox.Count > 0 Then oListbox.FocusedIndex = 1



-----Original Message-----
From: J.J. Meddaugh [mailto:[email protected]]
Sent: Tuesday, February 08, 2011 3:27 PM
To: [email protected]
Subject: Re: Timing Issue

Are you talking about this line?
dObj.Control("lvResults").Items(1).Focused = True

----- Original Message -----
From: "Chip Orange" <[email protected]>
To: <[email protected]>
Sent: Tuesday, February 08, 2011 3:12 PM
Subject: RE: Timing Issue


J.J.,

are you setting the index of the selected item to 1 for the listbox?

I seem to recall having a similar intermittent problem with a listbox
until
I did this (had to check though to make sure the listbox did have
something).

Chip


-----Original Message-----
From: J.J. Meddaugh [mailto:[email protected]]
Sent: Tuesday, February 08, 2011 2:15 PM
To: [email protected]
Subject: Timing Issue

In the Blind Bargains Product Search app, there's an edit box for the
user
to type in a search phrase. Then, the results are loaded from the web
and
displayed in a listbox where focus is moved. Sometimes, however, the
focus
is moved and nothing is spoken. I'm thinking it's a timing issue of
some
sort. Should I move focus before the results are there or wait until
they
are for sure populated?

Currently, the listview is populated, and then there's this:
sleep 10
dObj.Control("lvResults").Focus
dObj.Control("lvResults").Items(1).Focused = True

I tried adding that sleep line above but to no avail.
If I wish focus before the search is initiated, there's extraneous
speech
spoken (no selected item), etc.

Thanks for any help.












Reply via email to