home *** CD-ROM | disk | FTP | other *** search
- // vcview.cpp : implementation of the CVcView class
- //
-
- #include "stdafx.h"
- #include "vc.h"
-
- #include "vcdoc.h"
- #include "vcview.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcView
-
- IMPLEMENT_DYNCREATE(CVcView, CFormView)
-
- BEGIN_MESSAGE_MAP(CVcView, CFormView)
- //{{AFX_MSG_MAP(CVcView)
- ON_EN_CHANGE(IDC_EDIT1, OnChangeEditP)
- ON_EN_CHANGE(IDC_EDIT2, OnChangeEditV)
- ON_VBXEVENT(VBN_CHANGE, IDC_PRCNT1, OnChangePrcnt1)
- ON_VBXEVENT(VBN_CHANGE, IDC_PRCNT2, OnChangePrcnt2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcView construction/destruction
-
- CVcView::CVcView()
- : CFormView(CVcView::IDD)
- {
- //{{AFX_DATA_INIT(CVcView)
- m_percent2 = NULL;
- m_percent1 = NULL;
- //}}AFX_DATA_INIT
- // TODO: add construction code here
- }
-
- CVcView::~CVcView()
- {
- }
-
- void CVcView::DoDataExchange(CDataExchange* pDX)
- {
- float value;
- char str[15];
-
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CVcView)
- DDX_Control(pDX, IDC_EDIT2, m_editv);
- DDX_Control(pDX, IDC_EDIT1, m_editp);
- DDX_VBControl(pDX, IDC_PRCNT2, m_percent2);
- DDX_VBControl(pDX, IDC_PRCNT1, m_percent1);
- //}}AFX_DATA_MAP
-
- value=m_percent1->GetFloatProperty("Percent");
- sprintf(str,"%g",value);
- m_editp.SetWindowText(str);
-
- value=m_percent2->GetFloatProperty("Value");
- sprintf(str,"%g",value);
- m_editv.SetWindowText(str);
-
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcView diagnostics
-
- #ifdef _DEBUG
- void CVcView::AssertValid() const
- {
- CFormView::AssertValid();
- }
-
- void CVcView::Dump(CDumpContext& dc) const
- {
- CFormView::Dump(dc);
- }
-
- CVcDoc* CVcView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVcDoc)));
- return (CVcDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CVcView message handlers
-
- void CVcView::OnChangeEditP()
- {
- float value;
- CString cstr;
-
- m_editp.GetWindowText(cstr);
- value = float(atof(cstr));
- m_percent1->SetFloatProperty("Percent",value);
-
- }
-
- void CVcView::OnChangeEditV()
- {
- float value;
- CString cstr;
-
- m_editv.GetWindowText(cstr);
- value = float(atof(cstr));
- m_percent2->SetFloatProperty("Value",value);
-
- }
-
- void CVcView::OnChangePrcnt1(UINT, int, CWnd*, LPVOID)
- {
- float value;
- char str[15];
-
- value=m_percent1->GetFloatProperty("Percent");
- sprintf(str,"%g",value);
- m_editp.SetWindowText(str);
-
- }
-
- void CVcView::OnChangePrcnt2(UINT, int, CWnd*, LPVOID)
- {
- float value;
- char str[15];
-
- value=m_percent2->GetFloatProperty("Value");
- sprintf(str,"%g",value);
- m_editv.SetWindowText(str);
-
- }
-