Click here to Skip to main content
13,793,706 members
Click here to Skip to main content

Stats

292.2K views
78.3K downloads
226 bookmarked
Posted 30 Dec 2005
Licenced CPOL

Form Designer

, 1 Aug 2009
Component for adding scriptable forms capabilities to an application.
MFCDemo.exe
CSDemo
App.ico
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
CSDemo.suo
DaeDoe.bmp
MFCDemo
MFCDemo.dsp
MFCDemo.odl
MFCDemo.reg
res
DaeDoe.bmp
MFCDemo.ico
MFCDemoDoc.ico
Toolbar1.bmp
Toolbar2.bmp
Toolbar3.bmp
Wand.bmp
VBDemo
Bmp
ABottom.bmp
About.bmp
ALeft.bmp
ARight.bmp
ATop.bmp
AX.bmp
BringFront.bmp
Button.bmp
Center.bmp
Check.bmp
Combo.bmp
Copy.bmp
Cut.bmp
Delete.bmp
Down.bmp
Edit.bmp
Frame.bmp
Grid.bmp
GridSettings.bmp
HCenter.bmp
HScroll.bmp
HSL.bmp
HSpace.bmp
HSS.bmp
Left.bmp
List.bmp
New.bmp
Open.bmp
Paste.bmp
Picture.bmp
Preview.bmp
Progress.bmp
Props.bmp
Radio.bmp
Rectangle.bmp
Redo.bmp
Right.bmp
Save.bmp
SelAll.bmp
SelNone.bmp
SendBack.bmp
SL.bmp
Slider.bmp
Spin.bmp
SS.bmp
Tab.bmp
Text.bmp
Undo.bmp
Up.bmp
Validate.bmp
VCenter.bmp
VScroll.bmp
VSL.bmp
VSpace.bmp
VSS.bmp
Wand.bmp
DaeDoe.bmp
VBDemo.vbp
DDForms.chm
DDForms
Archive
FormEditorItems.rgs
vssver.scc
Constants.scr
DaeDoe.bmp
DDForms.def
DDForms.vcproj
DDForms.vcproj.vspscc
EventSinkPassThrough.rgs
FormEditor.bmp
FormEditor.rgs
FormEditorItemCollection.rgs
FormEditorItemDetails.rgs
FormViewer.bmp
FormViewer.rgs
FormViewerItemCollection.rgs
FormViewerItemDetails.rgs
mssccprj.scc
PropPageExtended.rgs
PropPageFormEditor.rgs
PropPageFormViewer.rgs
PropPageSimpleScriptEditor.rgs
SimpleScriptEditor.bmp
SimpleScriptEditor.rgs
vssver.scc
DDFormsTools
CodeMaxDriver
CodeMaxDriver.rgs
CodeMaxDriver.vcproj
CodeMaxDriver.vcproj.vspscc
CodeMaxDriverps.def
CodeMaxDriverPS.vcproj
CodeMaxDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
CodeSenseDriver
CodeSenseDriver.rgs
CodeSenseDriver.vcproj
CodeSenseDriver.vcproj.vspscc
CodeSenseDriverps.def
CodeSenseDriverPS.vcproj
CodeSenseDriverPS.vcproj.vspscc
mssccprj.scc
vssver.scc
DDPropPageAll
DDPropPageAll.def
DDPropPageAll.vcproj
DDPropPageAll.vcproj.vspscc
mssccprj.scc
PropPageAll.rgs
vssver.scc
DDUnlock
DDUnlock.vcproj
DDUnlock.vcproj.vspscc
mssccprj.scc
vssver.scc
DDControlPack
DDButton.bmp
DDCheckBox.bmp
DDComboBox.bmp
DDControlPack.rgs
DDControlPack.vcproj
DDControlPack.vcproj.vspscc
DDHorzScrollBar.bmp
DDLabel.bmp
DDListBox.bmp
DDPicture.bmp
DDRadioButton.bmp
DDTextBox.bmp
DDVertScrollBar.bmp
mssccprj.scc
vssver.scc
Redistributables
Ansi
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
Unicode
CodeMaxDriver.dll
CodeSenseDriver.dll
DDControlPack.dll
DDForms.dll
DDPropPageAll.dll
// PropPageFormEditor.cpp : Implementation of CPropPageFormEditor
//
// Author : David Shepherd
//			Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "DDForms.h"
#include "PropPageFormEditor.h"

/////////////////////////////////////////////////////////////////////////////
// CPropPageFormEditor

CPropPageFormEditor::CPropPageFormEditor()
{
	// initialise everything
	m_dwTitleID=IDS_TITLEPropPageFormEditor;
	m_dwHelpFileID=IDS_HELPFILEPropPageFormEditor;
	m_dwDocStringID=IDS_DOCSTRINGPropPageFormEditor;
	m_BorderVisible=FALSE;
	m_FormWidth=0;
	m_FormHeight=0;
	m_GridVisible=FALSE;
	m_GridWidth=0;
	m_GridHeight=0;
}

