Click here to Skip to main content
15,885,767 members
Articles / Desktop Programming / MFC

ComboTree

Rate me:
Please Sign up or sign in to vote.
4.57/5 (17 votes)
11 May 2003 242K   6.9K   93  
ComboBox with a tree control drop down
// Based on example from September 2000 MSDN Magazine
// in C++ Q&A Tooltip article by Paul DiLascia (p155)
//

#pragma once

#include "subclass.h"
#include "puptext.h"

//////////////////
// Generic tip-handler to display tip for wide text in a TreeView box.
// To use:
// - instantiate one of these for each tree control
// - call Init
//
class ComboTreeTip : public CSubclassWnd {
protected:
	UINT	m_idMyControl;				 // id of tree control
	HTREEITEM m_hCurItem;				 // handle of current item
	BOOL	m_bCapture;					 // whether mouse is captured
	static CPopupText g_wndTip;			 // THE tip window

	// subclass window proc
	virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp);

	// virtual fns you can override
	virtual void OnMouseMove(CPoint p);
	virtual BOOL IsRectCompletelyVisible(const CRect& rc);
	virtual HTREEITEM OnGetItemInfo(CPoint p, CRect& rc, CString& s);

public:
	ComboTreeTip();
	~ComboTreeTip();
	static UINT g_nTipTimeMsec;			 // global: msec wait before showing tip
	void Init(CWnd* pTreeCtl);				 // initialize
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions