Print Page | Close Window

On clicking DatePicker control return wrong date.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=12634
Printed Date: 16 June 2025 at 5:00am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: On clicking DatePicker control return wrong date.
Posted By: prashant
Subject: On clicking DatePicker control return wrong date.
Date Posted: 07 November 2008 at 6:21am
I have class:
class CmcDatePickerControl : public CXTPDatePickerControl


I am trapping message
void CmcDatePickerControl::OnLButtonDown(UINT nFlags, CPoint point)

Code is as follows:

CXTPDatePickerDaysCollection* pDaysCollection = NULL;

pDaysCollection = this->GetSelectedDays();

COleDateTime cDate;
struct CXTPDatePickerDaysCollection::SELECTED_BLOCK blk;

blk = pDaysCollection->GetSelectedBlock(0);
cDate.m_dt = (long)blk.nDateBegin;

 //DatetoStruct(, &ds);
 int nDay = cDate.GetDay();
 int nMonth = cDate.GetMonth();
int nYear = cDate.GetYear();

It's not returning me "Currently selected date" instead it's returning me "Previous selection date".

Same code works fine on:
void CmcDatePickerControl::OnLButtonDblClk(UINT nFlags, CPoint point)
returning correct date.

What am I doing wrong here?



Replies:
Posted By: prashant
Date Posted: 07 November 2008 at 7:11am
Hello Oleg / Codejock support team.

For your convinience I have attached modified source code, please debug to find the problem.

In a source code place a breakpoint where you fing following tag:

///Code aded by Prashant
///!<HERE WE ARE GETTING PREVIOUS SELECTION DATE>

uploads/20081107_071030_CalendarDemo.zip - uploads/20081107_071030_CalendarDemo.zip

Thanks in advance.


Posted By: Oleg
Date Posted: 10 November 2008 at 2:30am
Hi,
Obviously you should call base method first to update selected day.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net