Click here to Skip to main content
Licence CPOL
First Posted 30 May 2001
Views 81,485
Downloads 1,487
Bookmarked 38 times

Date Time Picker control for the MFC Grid Control

By | 30 May 2001 | Article
A DateTime control for editing date or time values inplace in the MFC Grid Control

Sample Image - GridCellDateTime.gif

Introduction

This is a simple drop-in cell class for Chris Maunder's MFC Grid Control. The cell's class is CGridCellDateTime and is used in exactly the same way as other grid cell types.

The edit window that is created when the cell goes into edit mode is of type CDateTimeCtrl (so you need at least IE3 installed on your system for it to run)

Possible usage

MyDialog::OnInitDialog()
{
    ...  
    m_Grid.SetRowCount(44);
    m_Grid.SetColumnCount(22);
    m_Grid.SetFixedRowCount();

    for (int i =1; i <44; i++) 
    {
       m_Grid.SetCellType(i, 0, RUNTIME_CLASS(CGridCellDateTime));
       ((CGridCellDateTime*) m_Grid.GetCell(i, 0))->Init(DTS_SHORTDATEFORMAT);

       m_Grid.SetCellType(i, 1, RUNTIME_CLASS(CGridCellDateTime));
       ((CGridCellDateTime*) m_Grid.GetCell(i, 1))->Init(DTS_TIMEFORMAT);
    }
    ...
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Eugen Podsypalnikov

Software Developer
COPA-DATA GmbH
Austria Austria

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralTab issue while editing PinmemberMember 7277110:31 14 May '09  
QuestionCan DATE TIME picker have NULL value Pinmemberanitaj20:07 18 Jun '08  
GeneralMinor Things PinmemberAndrew Phillips19:23 7 Mar '04  
QuestionCalender ? PinmemberElco20:48 27 Jan '04  
GeneralBig Time Setting Bug Pinmemberjaneyre21:50 14 Jan '03  
GeneralSmall Enhancement to GridCellDateTime PinmemberJason Slocomb10:49 21 Dec '01  
GeneralRe: Small Enhancement to GridCellDateTime Pinmembersep8:54 21 Jul '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 31 May 2001
Article Copyright 2001 by Eugen Podsypalnikov
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid