Home All Groups Group Topic Archive Search About
Author
5 Mar 2009 4:01 PM
Charlie
I have a ListBox on a form, say List1, Sorted = Yes, MultiSelect = 2

List1.AddItem "Alpha"
List1.AddItem "Bravo"
List1.AddItem "Charlie"
List1.AddItem "Delta"
List1.AddItem "Echo"

If I click on an item, say "Alpha", then press a letter key, say "D", the
selected item jumps to "Delta" correctly, but one second later "Alpha"
becomes highlighted again.  Upon examining selected items I see that only
"Delta" is actually selected, not "Alpha".  It is simply highlighted.  Is
this a known quirk?  Is there a workaround?

TIA
Charlie

Author
5 Mar 2009 4:10 PM
Bob Butler
Show quote Hide quote
"Charlie" <Char***@discussions.microsoft.com> wrote in message
news:F971E710-316F-4689-A22D-26BF00429250@microsoft.com...
>I have a ListBox on a form, say List1, Sorted = Yes, MultiSelect = 2
>
> List1.AddItem "Alpha"
> List1.AddItem "Bravo"
> List1.AddItem "Charlie"
> List1.AddItem "Delta"
> List1.AddItem "Echo"
>
> If I click on an item, say "Alpha", then press a letter key, say "D", the
> selected item jumps to "Delta" correctly, but one second later "Alpha"
> becomes highlighted again.  Upon examining selected items I see that only
> "Delta" is actually selected, not "Alpha".  It is simply highlighted.  Is
> this a known quirk?  Is there a workaround?

Looks like a bug to me; I never noticed that before.
Author
5 Mar 2009 7:11 PM
Charlie
I figured out a workaround but it's such a bunch of rigamarole I may not use
it.

It seems that the keypress-to-jump functionality sets a timer to allow for
subsequent keypresses (of the same key) to jump further down the list (within
the same character range.)  Not pressing any keys for just shy of two seconds
kills the timer.  That's when the screen gets incorrectly refreshed.  It may
be a Windows problem, not a ListBox problem, because
minimizing-then-maximizing or dragging another window over the ListBox window
erases the highlight.

I used the KeyPress event to set my own timer (code I probably got here) to
refresh the ListBox and clear the phantom highlighted row.  It flashes
momentarily (Application.ScreenUpdating didn't help) but it was the best I
could do.  I tried shortening my timer but if it fires before the keyjump
timer then it's useless. So far 1800 ms (1.8 sec) works ok.

The problem is that anytime I try something funky like this it backfires.  I
wondered what would happen if I exited the form or app before the timer
fired?  I saved my project first, as always, then clicked away.  Sure enough,
I crashed the IDE.  The compiled exe didn't seem to have a problem though. 
Still, I don't know if I'm going to use the fix or not...  Then again, broken
apps can be job security.  :)

'(in a standard module)
'
Public Declare Function SetTimer Lib "User32" ( _
        ByVal hWnd As Long, _
        ByVal nIDEvent As Long, _
        ByVal uElapse As Long, _
        ByVal lpTimerFunc As Long) As Long
'
Public Declare Function KillTimer Lib "User32" ( _
        ByVal hWnd As Long, _
        ByVal nIDEvent As Long) As Long
'
Public TimerID As Long
'
Public Sub StartTimer()
'
    On Error Resume Next
    TimerID = SetTimer(0, 0, 1800, AddressOf TimerProc)
'
End Sub
Public Sub EndTimer()
'
    On Error Resume Next
    KillTimer 0, TimerID
'
End Sub
Public Sub TimerProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal nIDEvent
As Long, _
  ByVal dwTimer As Long)
'
    frmSelectItems.lstItems.Refresh
    EndTimer
'
End Sub

'(in the form's module)

Private Sub lstItems_KeyPress(KeyAscii As Integer)
'
'   for the benefit of multiple key presses stop and restart the timer
'
    If KeyAscii >= 32 And KeyAscii <= 126 Then
        EndTimer
        StartTimer
      End If
'
End Sub



Show quoteHide quote
"Bob Butler" wrote:

