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. >>> >>> >>> >> >> > >
