dbTalk Databases Forums  

Listbox arrow down

comp.databases.ms-access comp.databases.ms-access


Discuss Listbox arrow down in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bob Darlington
 
Posts: n/a

Default Listbox arrow down - 06-20-2011 , 12:47 AM






I'm using a multi select list box after update event to call a separate
function to build a filter for a form using:

strList = ""
With Me!lstLAN
For Each lstItem In .ItemsSelected
If IsNull(Me!lstLAN.ItemData(lstItem)) Then Exit For
vLAN = Me!lstLAN.ItemData(lstItem)
If strList = "" Then
strList = "(LAN = " & vLAN
Else
strList = strList & " OR LAN = " & vLAN
End If
Next
End With

If strList <> "" Then strList = strList & ")"

strList is then used to filter the form.

If the after update is generated by the click event, all works fine. But if
the arrow down key is used, the previously selected item is displayed
instead of the current selection.
I seem to be missing something regarding the ItemsSelected bit.
Could anyone help me out?


--
Bob Darlington
Brisbane

Reply With Quote
  #2  
Old   
John Spencer
 
Posts: n/a

Default Re: Listbox arrow down - 06-20-2011 , 08:26 AM






As far as I know, you are not selecting an item when you arrow down or arrow
up if the multi-select is set to Simple. If you arrow down, the item is not
selected (not highlighted). If you then press the space bar then the item is
selected.

If the multi-select is set to complex, the behavior appears to be different in
that the item is highlighted. However, the problem is that the after update
event does not occur when you move into the item using the arrow keys. The
after update event fires as you move out of the item. So there is a
difference in behavior between clicking on an item in the list and moving to
the item using the keyboard.


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 6/20/2011 1:47 AM, Bob Darlington wrote:
Quote:
I'm using a multi select list box after update event to call a separate
function to build a filter for a form using:

strList = ""
With Me!lstLAN
For Each lstItem In .ItemsSelected
If IsNull(Me!lstLAN.ItemData(lstItem)) Then Exit For
vLAN = Me!lstLAN.ItemData(lstItem)
If strList = "" Then
strList = "(LAN = "& vLAN
Else
strList = strList& " OR LAN = "& vLAN
End If
Next
End With

If strList<> "" Then strList = strList& ")"

strList is then used to filter the form.

If the after update is generated by the click event, all works fine. But if
the arrow down key is used, the previously selected item is displayed
instead of the current selection.
I seem to be missing something regarding the ItemsSelected bit.
Could anyone help me out?


Reply With Quote
  #3  
Old   
Bob Darlington
 
Posts: n/a

Default Re: Listbox arrow down - 06-21-2011 , 02:45 AM



Thanks for the reply John.
What you say is what is happening, but I don't think it makes sense. If you
click on a row, it is highlighted and after update is called as expected
without having to move off that row. Arrow down, selects, but then updates
when you leave.
Unfortunately, 'simple' doesn't suit the requirement. I need to use
'extended' to be consistent in other areas of the program.
I'll need to find another way around it.

--
Bob Darlington
Brisbane

"John Spencer" <JSPENCER (AT) Hilltop (DOT) umbc> wrote

Quote:
As far as I know, you are not selecting an item when you arrow down or
arrow up if the multi-select is set to Simple. If you arrow down, the
item is not selected (not highlighted). If you then press the space bar
then the item is selected.

If the multi-select is set to complex, the behavior appears to be
different in that the item is highlighted. However, the problem is that
the after update event does not occur when you move into the item using
the arrow keys. The after update event fires as you move out of the item.
So there is a difference in behavior between clicking on an item in the
list and moving to the item using the keyboard.


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 6/20/2011 1:47 AM, Bob Darlington wrote:
I'm using a multi select list box after update event to call a separate
function to build a filter for a form using:

strList = ""
With Me!lstLAN
For Each lstItem In .ItemsSelected
If IsNull(Me!lstLAN.ItemData(lstItem)) Then Exit For
vLAN = Me!lstLAN.ItemData(lstItem)
If strList = "" Then
strList = "(LAN = "& vLAN
Else
strList = strList& " OR LAN = "& vLAN
End If
Next
End With

If strList<> "" Then strList = strList& ")"

strList is then used to filter the form.

If the after update is generated by the click event, all works fine. But
if
the arrow down key is used, the previously selected item is displayed
instead of the current selection.
I seem to be missing something regarding the ItemsSelected bit.
Could anyone help me out?



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.