Click here to Skip to main content
15,896,453 members
Articles / Desktop Programming / MFC

Dynamically switchable multi-purpose control

Rate me:
Please Sign up or sign in to vote.
4.43/5 (9 votes)
5 Mar 2002CPOL10 min read 149.8K   2.2K   57  
Control which allows run-time switching between a number of control types, eg combo, edit etc
// MultiCtrlDemoDlg.h : header file
//

#if !defined(AFX_MULTICTRLDEMODLG_H__1430BBEA_8268_11D5_A89B_0000B48746CF__INCLUDED_)
#define AFX_MULTICTRLDEMODLG_H__1430BBEA_8268_11D5_A89B_0000B48746CF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "MultiCtrl.h"

/////////////////////////////////////////////////////////////////////////////
// CMultiCtrlDemoDlg dialog

class CMultiCtrlDemoDlg : public CDialog
{
// Construction
public:
	CMultiCtrlDemoDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CMultiCtrlDemoDlg)
	enum { IDD = IDD_MULTICTRLDEMO_DIALOG };
	CButton	m_btnHidden;
	CButton	m_btnAutoFitLabel;
	CMultiCtrl	m_ctrl;
	CComboBox	m_comboType;
	CButton	m_btnNormal;
	CEdit	m_editValue;
	CEdit	m_editTooltip;
	CEdit	m_editLabel;
	CButton	m_btnNoLabel;
	CButton	m_btnBrowseBtn;
	CButton	m_btnReadOnly;
	CButton	m_btnDisabled;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMultiCtrlDemoDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CMultiCtrlDemoDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnSelendokComboAttrib();
	afx_msg void OnSelendokComboType();
	afx_msg void OnFld();
	afx_msg void OnBtnSetValue();
	afx_msg void OnBtnSetTooltip();
	afx_msg void OnBtnSetLabel();
	afx_msg void OnBtnReadonly();
	afx_msg void OnBtnNormal();
	afx_msg void OnBtnNoLabel();
	afx_msg void OnBtnHidden();
	afx_msg void OnBtnDisabled();
	afx_msg void OnBtnBrowseBtn();
	afx_msg void OnBtnLabelAuto();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MULTICTRLDEMODLG_H__1430BBEA_8268_11D5_A89B_0000B48746CF__INCLUDED_)

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
Originally from an electronics background, I moved into software in 1996, partly as a result of being made redundant, and partly because I was very much enjoying the small amount of coding (in-at-the-deep-end-C) that I had been doing!

I swiftly moved from C to C++, and learned MFC, and then went on to real-time C on Unix. After this I moved to the company for which I currently work, which specialises in Configuration Management software, and currently program mainly in C/C++, for Windows. I have been gradually moving their legacy C code over to use C++ (with STL, MFC, ATL, and WTL). I have pulled in other technologies (Java, C#, VB, COM, SOAP) where appropriate, especially when integrating with third-party products.

In addition to that, I have overseen the technical side of the company website (ASP, VBScript, JavaScript, HTML, CSS), and have also worked closely with colleagues working on other products (Web-based, C#, ASP.NET, SQL, etc).

For developing, I mainly use Visual Studio 2010, along with an in-house-designed editor based on Andrei Stcherbatchenko's syntax parsing classes, and various (mostly freeware) tools. For website design, I use Dreaweaver CS3.

When not developing software, I enjoy listening to and playing music, playing electric and acoustic guitars and mandolin.

Comments and Discussions