Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListView Mouse Events Not Working 1

Status
Not open for further replies.

davidmreid

Programmer
Nov 30, 2001
16
0
0
US
Does anyone know how to get the Mouse events (MouseDown, MouseUp, etc...) of the ListView control (MSComctlLib.ListViewCtrl.2) to work in Access 2000/2002? I am trying to use the mouse events to perform a Drag-and-Drop from one listview control to another. I downloaded an excellent sample listview control I found at Tek-Tips ( . However, the mouse events for a drag-drop operation between two ListView controls does not work. ...Any ideas?
 
Here is one for popup menu on listview right click.
Code:
Private Sub listView1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
    If Me.ListView1.ListItems.Count = 0 Then
        MsgBox "Right click menu available only if the list is filled with employees records", vbOKOnly, "Human Resources Management"
    Else
        If Button = acRightButton Then
            Dim cb As CommandBar
            Set cb = CommandBars("LVEmployees")
            cb.ShowPopup
        End If
    End If
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
Even a thief takes ten years to learn his trade.
 
These events don't show in the property window of the Form (Access window) but they are available in the VBE pane.

In the VBE pane, in the code window there are two combo boxes. In the one on the right you should be able to select your ListView control (by name), then in the combo box on the left you should be able to choose from the complete list of methods/events.

Hope this helps,
CMP
P.S. I'm working in Access 2003 (SP2) using Microsoft Common Controls 6.0 (SP6).

Funny thing about being unemployed, weekends don't mean quite so much, just means you get to hang out with your working friends. Primus
 
Thank you for your help. An error message occurs on the cb.ShowPop line (Compile Error: Method or Data Member not found.) Apparently, I may have a corrupt mso.dll file that supports the CommandBar. Any suggestions?

Regards,
Dave

P.S. On a positive note, I no longer get an error message on the mouse event.
 
Hi CautionMP and ZmrAbdulla,

I do not know why... ButI got the procedure to work--after several unsuccessful attempts--when I simply re-keyed "cb.ShowPopup". Go figure.

Thanks, again.
-D.

P.S. I really like the sample work done by ZmrAbdulla. Excellent! A+
 
Thanks dave,
As CautionMP said all the functions are available in the VBE window.

here is a thread I had replied contain useful links to TT threads.
thread707-1100647

________________________________________________________
Zameer Abdulla
Help to find Missing people
Even a thief takes ten years to learn his trade.
 
Running the Office XP Service Pack 3 (SP3) for Access 2002 Runtime ( is what may have saved the day. Also, I read that Adobe files will override the MSO.dll file. I use Adobe to send Logic Process Charts to the PM depicting every input and output associated with each process or task, and related milestone and due date. Adobe seems to work best to print and distribute Access reports.

Now on to the adventure I call "ListBox Drag-and-Drop" between two of your listbox examples. Do you think this is possible? I have been using the sample from Stephen Lebans. But I need more than the one column of data that his example only allows and I like the functionality/display of your control example. On the other hand, by offering three choices for the text display of items in a listbox and the functionality of the actual drag-and-drop--he has built an excellent download! Onward I trudge...

Regards,

-D.
 
I have never tried.. it may be possible.
You may find many examples in VB6.A sample here.


I am not sure how much you have to amend to work it in VBA.

________________________________________________________
Zameer Abdulla
Help to find Missing people
Even a thief takes ten years to learn his trade.
 
Yes it's possible. Look at the [tt]OLE...()[/tt] events of the ListView control. These will allow you drag a DataItem (list item) from one control to another.

Let me know if have trouble getting this to work and I will try and work up a sample.

CMP

Funny thing about being unemployed, weekends don't mean quite so much, just means you get to hang out with your working friends. Primus
 
I am still having a problem with the code listed below that I got from ZmrAbdulla.

Private Sub listView1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
If Me.ListView1.ListItems.Count = 0 Then
MsgBox "Right click menu available only if the list is filled with employees records", vbOKOnly, "Human Resources Management"
Else
If Button = acRightButton Then
Dim cb As CommandBar
Set cb = CommandBars("LVEmployees")
cb.ShowPopup
End If
End If
End Sub

This code bugs out (Runtime Error 5: Invalid procedure call or arguement) at the line:

Set cb = CommandBars("LVEmployees").

I have had no luck with the following syntax either:

Set cb = CommandBars.Add(Name:="Test", Position:=msoBarPopup, Temporary:=False)

or

Set cb = CommandBars.Add(Name:="Custom1", Position:=msoBarFloating)

I would appreciate your help.

Thank you!




 
LVEmployees" is the name of popup menu. You need to replace it with your popup menu name.

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top