home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Buyer 1998 October
/
dpcb1098.iso
/
Business
/
Maxim
/
MAX5
/
data.z
/
WizPages.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1998-05-15
|
35KB
|
1,143 lines
//////////////////////////////////////////////////////////////////////////////
// NAME.......: WizPages.CPP
// PURPOSE....: implementation of wizard pages
// WRITTEN....: 96/09/27 by Darko Juvan
// DESCRIPTION: implementation of 4 wizard property pages
//
// This code and information is provided "as is" without warranty of any
// kind, either expressed or implied, including but not limited to the
// implied warranties of merchantability and/or fitness for a particular
// purpose..
//
// Copyright (c) 1998 Multiactive Software Inc. All Rights Reserved.
//
//////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "WizPages.h"
#include "MaxInterface.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern IMaxApp* g_pApplication;
extern ICurrentRec* g_pCurrentRecord;
extern void SetAppResources();
extern void SetDllResources();
#define ID_TIME1 2001
#define ID_TIME2 2002
/////////////////////////////////////////////////////////////////////////////
// CPage1 property page
IMPLEMENT_DYNCREATE(CPage1, CWizPropertyPage)
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: CPage1()
//
// DESCRIPTION: constructor
//
//////////////////////////////////////////////////////////////////////////////
CPage1::CPage1() : CWizPropertyPage(CPage1::IDD)
{
//{{AFX_DATA_INIT(CPage1)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: CPage1()
//
// DESCRIPTION: constructor
//
//////////////////////////////////////////////////////////////////////////////
CPage1::CPage1(CWizPropertySheet* pWizSheet)
: CWizPropertyPage(pWizSheet, CPage1::IDD)
{
//pointer to CWizPropertySheet
m_pWizSheet = pWizSheet;
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: ~CPage1()
//
// DESCRIPTION: destructor
//
//////////////////////////////////////////////////////////////////////////////
CPage1::~CPage1()
{
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: DoDataExchange()
//
// DESCRIPTION: MFC
//
//////////////////////////////////////////////////////////////////////////////
void CPage1::DoDataExchange(CDataExchange* pDX)
{
CWizPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPage1)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPage1, CWizPropertyPage)
//{{AFX_MSG_MAP(CPage1)
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////
// CPage1 message handlers
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnInitDialog()
//
// DESCRIPTION: MFC
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage1::OnInitDialog()
{
CWizPropertyPage::OnInitDialog();
CString company;
CString first;
CString last;
CString str;
CString str2;
BOOL bPersonal = FALSE;
BOOL bCompany = FALSE;
BOOL bNoCurRecord = FALSE;
//set app resources cause we are calling
//Maximizer function and resource pointer
//should point to application resoures
SetAppResources();
//check if you can get First Name
first = g_pCurrentRecord->GetFieldValue("First_Name");
if( first == "Error0")
bNoCurRecord = TRUE;
if(!bNoCurRecord)
{
//check for Last Name
last = g_pCurrentRecord->GetFieldValue("Last_Name");
//if First and Last are empty it's Company record
if(first.IsEmpty() && last.IsEmpty())
{
bCompany = TRUE;
company = g_pCurrentRecord->GetFieldValue("Company");
if(company.IsEmpty())
//and if Company Name is empty there's no current record
bNoCurRecord = TRUE;
}
}
//return to dll resources
SetDllResources();
//"...personal appointment."
m_text1.LoadString(S13);
if(bNoCurRecord)
{
//there's no current record
m_pWizSheet->m_personal = 0;
//set summary text
m_pWizSheet->m_text1 = m_text1;
//change text of 2nd btn -> "No current record in Address Book"
str.LoadString(S1111);
GetDlgItem(IDC_RADIO2)->SetWindowText(str);
//disable 2 btn (no current record)
((CButton*)GetDlgItem(IDC_RADIO2))->EnableWindow(FALSE);
//set default (1) radio btn (personal appointment)
((CButton*)GetDlgItem(IDC_RADIO1))->SetCheck(1);
}
else
{
//set default (2) radio btn
((CButton*)GetDlgItem(IDC_RADIO2))->SetCheck(1);
//"...with"
str.LoadString(S12);
//format text for summary text
if(bCompany)
m_text2.Format("%s %s.", str, company);
else
m_text2.Format("%s %s %s.", str, first, last);
m_pWizSheet->m_text1 = m_text2;
m_pWizSheet->m_personal = 1;
//format text for radio btn 2
str.LoadString(S15);
if(bCompany)
str2.Format("%s %s.", str, company);
else
str2.Format("%s %s %s", str, first, last);
//change text for radio btn 2
GetDlgItem(IDC_RADIO2)->SetWindowText(str2);
}
//set text for summary line 1
GetDlgItem(IDC_STATIC_1)->SetWindowText(m_pWizSheet->m_text1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnRadio1()
//
// DESCRIPTION: radio button was clicked
//
//////////////////////////////////////////////////////////////////////////////
void CPage1::OnRadio1()
{
//change summary text
SetDlgItemText(IDC_STATIC_1, m_text1);
m_pWizSheet->m_text1 = m_text1;
m_pWizSheet->m_personal = 0;
//enable NEXT button
m_pWizSheet->GetDlgItem(ID_WIZNEXT)->EnableWindow(TRUE);
//erase warning (on radio btn 3)
SetDlgItemText(IDC_STATIC_ERROR, "");
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnRadio2()
//
// DESCRIPTION: radio button was clicked
//
//////////////////////////////////////////////////////////////////////////////
void CPage1::OnRadio2()
{
//change summary text
GetDlgItem(IDC_STATIC_1)->SetWindowText(m_text2);
m_pWizSheet->m_text1 = m_text2;
m_pWizSheet->m_personal = 1;
//enable NEXT button
m_pWizSheet->GetDlgItem(ID_WIZNEXT)->EnableWindow(TRUE);
//erase warning (on radio btn 3)
SetDlgItemText(IDC_STATIC_ERROR, "");
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnRadio3()
//
// DESCRIPTION: radio button was clicked
//
//////////////////////////////////////////////////////////////////////////////
void CPage1::OnRadio3()
{
CString str;
//issue warning
str.LoadString(S14);
GetDlgItem(IDC_STATIC_ERROR)->SetWindowText(str);
GetDlgItem(IDC_STATIC_1)->SetWindowText("");
//disable NEXT button
m_pWizSheet->GetDlgItem(ID_WIZNEXT)->EnableWindow(FALSE);
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnSetActive()
//
// DESCRIPTION: MFC - page is getting active
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage1::OnSetActive()
{
m_pWizSheet->GetDlgItem(ID_WIZBACK)->EnableWindow(FALSE);
m_pWizSheet->GetDlgItem(IDHELP)->EnableWindow(FALSE);
m_pWizSheet->GetDlgItem(IDHELP)->ShowWindow(SW_HIDE);
return CWizPropertyPage::OnSetActive();
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnKillActive()
//
// DESCRIPTION: MFC - page is losing active state
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage1::OnKillActive()
{
m_pWizSheet->GetDlgItem(ID_WIZBACK)->EnableWindow(TRUE);
return CWizPropertyPage::OnKillActive();
}
/////////////////////////////////////////////////////////////////////////////
// CPage2 property page
IMPLEMENT_DYNCREATE(CPage2, CWizPropertyPage)
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: CPage2()
//
// DESCRIPTION: constructor
//
//////////////////////////////////////////////////////////////////////////////
CPage2::CPage2() : CWizPropertyPage(CPage2::IDD)
{
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: CPage2()
//
// DESCRIPTION: constructor
//
//////////////////////////////////////////////////////////////////////////////
CPage2::CPage2(CWizPropertySheet* pWizSheet)
: CWizPropertyPage(pWizSheet, CPage2::IDD)
{
//pointer to CWizPropertySheet
m_pWizSheet = pWizSheet;
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: ~CPage2()
//
// DESCRIPTION: destructor
//
//////////////////////////////////////////////////////////////////////////////
CPage2::~CPage2()
{
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: DoDataExchange()
//
// DESCRIPTION: MFC
//
//////////////////////////////////////////////////////////////////////////////
void CPage2::DoDataExchange(CDataExchange* pDX)
{
CWizPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPage2)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPage2, CWizPropertyPage)
//{{AFX_MSG_MAP(CPage2)
ON_MESSAGE( UM_DATE_CHANGED, OnDateChanged )
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////
// CPage2 message handlers
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnInitDialog()
//
// DESCRIPTION: MFC
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage2::OnInitDialog()
{
CWizPropertyPage::OnInitDialog();
CString str;
//create Calendar ctrl
m_calendar.Create(this, IDC_DATE_DAY, IDC_DATE_MONTH, IDC_DATE_SPIN, m_iYear, m_iMonth, m_iDay);
//initialize common ctrls
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
iccex.dwICC = ICC_DATE_CLASSES;
BOOL b = InitCommonControlsEx(&iccex);
//create two time ctrls for start and end time
m_time1.Create(FALSE, this, IDC_TIMEX1, ID_TIME1);
m_time2.Create(FALSE, this, IDC_TIMEX2, ID_TIME2);
m_time1.SetTime(9,30,0);
m_time2.SetTime(9,30,0);
//update summary info
OnTimeChanged();
//update summary info
OnDateChanged(0,0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnSetActive()
//
// DESCRIPTION: MFC - page is getting active
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage2::OnSetActive()
{
GetDlgItem(IDC_STATIC_1)->SetWindowText(m_pWizSheet->m_text1);
return CWizPropertyPage::OnSetActive();
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: PreTranslateMessage()
//
// DESCRIPTION: MFC - forward msg to calendar ctrl
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage2::PreTranslateMessage(MSG* pMsg)
{
m_calendar.ForwardMsg(pMsg);
return CWizPropertyPage::PreTranslateMessage(pMsg);
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnDateChanged()
//
// DESCRIPTION: notification from calendar ctrl
//
//////////////////////////////////////////////////////////////////////////////
LONG CPage2::OnDateChanged(UINT wParam, LONG lParam)
{
m_calendar.RefreshDate();
//set a proper month
CString sMonth;
switch(m_calendar.m_iMonth)
{
case 1:
sMonth.LoadString(SM1);
break;
case 2:
sMonth.LoadString(SM2);
break;
case 3:
sMonth.LoadString(SM3);
break;
case 4:
sMonth.LoadString(SM4);
break;
case 5:
sMonth.LoadString(SM5);
break;
case 6:
sMonth.LoadString(SM6);
break;
case 7:
sMonth.LoadString(SM7);
break;
case 8:
sMonth.LoadString(SM8);
break;
case 9:
sMonth.LoadString(SM9);
break;
case 10:
sMonth.LoadString(SM10);
break;
case 11:
sMonth.LoadString(SM11);
break;
case 12:
sMonth.LoadString(SM12);
}
//date has changed - update
CString str;
str.Format("%s %d, %d", sMonth, m_calendar.m_iDay, m_calendar.m_iYear);
CString str2;
str2.LoadString(S21);
m_pWizSheet->m_text2.Format("%s %s.", str2, str);
m_pWizSheet->m_date = str;
SetDlgItemText(IDC_STATIC_2, m_pWizSheet->m_text2);
return 1L;
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnNotify()
//
// DESCRIPTION: Time ctrl notify
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage2::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR* pNmhdr;
NMDATETIMECHANGE* pnm = (NMDATETIMECHANGE*)lParam;
pNmhdr = (NMHDR*)lParam;
if(pNmhdr->code == DTN_DATETIMECHANGE)
if(pNmhdr->idFrom == ID_TIME1 || pNmhdr->idFrom == ID_TIME2)
//time has changed - update
OnTimeChanged();
return CWizPropertyPage::OnNotify(wParam, lParam, pResult);
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnTimeChanged()
//
// DESCRIPTION: notification from time ctrl
//
//////////////////////////////////////////////////////////////////////////////
void CPage2::OnTimeChanged()
{
//time has changed - update
CString sTime1 = m_time1.GetTime(&m_Time1);
CString sTime2 = m_time2.GetTime(&m_Time2);
m_pWizSheet->m_time1 = sTime1;
m_pWizSheet->m_time2 = sTime2;
AfxFormatString2(m_pWizSheet->m_text3, S22, m_pWizSheet->m_time1, m_pWizSheet->m_time2);
SetDlgItemText(IDC_STATIC_3, m_pWizSheet->m_text3);
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnWizardNext()
//
// DESCRIPTION: MFC - next button is pressed
//
//////////////////////////////////////////////////////////////////////////////
LRESULT CPage2::OnWizardNext()
{
//issue warning if m_Time1 > m_Time2
if(m_Time1 > m_Time2)
{
CString str;
str.LoadString(S1112);
if(AfxMessageBox(str, MB_YESNO) == IDYES)
{
m_pWizSheet->m_time2 = m_pWizSheet->m_time1;
AfxFormatString2(m_pWizSheet->m_text3, S22, m_pWizSheet->m_time1, m_pWizSheet->m_time2);
SetDlgItemText(IDC_STATIC_3, m_pWizSheet->m_text3);
m_Time2 = m_Time1;
m_time2.SetTime(m_Time1.GetHour(), m_Time1.GetMinute(), m_Time1.GetSecond());
return CWizPropertyPage::OnWizardNext();
}
else
return (-1);
}
return CWizPropertyPage::OnWizardNext();
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnKillActive()
//
// DESCRIPTION: MFC - page is losing active state
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage2::OnKillActive()
{
return CWizPropertyPage::OnKillActive();
}
/////////////////////////////////////////////////////////////////////////////
// CPage3 property page
IMPLEMENT_DYNCREATE(CPage3, CWizPropertyPage)
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: CPage3()
//
// DESCRIPTION: constructor
//
//////////////////////////////////////////////////////////////////////////////
CPage3::CPage3() : CWizPropertyPage(CPage3::IDD)
{
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: CPage3()
//
// DESCRIPTION: constructor
//
//////////////////////////////////////////////////////////////////////////////
CPage3::CPage3(CWizPropertySheet* pWizSheet)
: CWizPropertyPage(pWizSheet, CPage3::IDD)
{
//pointer to CWizPropertySheet
m_pWizSheet = pWizSheet;
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: ~CPage3()
//
// DESCRIPTION: destructor
//
//////////////////////////////////////////////////////////////////////////////
CPage3::~CPage3()
{
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: DoDataExchange()
//
// DESCRIPTION: MFC
//
//////////////////////////////////////////////////////////////////////////////
void CPage3::DoDataExchange(CDataExchange* pDX)
{
CWizPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPage3)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPage3, CWizPropertyPage)
//{{AFX_MSG_MAP(CPage3)
ON_CBN_SELCHANGE(IDC_COMBO_ACTIVITY, OnSelchangeComboActivity)
ON_CBN_SELCHANGE(IDC_COMBO_PRIORITY, OnSelchangeComboPriority)
ON_CBN_EDITCHANGE(IDC_COMBO_ALARM, OnEditchangeComboAlarm)
ON_CBN_SELCHANGE(IDC_COMBO_ALARM, OnSelchangeComboAlarm)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_EN_UPDATE(IDC_EDIT_ACTIVITY, OnUpdateEditActivity)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////
// CPage3 message handlers
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnInitDialog()
//
// DESCRIPTION: MFC
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage3::OnInitDialog()
{
CWizPropertyPage::OnInitDialog();
//set default alarm btns
((CButton*)GetDlgItem(IDC_RADIO2))->SetCheck(1);
((CComboBox*)GetDlgItem(IDC_COMBO_ALARM))->LimitText(3);
((CComboBox*)GetDlgItem(IDC_COMBO_ALARM))->SetCurSel(2);
OnRadio2();
//set default priority
((CComboBox*)GetDlgItem(IDC_COMBO_PRIORITY))->SetCurSel(0);
//subclass owner drawn combo - activity type combo
m_combo.SubclassDlgItem (IDC_COMBO_ACTIVITY, this);
CString str;
str.LoadString(S391);
m_combo.AddItem(str, IDB_MEETING);
str.LoadString(S392);
m_combo.AddItem(str, IDB_PHONE);
str.LoadString(S393);
m_combo.AddItem(str, IDB_TODO);
str.LoadString(S394);
m_combo.AddItem(str, IDB_MEAL);
str.LoadString(S395);
m_combo.AddItem(str, IDB_TRAVEL);
str.LoadString(S396);
m_combo.AddItem(str, IDB_SALE);
str.LoadString(S397);
m_combo.AddItem(str, IDB_MAIL);
str.LoadString(S398);
m_combo.AddItem(str, IDB_SPEECH);
str.LoadString(S399);
m_combo.AddItem(str, IDB_PRESENTATION);
//set default to meeting
m_combo.SetCurSel(0);
//update
OnSelchangeComboActivity();
OnSelchangeComboPriority() ;
GetDlgItem(IDC_EDIT_ACTIVITY)->SetFocus();
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnRadio1()
//
// DESCRIPTION: click on alarm radio button (Yes)
//
//////////////////////////////////////////////////////////////////////////////
void CPage3::OnRadio1()
{
if(((CButton*)GetDlgItem(IDC_RADIO1))->GetCheck())
{
CString str;
GetDlgItem(IDC_COMBO_ALARM)->EnableWindow(TRUE);
GetDlgItem(IDC_STATIC1)->EnableWindow(TRUE);
GetDlgItem(IDC_STATIC2)->EnableWindow(TRUE);
m_pWizSheet->m_alarm = 1;
GetDlgItem(IDC_COMBO_ALARM)->GetWindowText(str);
SetComboAlarm(str);
}
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnRadio2()
//
// DESCRIPTION: click on alarm radio button (No)
//
//////////////////////////////////////////////////////////////////////////////
void CPage3::OnRadio2()
{
if(((CButton*)GetDlgItem(IDC_RADIO2))->GetCheck())
{
GetDlgItem(IDC_COMBO_ALARM)->EnableWindow(FALSE);
GetDlgItem(IDC_STATIC1)->EnableWindow(FALSE);
GetDlgItem(IDC_STATIC2)->EnableWindow(FALSE);
m_pWizSheet->m_alarm = 0;
m_pWizSheet->m_text5.LoadString(S311);
SetDlgItemText(IDC_STATIC_5, m_pWizSheet->m_text5);
}
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: GetActivity()
//
// DESCRIPTION: get activity text and bmp
//
//////////////////////////////////////////////////////////////////////////////
LPCTSTR CPage3::GetActivity(int sel)
{
CString str;
switch(sel)
{
case 0: str.LoadString(S391);
m_pWizSheet->m_iconType = 9;
m_pWizSheet->m_text = str;
break;
case 1: str.LoadString(S392);
m_pWizSheet->m_iconType = 3;
m_pWizSheet->m_text = str;
break;
case 2: str.LoadString(S393);
m_pWizSheet->m_iconType = 2;
m_pWizSheet->m_text = str;
break;
case 3: str.LoadString(S394);
m_pWizSheet->m_iconType = 6;
m_pWizSheet->m_text = str;
break;
case 4: str.LoadString(S395);
m_pWizSheet->m_iconType = 4;
m_pWizSheet->m_text = str;
break;
case 5: str.LoadString(S396);
m_pWizSheet->m_iconType = 5;
m_pWizSheet->m_text = str;
break;
case 6: str.LoadString(S397);
m_pWizSheet->m_iconType = 1;
m_pWizSheet->m_text = str;
break;
case 7: str.LoadString(S398);
m_pWizSheet->m_iconType = 8;
m_pWizSheet->m_text = str;
break;
case 8: str.LoadString(S399);
m_pWizSheet->m_iconType = 7;
m_pWizSheet->m_text = str;
break;
}
return str;
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnSelchangeComboActivity()
//
// DESCRIPTION: selection was changed in activity combo box
//
//////////////////////////////////////////////////////////////////////////////
void CPage3::OnSelchangeComboActivity()
{
m_pWizSheet->m_text = GetActivity(m_combo.GetCurSel());
AfxFormatString1(m_pWizSheet->m_text4, S39, m_pWizSheet->m_text);
GetDlgItem(IDC_STATIC_4)->SetWindowText(m_pWizSheet->m_text4);
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnEditchangeComboAlarm()
//
// DESCRIPTION: text was changed in alarm combo box
//
//////////////////////////////////////////////////////////////////////////////
void CPage3::OnEditchangeComboAlarm()
{
if(((CButton*)GetDlgItem(IDC_RADIO2))->GetCheck())
return;
CString str;
GetDlgItem(IDC_COMBO_ALARM)->GetWindowText(str);
SetComboAlarm(str);
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnSelchangeComboAlarm()
//
// DESCRIPTION: selection was changed in alarm combo box
//
//////////////////////////////////////////////////////////////////////////////
void CPage3::OnSelchangeComboAlarm()
{
if(((CButton*)GetDlgItem(IDC_RADIO2))->GetCheck())
return;
CString str;
int sel = ((CComboBox*)GetDlgItem(IDC_COMBO_ALARM))->GetCurSel();
switch(sel)
{
case 0: str = "0"; break;
case 1: str = "5"; break;
case 2: str = "10"; break;
case 3: str = "15"; break;
case 4: str = "20"; break;
case 5: str = "30"; break;
case 6: str = "45"; break;
case 7: str = "60"; break;
case 8: str = "90"; break;
case 9: str = "120"; break;
}
SetComboAlarm(str);
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: SetComboAlarm()
//
// DESCRIPTION: set text in alarm combo box
//
//////////////////////////////////////////////////////////////////////////////
void CPage3::SetComboAlarm(CString str)
{
if(((CButton*)GetDlgItem(IDC_RADIO2))->GetCheck())
return;
m_pWizSheet->m_alarm_time = atoi(str);
AfxFormatString1(m_pWizSheet->m_text5, S37, str);
SetDlgItemText(IDC_STATIC_5, m_pWizSheet->m_text5);
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnSelchangeComboPriority()
//
// DESCRIPTION: selection was changed in priority combo box
//
//////////////////////////////////////////////////////////////////////////////
void CPage3::OnSelchangeComboPriority()
{
int sel = ((CComboBox*)GetDlgItem(IDC_COMBO_PRIORITY))->GetCurSel();
switch(sel)
{
case 0: m_pWizSheet->m_priority = ""; break;
case 1: m_pWizSheet->m_priority = "A"; break;
case 2: m_pWizSheet->m_priority = "B"; break;
case 3: m_pWizSheet->m_priority = "C"; break;
}
if(sel)
AfxFormatString1(m_pWizSheet->m_text6, S38, m_pWizSheet->m_priority);
else
m_pWizSheet->m_text6.LoadString(S312);
SetDlgItemText(IDC_STATIC_6, m_pWizSheet->m_text6);
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnSetActive()
//
// DESCRIPTION: MFC - page is getting active
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage3::OnSetActive()
{
GetDlgItem(IDC_STATIC_1)->SetWindowText(m_pWizSheet->m_text1);
GetDlgItem(IDC_STATIC_2)->SetWindowText(m_pWizSheet->m_text2);
GetDlgItem(IDC_STATIC_3)->SetWindowText(m_pWizSheet->m_text3);
GetDlgItem(IDC_STATIC_4)->SetWindowText(m_pWizSheet->m_text4);
GetDlgItem(IDC_STATIC_5)->SetWindowText(m_pWizSheet->m_text5);
GetDlgItem(IDC_STATIC_6)->SetWindowText(m_pWizSheet->m_text6);
return CWizPropertyPage::OnSetActive();
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnUpdateEditActivity()
//
// DESCRIPTION: check if activity text exceed length limit
//
//////////////////////////////////////////////////////////////////////////////
void CPage3::OnUpdateEditActivity()
{
CString str;
GetDlgItem(IDC_EDIT_ACTIVITY)->GetWindowText(str);
int len = str.GetLength();
if(len > 100)
{
AfxMessageBox(S3112);
str.SetAt(100, '\0');
GetDlgItem(IDC_EDIT_ACTIVITY)->SetFocus();
GetDlgItem(IDC_EDIT_ACTIVITY)->SetWindowText(str);
}
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnKillActive()
//
// DESCRIPTION: MFC - page is losing active state
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage3::OnKillActive()
{
//set text to text of activity type
m_pWizSheet->m_text = GetActivity(m_combo.GetCurSel());
//get user text
CString str;
GetDlgItem(IDC_EDIT_ACTIVITY)->GetWindowText(str);
int pos;
//remove all ',' from description
//(',' not allowed, cause is used as delimiter char)
while((pos = str.Find(',')) > 0)
{
str.SetAt(pos, ' ');
}
//add user entered text to description
if(!m_pWizSheet->m_text.IsEmpty() && !str.IsEmpty())
m_pWizSheet->m_text += " - ";
m_pWizSheet->m_text += str;
return CWizPropertyPage::OnKillActive();
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnWizardNext()
//
// DESCRIPTION: MFC
//
//////////////////////////////////////////////////////////////////////////////
LRESULT CPage3::OnWizardNext()
{
//warn if negative alarm time
if(m_pWizSheet->m_alarm_time < 0)
{
CString sMsg;
sMsg.LoadString(S341);
AfxMessageBox(sMsg);
return -1;
}
return IDD_PAGE4;
}
/////////////////////////////////////////////////////////////////////////////
// CPage4 property page
IMPLEMENT_DYNCREATE(CPage4, CWizPropertyPage)
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: CPage4()
//
// DESCRIPTION: constructor
//
//////////////////////////////////////////////////////////////////////////////
CPage4::CPage4() : CWizPropertyPage(CPage4::IDD)
{
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: CPage4()
//
// DESCRIPTION: constructor
//
//////////////////////////////////////////////////////////////////////////////
CPage4::CPage4(CWizPropertySheet* pWizSheet)
: CWizPropertyPage(pWizSheet, CPage4::IDD)
{
//pointer to CWizPropertySheet
m_pWizSheet = pWizSheet;
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: ~CPage4()
//
// DESCRIPTION: destructor
//
//////////////////////////////////////////////////////////////////////////////
CPage4::~CPage4()
{
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: DoDataExchange()
//
// DESCRIPTION: MFC
//
//////////////////////////////////////////////////////////////////////////////
void CPage4::DoDataExchange(CDataExchange* pDX)
{
CWizPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPage4)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPage4, CWizPropertyPage)
//{{AFX_MSG_MAP(CPage4)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////
// CPage4 message handlers
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnSetActive()
//
// DESCRIPTION: MFC - page is getting active
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage4::OnSetActive()
{
m_pWizSheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH);
//update summary text
GetDlgItem(IDC_STATIC_1)->SetWindowText(m_pWizSheet->m_text1);
GetDlgItem(IDC_STATIC_2)->SetWindowText(m_pWizSheet->m_text2);
GetDlgItem(IDC_STATIC_3)->SetWindowText(m_pWizSheet->m_text3);
GetDlgItem(IDC_STATIC_4)->SetWindowText(m_pWizSheet->m_text4);
GetDlgItem(IDC_STATIC_5)->SetWindowText(m_pWizSheet->m_text5);
GetDlgItem(IDC_STATIC_6)->SetWindowText(m_pWizSheet->m_text6);
return CWizPropertyPage::OnSetActive();
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnWizardBack()
//
// DESCRIPTION: MFC - back button is pressed
//
//////////////////////////////////////////////////////////////////////////////
LRESULT CPage4::OnWizardBack()
{
m_pWizSheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
return CWizPropertyPage::OnWizardBack();
}
//////////////////////////////////////////////////////////////////////////////
//
// FUNCTION...: OnInitDialog()
//
// DESCRIPTION: MFC
//
//////////////////////////////////////////////////////////////////////////////
BOOL CPage4::OnInitDialog()
{
CWizPropertyPage::OnInitDialog();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}