Click here to Skip to main content
11,412,302 members (64,375 online)
Click here to Skip to main content
Add your own
alternative version

A reminder tool for .dan.g's ToDoList

, 25 Feb 2004
A simple reminder tool to remind you of your overdue tasks in ToDoList throughout the day
tdlremindertool_demo.zip
zlib.dll
iconv.dll
libxml2.dll
TDLReminderTool.exe
Reminder.wav
tdlremindertool_src.zip
Projects
TDLReminderTool
TDLReminderTool.dsw
TDLReminderTool.clw
TDLReminderTool.dsp
res
TDLReminderTool.ico
Reminder.wav
// ToDoListRemDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TDLReminderTool.h"
#include "ToDoListRemDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CToDoListRemDlg dialog


CToDoListRemDlg::CToDoListRemDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CToDoListRemDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CToDoListRemDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}
CToDoListRemDlg::~CToDoListRemDlg()
{
	m_Tasks.clear();
}

void CToDoListRemDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CToDoListRemDlg)
	DDX_Control(pDX, IDC_REMINDERLIST, m_RemList);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CToDoListRemDlg, CDialog)
	//{{AFX_MSG_MAP(CToDoListRemDlg)
	ON_WM_DESTROY()
	ON_NOTIFY(HDN_ITEMCLICK, 0, OnItemclickReminderlist)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CToDoListRemDlg message handlers



void CToDoListRemDlg::OnOK() 
{
	// TODO: Add extra validation here
	
	CDialog::OnOK();
}

BOOL CToDoListRemDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();


	m_RemList.InsertColumn(0,"Due Date",LVCFMT_LEFT,100);
	m_RemList.InsertColumn(1,"Task Title",LVCFMT_LEFT,340);
	
	m_RemList.ClearItemData();
	m_RemList.DeleteAllItems();

	for(int j=0; j<m_Tasks.size();++j)
	{
		m_RemList.InsertItem(j,m_Tasks[j].getDueDateString().c_str());
		m_RemList.SetItemText(j,1,m_Tasks[j].getTitle().c_str());

		ITEMDATA* pData = new ITEMDATA;
		  
		pData->pszDueDate = (LPTSTR)(LPCTSTR)m_Tasks[j].getDueDateString().c_str();
		
		pData->pszTaskTitle =  (LPTSTR)(LPCTSTR)m_Tasks[j].getTitle().c_str();

		m_RemList.SetItemData(j,(LPARAM)pData);
		m_RemList.addItemData(pData);
	}


	SetWindowText(m_Caption);
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


void CToDoListRemDlg::addRemItems(vector<CTask> tasks)
{
	m_Tasks.clear();

	m_Tasks = tasks;
}

void CToDoListRemDlg::OnDestroy() 
{
	
	CDialog::OnDestroy();
}

void CToDoListRemDlg::InitDlg(CString caption)
{
	m_Caption = caption;
}

int CToDoListRemDlg::DoModal() 
{
	if(m_Tasks.empty())
		return IDCANCEL;
	
	return CDialog::DoModal();
}

void CToDoListRemDlg::OnItemclickReminderlist(NMHDR* pNMHDR, LRESULT* pResult) 
{
	HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
	m_RemList.SortItems(SortAscFunc,phdn->iItem);
	
	m_RemList.UpdateWindow();
	*pResult = 0;
}

BOOL CToDoListRemDlg::HasTasks()
{
	if(m_Tasks.empty())
		return FALSE;

	return TRUE;
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Alberto Bar-Noy
Team Leader www.unitronics.com
Israel Israel
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150414.5 | Last Updated 26 Feb 2004
Article Copyright 2004 by Alberto Bar-Noy
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid