|
// PropPageFormViewer.cpp : Implementation of CPropPageFormViewer
//
// Author : David Shepherd
// Copyright (c) 2002, DaeDoe-Software
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "DDForms.h"
#include "PropPageFormViewer.h"
/////////////////////////////////////////////////////////////////////////////
// CPropPageFormViewer
CPropPageFormViewer::CPropPageFormViewer()
{
// initialise everything
m_dwTitleID=IDS_TITLEPropPageFormViewer;
m_dwHelpFileID=IDS_HELPFILEPropPageFormViewer;
m_dwDocStringID=IDS_DOCSTRINGPropPageFormViewer;
m_BorderVisible=FALSE;
}
STDMETHODIMP CPropPageFormViewer::Apply()
{
IMP_BEGIN
// check there is only a single associated object
if(m_nObjects!=1)
{
throw std::exception();
}
// get the IFormViewer interface for the associated object
if(m_ppUnk[0]==NULL)
{
throw std::exception();
}
CComQIPtr<IFormViewer> spFormViewer(m_ppUnk[0]);
if(spFormViewer==NULL)
{
throw std::exception();
}
// set the property values
(void)DoDataExchange(TRUE);
// border
if(!SUCCEEDED(spFormViewer->
put_BorderVisible(B2VB(m_BorderVisible))))
{
throw std::exception();
}
// reset the modified flag
SetDirty(FALSE);
IMP_END
return RetVal;
}
LRESULT CPropPageFormViewer::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
// wrap all dialog controls
m_ctrlBorderVisible.Attach(GetDlgItem(IDC_BORDER));
// 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);
return 0;
}
// get the IFormViewer interface for the associated object
if(m_ppUnk[0]==NULL)
{
return 0;
}
CComQIPtr<IFormViewer> spFormViewer(m_ppUnk[0]);
if(spFormViewer==NULL)
{
return 0;
}
// get the property values
// border
VARIANT_BOOL vb=VARIANT_FALSE;
(void)spFormViewer->get_BorderVisible(&vb);
m_BorderVisible=VB2B(vb);
// initialise the controls
(void)DoDataExchange(FALSE);
// reset the modified flag
SetDirty(FALSE);
return 0;
}
LRESULT CPropPageFormViewer::OnClickedBorder(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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.