Okay, I think I found another bug with Listboxes using Multi-Extend Selection Mode

R

Ronald Dodge

Using Access 2002, SP2

As I'm attempting to create my Drag and Drop feature for both Keyboard and
Mouse methods, I generally try to test for all sorts of possibilities
including the ones that you wouldn't think users may do, but yet, knowing
that sometimes, users do just those very things that you thought users
probably wouldn't do, so that's why I test for all sorts of things.

Now for the bug, if a user uses the mouse and has 2 selections adjascent to
each other, then desides for some strange reason to use the keyboard method
and holds down the shift key, then press the arrow that goes back to the
first selection area, the last item of the first area become unselected,
which then the user can no longer continue to use the shift key and the
keyboard for further selection. Furthermore, after the user realizes this
and decides to use either the mouse or the keyboard for any other selection
type deal on the listbox, the very item that got deselected from holding
down the shift key and using the arrow key, that item becomes either in
selected mode when it's NOT meant to be selected or it is NOT in selected
mode, when it is meant to be selected.

Steps to recreate this behavior

Create a test form

Add a Listbox to it

Set the RowSourceType as Value List

Set Multi Select to Extended

Set RowSource =
Test1;Test2;Test3;Test4;Test5;Test6;Test7;Test8;Test9;Test10;Test11;Test12

Set ColumnCount = 1

Now close out the Property dialog box, if you have it open.

Goto Form (Run-time) mode

Click and hold the Left mouse button down on "Test4" item

As holding down the left mouse button, drag the mouse to "Test7" item

Left up on the mouse left button

Press and hold the "Ctrl" key (either one, doesn't matter)

Now single click and left up with the left mouse button on "Test8" item

Hold down the "Shift" key (either one, doesn't matter)

Press and release the "Up Arrow" key.

Now try to do anything with the mouse and/or the keyboard and pay attention
to "Test7" item and note how when it's highlighted, it's not meant to be
selected, but yet, when it's not highlighted, it's meant to be selected.
all other items shows highlighted when meant to be selected and not
highlighted when not meant to be selected.

Exception of this rule, if you cause another form/application to hide that
item or even a portion of that item that is not highlighting at the
appropriate times, when you bring the form back up, what ever portion of
that particular item (if not all of it) was hidden, that portion of the item
now shows the highlighting correctly. I have tried repainting the form,
even with a delay via 2 different ways, either with the sleep method in VBA
code, or via the form's OnTimer event in conjunction with the form's
TimerInterval property, both methods failed to resolve the issue. Access
forms doesn't seem to have a Hide/Show method for forms, at least not that
I'm aware of like what user forms in Excel has.

2 other things I have attempted to do to resolve the issue:

Set the Selected property to -1, one time (as by doing this, at least via
the mouse method, it changes the highlighted state of the object while the
object has the focus, unlike how it's documented in the help page stating
that -1 on the selected property of the item means true for yes, it's
selected, and the value of 0 means false for not selected according to the
help page, but it doesn't work that way while the object has the focus)

While the object has the focus, set the ListIndex value to the row that it's
intended to get the highlight, but that doesn't resolve it either.

At this point of time, I will have to document this as a known issue and
continue on with my keyboard method of adding a drag and drop type feature
to listboxes, unless someone else has a fix for this issue (demonstrated
above).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top