* cbDrop.CC
* By Jim Sare - jimsare@worldnet.att.net
* Created: 09/10/1997
* Last Modified: 06/06/1998
*
* Fixes a problem with VdB 5.6 and 7.x ComboBox.AutoDrop when
* clicking on the pull-down button when the ComboBox does not
* have focus, the drop-down list drops, and then immediately
* pulls back up the first time clicked.
*
* Can also be used to provide AutoDrop functionality in
* dBW 5.0, VdB 5.5, and VdB 5.5a.

CLASS cbDrop(f) Of ComboBox(f) Custom

	If Type("PostMessage") # "FP"
		#if __vdb__ >=7
			extern CLONG PostMessage(CHANDLE, CINT, CLONG, CLONG) User32;
						From "PostMessageA"
		#else
			extern CLONG PostMessage(CHANDLE, CINT, CWORD, CLONG) User
		#endif
	EndIf
	If Type("SendMessage") # "FP"
		#if __vdb__ >=7
			extern CLONG SendMessage(CHANDLE, CINT, CLONG, CLONG) User32;
						From "SendMessageA"
		#else
			extern CLONG SendMessage(CHANDLE, CINT, CWORD, CLONG) User
		#endif
	EndIf
		#ifndef	WM_USER
			#define	WM_USER		HToI("400")
		#endif
		#ifndef	CB_SHOWDROPDOWN
			#define	CB_SHOWDROPDOWN	WM_USER + 15
		#endif
		#ifndef WM_CANCELMODE
			#define	WM_CANCELMODE	HToI("1F")
		#endif

	this.AutoDrop =		.T.

	PROCEDURE OnGotFocus

		If this.AutoDrop
			SendMessage(this.hWND, WM_CANCELMODE, 0, 0)
			this.Drop()
		EndIf

	PROCEDURE Drop

		PostMessage(this.hWND, CB_SHOWDROPDOWN, 1, 0)

	PROCEDURE PullUp

		PostMessage(this.hWND, CB_SHOWDROPDOWN, 0, 0)

ENDCLASS  && cbDrop Of ComboBox

* EOF: cbDrop.CC