STDMETHODIMP CPropPageFormEditor::Apply()
{
IMP_BEGIN
	// check there is only a single associated object
	if(m_nObjects!=1)
	{
		throw std::exception();
	}
	// get the IFormEditor interface for the associated object
	if(m_ppUnk[0]==NULL)
	{
		throw std::exception();
	}
	CComQIPtr<IFormEditor> spFormEditor(m_ppUnk[0]);
	if(spFormEditor==NULL)
	{
		throw std::exception();
	}
	// set the property values
	(void)DoDataExchange(TRUE);
	// border
	if(!SUCCEEDED(spFormEditor->
		put_BorderVisible(B2VB(m_BorderVisible))))
	{
		throw std::exception();
	}
	// form dimensions
	if(!SUCCEEDED(spFormEditor->put_FormWidth(m_FormWidth)))
	{
		throw std::exception();
	}
	if(!SUCCEEDED(spFormEditor->put_FormHeight(m_FormHeight)))
	{
		throw std::exception();
	}
	// grid
	if(!SUCCEEDED(spFormEditor->
		put_GridVisible(B2VB(m_GridVisible))))
	{
		throw std::exception();
	}
	// grid dimensions
	if(!SUCCEEDED(spFormEditor->put_GridWidth(m_GridWidth)))
	{
		throw std::exception();
	}
	if(!SUCCEEDED(spFormEditor->put_GridHeight(m_GridHeight)))
	{
		throw std::exception();
	}
	// reset the modified flag
	SetDirty(FALSE);
IMP_END
	return RetVal;
}

LRESULT CPropPageFormEditor::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	// wrap all dialog controls
	m_ctrlBorderVisible.Attach(GetDlgItem(IDC_BORDER));
	m_ctrlFormWidth.Attach(GetDlgItem(IDC_FORM_WIDTH));
	m_ctrlFormWidthSpin.Attach(GetDlgItem(IDC_FORM_WIDTH_SPIN));
	m_ctrlFormHeight.Attach(GetDlgItem(IDC_FORM_HEIGHT));
	m_ctrlFormHeightSpin.Attach(GetDlgItem(IDC_FORM_HEIGHT_SPIN));
	m_ctrlGridVisible.Attach(GetDlgItem(IDC_GRID));
	m_ctrlGridWidth.Attach(GetDlgItem(IDC_GRID_WIDTH));
	m_ctrlGridWidthSpin.Attach(GetDlgItem(IDC_GRID_WIDTH_SPIN));
	m_ctrlGridHeight.Attach(GetDlgItem(IDC_GRID_HEIGHT));
	m_ctrlGridHeightSpin.Attach(GetDlgItem(IDC_GRID_HEIGHT_SPIN));
	// todo : add error checking here if GetDlgItem() fails

	// check there is only a single associated object
	if(m_nObjects!=1)
	{
		// disable all controls
		(void)m_ctrlBorderVisible.EnableWindow(FALSE);
		(void)m_ctrlFormWidth.EnableWindow(FALSE);
		(void)m_ctrlFormWidthSpin.EnableWindow(FALSE);
		(void)m_ctrlFormHeight.EnableWindow(FALSE);
		(void)m_ctrlFormHeightSpin.EnableWindow(FALSE);
		(void)m_ctrlGridVisible.EnableWindow(FALSE);
		(void)m_ctrlGridWidth.EnableWindow(FALSE);
		(void)m_ctrlGridWidthSpin.EnableWindow(FALSE);
		(void)m_ctrlGridHeight.EnableWindow(FALSE);
		(void)m_ctrlGridHeightSpin.EnableWindow(FALSE);

		return 0;
	}
	// get the IFormEditor interface for the associated object
	if(m_ppUnk[0]==NULL)
	{
		return 0;
	}
	CComQIPtr<IFormEditor> spFormEditor(m_ppUnk[0]);
	if(spFormEditor==NULL)
	{
		return 0;
	}

	// get the property values
	// border
	VARIANT_BOOL vb=VARIANT_FALSE;
	(void)spFormEditor->get_BorderVisible(&vb);
	m_BorderVisible=VB2B(vb);
	// form dimensions
	(void)spFormEditor->get_FormWidth(&m_FormWidth);
	(void)spFormEditor->get_FormHeight(&m_FormHeight);
	// grid
	(void)spFormEditor->get_GridVisible(&vb);
	m_GridVisible=VB2B(vb);
	// grid dimensions
	(void)spFormEditor->get_GridWidth(&m_GridWidth);
	(void)spFormEditor->get_GridHeight(&m_GridHeight);

	// initialise the controls
	(void)DoDataExchange(FALSE);
	// set the form dimensions spin control range
	m_ctrlFormWidthSpin.SetRange(0,SHRT_MAX);
	m_ctrlFormHeightSpin.SetRange(0,SHRT_MAX);
	// set the grid dimensions spin control range
	m_ctrlGridWidthSpin.SetRange(0,SHRT_MAX);
	m_ctrlGridHeightSpin.SetRange(0,SHRT_MAX);
	// todo : set valid spin control ranges

	// reset the modified flag
	SetDirty(FALSE);
	return 0;
}

LRESULT CPropPageFormEditor::OnClickedBorder(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	// set the modified flag
	SetDirty(TRUE);
	return 0;
}

LRESULT CPropPageFormEditor::OnChangeFormWidth(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	// set the modified flag
	SetDirty(TRUE);
	return 0;
}

LRESULT CPropPageFormEditor::OnChangeFormHeight(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	// set the modified flag
	SetDirty(TRUE);
	return 0;
}

LRESULT CPropPageFormEditor::OnClickedGrid(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	// set the modified flag
	SetDirty(TRUE);
	return 0;
}

LRESULT CPropPageFormEditor::OnChangeGridWidth(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	// set the modified flag
	SetDirty(TRUE);
	return 0;
}

LRESULT CPropPageFormEditor::OnChangeGridHeight(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
	// set the modified flag
	SetDirty(TRUE);
	return 0;
}

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)

Share

About the Author

DaveShep
Web Developer
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.181207.3 | Last Updated 1 Aug 2009
Article Copyright 2005 by DaveShep
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid