Click here to Skip to main content
15,885,365 members
Articles / Desktop Programming / WTL

Form Designer

26 Jul 2021CPOL24 min read 351.2K   82.5K   230  
Component for adding scriptable forms capabilities to an application.
// ValueEditor.h: interface for the CValueEditor class.
//
// Author : David Shepherd
//			Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_VALUEEDITOR_H__8E49A3A3_7163_11D6_BCED_444553540000__INCLUDED_)
#define AFX_VALUEEDITOR_H__8E49A3A3_7163_11D6_BCED_444553540000__INCLUDED_

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

// edit box id
#define VE_IDC_EDIT		0x1000
// edit box message map id
#define VE_MSG_MAP_EDIT	VE_IDC_EDIT

/////////////////////////////////////////////////////////////////////////////
// CValueEditor
class CValueEditor : public CWindowImpl<CValueEditor>
{
private:
	// edit box
	CContainedWindowT<CEdit> m_Edit;

	// while TRUE this keeps the internal message loop running
	BOOL m_RunMessageLoop;

public:
	// value
	std::wstring m_Value;

	CValueEditor();
	virtual ~CValueEditor();

	// edits the value
	BOOL EditValue(const CWindow &Parent,const CRect &Rect);

BEGIN_MSG_MAP(CValueEditor)
	MESSAGE_HANDLER(WM_CREATE, OnCreate)
	MESSAGE_HANDLER(WM_SIZE, OnSize)
	MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
	MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
	COMMAND_HANDLER(VE_IDC_EDIT, EN_CHANGE, OnChangeEdit)
// edit box message map
ALT_MSG_MAP(VE_MSG_MAP_EDIT)
	MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
	MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
END_MSG_MAP()
// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

// message handlers
	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnChangeEdit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

// message handlers (edit box)
};

#endif // !defined(AFX_VALUEEDITOR_H__8E49A3A3_7163_11D6_BCED_444553540000__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
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions