Click here to Skip to main content
15,888,286 members
Articles / Desktop Programming / MFC

iTunes like Find Edit Control

Rate me:
Please Sign up or sign in to vote.
4.81/5 (25 votes)
3 Aug 20063 min read 86.1K   4.1K   80  
Edit Control with Button similar to iTunes Find Edit Control
#pragma once

//DISCLAIMER:
//The code in this project is Copyright (C) 2006 by Gautam Jain. You have the right to
//use and distribute the code in any way you see fit as long as this paragraph is included
//with the distribution. No warranties or claims are made as to the validity of the
//information and code contained herein, so use it at your own risk.


#define WM_USER_EDITWITHBUTTON_CLICKED	(WM_USER + 3000)

// CEditWithButton

class CEditWithButton : public CEdit
{
	DECLARE_DYNAMIC(CEditWithButton)

protected:
	CBitmap m_bmpEmptyEdit;
	CBitmap m_bmpFilledEdit;
	CSize   m_sizeEmptyBitmap;
	CSize   m_sizeFilledBitmap;
	CRect	m_rcEditArea;
	CRect	m_rcButtonArea;
	BOOL	m_bButtonExistsAlways;
	UINT	m_iButtonClickedMessageId;

public:
	

	BOOL SetBitmaps(UINT iEmptyEdit, UINT iFilledEdit);
	void SetButtonArea(CRect rcButtonArea);
	BOOL SetEditArea(CRect rcEditArea);
	void SetButtonClickedMessageId(UINT iButtonClickedMessageId);
	void SetButtonExistsAlways(BOOL bButtonExistsAlways);

	CEditWithButton();
	virtual ~CEditWithButton();
	virtual void PreSubclassWindow( );
	virtual BOOL PreTranslateMessage( MSG* pMsg );

protected:

	void ResizeWindow();


	DECLARE_MESSAGE_MAP()
public:
	
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam); // Maps to WM_SETFONT

};


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
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions