HC Draglist

(c) 1999 Joe Hart

The Draglist is a listbox that adds the ability for the user to drag the items to a new location.  When the user starts dragging an item, an arrow will appear next to the listbox and as the user moves the mouse up and down, the arrow follows.  When the user stops dragging, if the arrow is not where the item came from, that item is moved to the location of the arrow.

This component was written in Visual Basic 6.0 and requires the VB 6.0 runtime files to operate.

Inherited from listbox:

	Properties:

	Apperance as EdrgAppearance
		Flat or 3D
	BackColor as OLE_COLOR
		The Color of the background of the listbox
	Enabled as Boolean
		Whether the listbox is enabled or not
	Font as StdFont
		The Font for the listbox (can set bold, italic, size, etc)
	ForeColor as OLE_COLOR
		The Color of the text of the listbox
	ItemData(Index) as Long
		The Item Data associated with each list item
	List(Index) as String
		The string for each item
	MousePointer as EdrgMousePointer
		hcDefault, hcArrow, hcCross, hcIBeam, etc...
	Selected(Index) as Boolean
		Whether the item is selected or not
		Only one item can be selected, so setting this clears the previous selection
	
	Methods:
	
	AddItem(String)
		Add an item to the End of the listbox
	Clear
		Clears all items from the listbox
	Refresh
		Redraws the items in the listbox
	RemoveItem(Index)
		Remove item from listbox
	SetFocus
		Sets the focus to the listbox
	
Methods implemented in the draglist that are not implemented in normal listbox:

	Properties:

	Contents as Variant
		 contents of the listbox.
			
			You can set the contents like this:
			
			Draglist1.Contents = AnArray() 'of strings
			
			You can retrieve the contents like this:

			Variant = Draglist1.Contents
			
			Returns a variant array containing all items in the list
	
	DragBackColor as OLECOLOR
		The color of the background where the pointer will be
		Applies only when dragging
	
	Methods:

	SetTabStops ETabStops, Value
		Changes the tabstop position of the listbox to simulate columns
		
		ETabstops = hcCustom or HCEvenSpaced
		
		Value = Long or an array of longs depending on ETabStop Setting

		Example:

			hcDragList1.SetTabStops hcEvenSpaced, 100

			Sets each tabstop at position 100.

			hcDragList1.SetTabStops hcCustom, TabArray()

			Sets each tabstop to each element of array

			IE: TabArray(0) = 50
				 TabArray(1) = 70
				 TabArray(2) = 100
				 TabArray(3) = 150

			The tabspaces would be set at 50,70,100,150
			
			Or:

			hcDragList1.SetTabStops hcCustom, Array(50,70,100,150)

			Would accomplish the same thing

		Note: tab widths are "dialog units" which are approxemately 1/4 of the width of the
		average charactor in the currently selected font.

	Events:

	Click - User clicked an item (but doesn't say which one)
	DblClick - User double clicked an item (tells which item was double clicked on)
	ItemDragBegin - Sent when drag begins (tells which item is going to be dragged)
	ItemDragEnd - Sent when drag ends (tells the From and To postions)
	ItemDragging - Sent when dragging (tells where the item is now)
	ItemDragCanceled - Sent if drag was canceled
	KeyDown - User pressed a key (but didn't let go)
	KeyPress - User pressed a key and let go
	KeyUp - User let go of key
	MouseDown - User pressed a mouse button
	MouseMove - User moved mouse
	MouseUp - User Let go of mouse button
	Scroll - List was scrolled
	Validate - List was Validated

Note:  There are some items that normal listboxes have that this draglist does not.  
Mainly because they would would not function with this sort of list.  Also there
are no DragDrop or DragOver events because when they are implented, VB will not allow
the project to compile.  If you know of a solution for this, please send me an email.

You can not autosort the listbox.
You can not bind any data to the listbox.  
You can not set listbox to multiselect. 

Due to a limitation of the VB property settings, you cannot set the items of the
list at design time.  They must be set at run time.  The only way around this would
be to make separate property pages for it, which I didn't feel like doing since I
normally set all the listboxes at runtime anyway.

If you can think of anything else to add to this draglist, or have any comments,
feel free to contact me at:

bghost@ti.cz

To see this draglist in a real program, check out Music Collector,
a freeware music database and player supporting MP3, WMA and MIDI files.

Music Collector is available for download from:

http://home.ti.cz/~bghost
