[AccessD] Building a ListView control class?

jwcolby jwcolby at colbyconsulting.com
Thu Mar 5 14:45:27 CST 2009


philippe

My guess is that you don't need to set the OnClick event property to [Event Procedure] the way that 
you do in Access.

Comment out that line.  It should then compile.  If it lets you dimension the variable WithEvents, 
and you can compile, then you will probably be able to sink the events.

If it does in fact compile then instantiate the class and cause an event to fire (that you are 
sinking) and blace a breakpoint in the event sink in your class.  See if you get control.

I seem to remember building a class for the serial port of that same control ocx, and it worked just 
fine.  Of course that was back in the early 80s and I have since lost my copy of the control.  That 
is the one that came with VB6, and that you have to have a license to use?

John W. Colby
www.ColbyConsulting.com


philippe pons wrote:
> Hi all,
> 
> Following John W. Colby lectures on classes (thank's to him once again), I
> tried to build one for a ListView control.
> It's an ActiveX that resides within the mscomctl.ocx.
> 
> I déclared a clsListView.
> In the header of the class I declared:
> 
> Private WithEvents mctlListView As MSComctlLib.Listview
> Private Const cstrEvProc As String = "[Event Procedure]"
> 
> NB: omitting the name of the class:MSComctlLib leads to an error msg when
> compiling.
> 
> Then the init function:
> 
> Function mInit(lctlListView As ComboBox)
>     ' stores a pointer to the control
>     Set mctlListView = lctlListView
>     ' affecte la chaine [Event Procedure] aux propriétés événementielles
>     mctlListView.OnClick = cstrEvProc
> '    mctlListView.ondbkclick = cstrEvProc
> End Function
> 
> The problem is that the OnClick property gives a compile error!
> The ListView control has an Click event, but no OnClick property.
> 
> If you look at the ListView control in the object brower, it appears that it
> has no event property, just events!
> 
> I'm afraid it will not be easy to use a class control for this control and
> be able to sink events, what is what I need to do.
> 
> Any tricks, brothers?
> 
> Regards,
> 
> Philippe



More information about the AccessD mailing list