>
> "Charlie" <Char***@discussions.microsoft.com> wrote in message
> news:F971E710-316F-4689-A22D-26BF00429250@microsoft.com...
> >I have a ListBox on a form, say List1, Sorted = Yes, MultiSelect = 2
> >
> > List1.AddItem "Alpha"
> > List1.AddItem "Bravo"
> > List1.AddItem "Charlie"
> > List1.AddItem "Delta"
> > List1.AddItem "Echo"
> >
> > If I click on an item, say "Alpha", then press a letter key, say "D", the
> > selected item jumps to "Delta" correctly, but one second later "Alpha"
> > becomes highlighted again.  Upon examining selected items I see that only
> > "Delta" is actually selected, not "Alpha".  It is simply highlighted.  Is
> > this a known quirk?  Is there a workaround?
>
> Looks like a bug to me; I never noticed that before.
>
>
Author
5 Mar 2009 8:01 PM
Charlie
even simpler: I turned off the Sorted property and sorted the list myself. 
That solved it.

Show quoteHide quote
"Bob Butler" wrote:

>
> "Charlie" <Char***@discussions.microsoft.com> wrote in message
> news:F971E710-316F-4689-A22D-26BF00429250@microsoft.com...
> >I have a ListBox on a form, say List1, Sorted = Yes, MultiSelect = 2
> >
> > List1.AddItem "Alpha"
> > List1.AddItem "Bravo"
> > List1.AddItem "Charlie"
> > List1.AddItem "Delta"
> > List1.AddItem "Echo"
> >
> > If I click on an item, say "Alpha", then press a letter key, say "D", the
> > selected item jumps to "Delta" correctly, but one second later "Alpha"
> > becomes highlighted again.  Upon examining selected items I see that only
> > "Delta" is actually selected, not "Alpha".  It is simply highlighted.  Is
> > this a known quirk?  Is there a workaround?
>
> Looks like a bug to me; I never noticed that before.
>
>
Author
5 Mar 2009 5:18 PM
Bee
You will see similar nonsense in the VB6 IDE Project Window.
This is so that MS can provide fixes in a paid for newer version.
That's how the Windows OS has evolved!
Instead of a service pack to fix Vista, we have to pay for Windows 7.
Write your congressman or woman.
Power to the people.

Show quoteHide quote
"Charlie" wrote:

> I have a ListBox on a form, say List1, Sorted = Yes, MultiSelect = 2
>
> List1.AddItem "Alpha"
> List1.AddItem "Bravo"
> List1.AddItem "Charlie"
> List1.AddItem "Delta"
> List1.AddItem "Echo"
>
> If I click on an item, say "Alpha", then press a letter key, say "D", the
> selected item jumps to "Delta" correctly, but one second later "Alpha"
> becomes highlighted again.  Upon examining selected items I see that only
> "Delta" is actually selected, not "Alpha".  It is simply highlighted.  Is
> this a known quirk?  Is there a workaround?
>
> TIA
> Charlie
>
Author
5 Mar 2009 7:16 PM
Charlie
It doesn't surprise me.

P.S. My Congresswoman is about as useless as t... nevermind

Show quoteHide quote
"Bee" wrote:

>
> You will see similar nonsense in the VB6 IDE Project Window.
> This is so that MS can provide fixes in a paid for newer version.
> That's how the Windows OS has evolved!
> Instead of a service pack to fix Vista, we have to pay for Windows 7.
> Write your congressman or woman.
> Power to the people.
>
> "Charlie" wrote:
>
> > I have a ListBox on a form, say List1, Sorted = Yes, MultiSelect = 2
> >
> > List1.AddItem "Alpha"
> > List1.AddItem "Bravo"
> > List1.AddItem "Charlie"
> > List1.AddItem "Delta"
> > List1.AddItem "Echo"
> >
> > If I click on an item, say "Alpha", then press a letter key, say "D", the
> > selected item jumps to "Delta" correctly, but one second later "Alpha"
> > becomes highlighted again.  Upon examining selected items I see that only
> > "Delta" is actually selected, not "Alpha".  It is simply highlighted.  Is
> > this a known quirk?  Is there a workaround?
> >
> > TIA
> > Charlie
> >
Author
5 Mar 2009 7:19 PM
Jeff Johnson
"Bee" <B**@discussions.microsoft.com> wrote in message
news:02FF4BB7-5B27-4DF4-ABC6-07F53E1E19EB@microsoft.com...

> You will see similar nonsense in the VB6 IDE Project Window.
> This is so that MS can provide fixes in a paid for newer version.
> That's how the Windows OS has evolved!
> Instead of a service pack to fix Vista, we have to pay for Windows 7.
> Write your congressman or woman.
> Power to the people.

And tinfoil hats for all!
Author
6 Mar 2009 1:07 AM
Bee
I don't see them on Amazon, so where can I buy them and how much?


Show quoteHide quote
"Jeff Johnson" wrote:

> "Bee" <B**@discussions.microsoft.com> wrote in message
> news:02FF4BB7-5B27-4DF4-ABC6-07F53E1E19EB@microsoft.com...
>
> > You will see similar nonsense in the VB6 IDE Project Window.
> > This is so that MS can provide fixes in a paid for newer version.
> > That's how the Windows OS has evolved!
> > Instead of a service pack to fix Vista, we have to pay for Windows 7.
> > Write your congressman or woman.
> > Power to the people.
>
> And tinfoil hats for all!
>
>
>
Author
6 Mar 2009 1:44 AM
Karl E. Peterson
Bee wrote:
>> And tinfoil hats for all!
>
> I don't see them on Amazon, so where can I buy them and how much?

http://www.google.com/products?q=tinfoil+hat  -  HTH!
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
6 Mar 2009 9:16 AM
Mike Williams
"Bee" <B**@discussions.microsoft.com> wrote in message
news:02FF4BB7-5B27-4DF4-ABC6-07F53E1E19EB@microsoft.com...

> You will see similar nonsense in the VB6 IDE Project
> Window. This is so that MS can provide fixes in a paid
> for newer version. That's how the Windows OS has
> evolved! Instead of a service pack to fix Vista, we have
> to pay for Windows 7.

It'll be even worse when Micro$oft have persuaded everyone to enter their
brave new world of the future, the world of rented software where users pay
by the hour or by the document. And it'll be even worse still if Micro$oft's
wet dream comes true, rented operating systems :-)

Mike
Author
8 Mar 2009 3:19 AM
David
> It'll be even worse when Micro$oft have persuaded everyone to enter their
> brave new world of the future, the world of rented software where users
> pay by the hour or by the document. And it'll be even worse still if
> Micro$oft's wet dream comes true, rented operating systems :-)

Looks like we've come full circle back to the old "Big Blue" (IBM) mainframe
concept.


Show quoteHide quote
"Mike Williams" <M***@WhiskyAndCoke.com> wrote in message
news:uGOdgRknJHA.4252@TK2MSFTNGP02.phx.gbl...
> "Bee" <B**@discussions.microsoft.com> wrote in message
> news:02FF4BB7-5B27-4DF4-ABC6-07F53E1E19EB@microsoft.com...
>
>> You will see similar nonsense in the VB6 IDE Project
>> Window. This is so that MS can provide fixes in a paid
>> for newer version. That's how the Windows OS has
>> evolved! Instead of a service pack to fix Vista, we have
>> to pay for Windows 7.
>
> It'll be even worse when Micro$oft have persuaded everyone to enter their
> brave new world of the future, the world of rented software where users
> pay by the hour or by the document. And it'll be even worse still if
> Micro$oft's wet dream comes true, rented operating systems :-)
>
> Mike
>
>
>
Author
6 Mar 2009 9:16 AM
Mike Williams
"Bee" <B**@discussions.microsoft.com> wrote in message
news:02FF4BB7-5B27-4DF4-ABC6-07F53E1E19EB@microsoft.com...

> You will see similar nonsense in the VB6 IDE Project
> Window. This is so that MS can provide fixes in a paid
> for newer version. That's how the Windows OS has
> evolved! Instead of a service pack to fix Vista, we have
> to pay for Windows 7.

It'll be even worse when Micro$oft have persuaded everyone to enter their
brave new world of the future, the world of rented software where users pay
by the hour or by the document. And it'll be even worse still if Micro$oft's
wet dream comes true, rented operating systems :-)

Mike