CMonthCalCtrl

I have problem in using the CMonthCalCtrl.
The CmnCtrl1 sample from MSDN can show the problem
When I pick a day from the month dialog it gave the date with 12 days
offset.
When I use the MultiSelect option the date OK.
The first time of Today picking it is also OK.
Are Anybody there know how to solve this problem.
(for get going on in my app I use multiselect for picking one day also.)

Attached screens that demonstrate the problem.

Thanks,

David.



0
11/13/2003 2:12:50 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1396 Views

Similar Articles

[PageSpeed] 34

Hi David,

Thanks for you posting in the group!

There is a workaround for the sample bug: use the SYSTEMTIME structure 
instead of CTIME as follows

//in monthcal.cpp
...
void CMonthCalPage::HandleSelect(NMHDR *pHdr, LRESULT *pRes)
{
	m_NotifyList.AddString(_T("MCN_SELECT"));
	if((m_MonthCal.GetStyle() & MCS_MULTISELECT))
		return;
	//CTime ct; 
	SYSTEMTIME st;
	m_MonthCal.GetCurSel(&st);
	m_pszSelection.Format(_T("%02d/%02d/%2d"), st.wMonth, st.wDay, st.wYear);  
//ct.GetMonth(),ct.GetDay(),ct.GetYear());
	UpdateData(FALSE);

}

void CMonthCalPage::HandleSelChange(NMHDR *pHdr, LRESULT *pRes)
{

	m_NotifyList.AddString(_T("MCN_SELCHANGE"));
	if(! (m_MonthCal.GetStyle() & MCS_MULTISELECT))
		return;
	//CTime ctmin,ctmax;
                SYSTEMTIME stmin,stmax;
	m_MonthCal.GetSelRange(&stmin,&stmax);
	m_pszRange.Format(_T("%02d/%02d/%2d to %02d/%02d/%2d"), 
stmin.wMonth,stmin.wDay,stmin.wYear, stmax.wMonth,stmax.wDay,stmax.wYear);
	UpdateData(FALSE);
}...


Hope that helps!

Best regards,
Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

0
v-garych (605)
11/14/2003 3:40:39 AM
Thanks,
It work fine.
David.

"Gary Chang [MSFT]" <v-garych@online.microsoft.com> wrote in message
news:aj3cTEmqDHA.2396@cpmsftngxa06.phx.gbl...
> Hi David,
>
> Thanks for you posting in the group!
>
> There is a workaround for the sample bug: use the SYSTEMTIME structure
> instead of CTIME as follows
>
> //in monthcal.cpp
> ..
> void CMonthCalPage::HandleSelect(NMHDR *pHdr, LRESULT *pRes)
> {
> m_NotifyList.AddString(_T("MCN_SELECT"));
> if((m_MonthCal.GetStyle() & MCS_MULTISELECT))
> return;
> //CTime ct;
> SYSTEMTIME st;
> m_MonthCal.GetCurSel(&st);
> m_pszSelection.Format(_T("%02d/%02d/%2d"), st.wMonth, st.wDay, st.wYear);
> //ct.GetMonth(),ct.GetDay(),ct.GetYear());
> UpdateData(FALSE);
>
> }
>
> void CMonthCalPage::HandleSelChange(NMHDR *pHdr, LRESULT *pRes)
> {
>
> m_NotifyList.AddString(_T("MCN_SELCHANGE"));
> if(! (m_MonthCal.GetStyle() & MCS_MULTISELECT))
> return;
> //CTime ctmin,ctmax;
>                 SYSTEMTIME stmin,stmax;
> m_MonthCal.GetSelRange(&stmin,&stmax);
> m_pszRange.Format(_T("%02d/%02d/%2d to %02d/%02d/%2d"),
> stmin.wMonth,stmin.wDay,stmin.wYear, stmax.wMonth,stmax.wDay,stmax.wYear);
> UpdateData(FALSE);
> }...
>
>
> Hope that helps!
>
> Best regards,
> Gary Chang
> Microsoft Online Partner Support
>
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> --------------------
>


0
11/17/2003 7:17:28 AM
Reply:

Similar Artilces:

CMonthCalCtrl #4
Calendar control is setting timer. Upon receiving timer message it sends MCN_SELCHANGE notification. What is a reason for that? -- RainMan Hi RainMan, Currently I am looking for somebody who could find the cause for the timer. We will reply here with more information as soon as possible. If you have any more concerns on it, please feel free to post here. Thanks for your understanding! Best regards, Gary Chang Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and confers no rights. ----------------...

CMonthCalCtrl
I have problem in using the CMonthCalCtrl. The CmnCtrl1 sample from MSDN can show the problem When I pick a day from the month dialog it gave the date with 12 days offset. When I use the MultiSelect option the date OK. The first time of Today picking it is also OK. Are Anybody there know how to solve this problem. (for get going on in my app I use multiselect for picking one day also.) Attached screens that demonstrate the problem. Thanks, David. Hi David, Thanks for you posting in the group! There is a workaround for the sample bug: use the SYSTEMTIME structure instead of CTIME as f...

CMonthCalCtrl #5
How do you disable this control? I tried using EnableWindow(FALSE) but that didn't work. Thanks, Neil What do you mean by not work. EnableWindow(FALSE) will disable the month arrow buttons and disables date selection. Otherwise there are no visual indications that the control is disabled. AliR. "Neil B" <NeilB@discussions.microsoft.com> wrote in message news:7752DFC6-683F-4148-B55E-D0DD0DCBF17C@microsoft.com... > How do you disable this control? I tried using EnableWindow(FALSE) but > that > didn't work. > > Thanks, Neil It disables it fo...

CMonthCalCtrl #3
Calendar control is setting timer. Upon receiving timer message it sends MCN_SELCHANGE notification. What is a reason for that? -- RainMan ...

CMonthCalCtrl painting problem
Hello I write my own calendar control. Its structure looks like this class MyControl : protected CWnd { ... MyEditControl mEdit; MyButton mButton; MyCalendar mCalendar; } where class MyEditCtrl : public CEdit { }; class MyButton : public CButton { }; class MyCalendar : public CMonthCalCtrl { }; When the button is clicked I create the calendar (using the window that owns my control as the owner of the calendar) and capture mouse events to find out whether the calendar or something else was hit. I tested this on some dummy dialog project generated with app wizard. The control l...

How can I localize CMonthCalCtrl at runtime?
Hello, I've an application that uses CMonthCalCtrl control in a dialog. MSDN documentation states that the month- calendar control uses LOCALE_USER_DEFAULT to get its format and all strings. For Windows 2000 and later, it gets month title format from LOCALE_SYEARMONTH. So, it seems that the control is using the OS/user defined locale. I need to change the locale at runtime, such that if the user selects "Korean" locale in my application, the control is able to show in Korean, even though the underlying user defined/OS defined locale is Japanese. Is there...

How to hide selection in CMonthCalCtrl ?
Is there a way to hide selection in CMonthCalCtrl or move it outside the current month, so there is no selection mark visible ? Regards, Kamil ...

CMonthCalCtrl #2
I have problem in using the CMonthCalCtrl. The CmnCtrl1 sample from MSDN can show the problem When I pick a day from the month dialog it gave the date with 12 days offset. When I use the MultiSelect option the date OK. The first time of Today picking it is also OK. Are Anybody there know how to solve this problem. (for get going on in my app I use multiselect for picking one day also.) Attached screens that demonstrate the problem. Thanks, David. Hi David, I notice that you have posted a same message in the thread19911608, I will reply this post in that thread. Best regards, Gary Cha...

Broken CMonthCalCtrl ?
I have multiselect CMontCalCtrl and sometimes I need to select days across month boundary and a calendar page. I do this by calling SetSelRange() and everything works fine until I try to scroll months. When I switch the calendar page to the other month the selection is incorrect. It looks like the calendar doesn't refresh it - the month is different but the selected days stays the same on each page ( the same as on the first page ). Maybe I missed something. I call SetMaxSelCount(180),SetRange( a_few_months ), SetSelRange( a_few_months ) and it doesn't work. Whats wrong with it ? Kami...

CMonthCalCtrl get month
Hi, how can I get the currently displayed month from the CMonthCalCtrl? Can't find the answer anywhere. They all are talking about the selected date. I need to know just the month. Thanks in advance. ...

CMonthCalCtrl
Hi, I want few custom things in CMonthCalCtrl. Can anyone suggest how these can be achieved. 1) I want the Next and Prev button to be disabled or hidden. I just want the month that's shown only and not allow the users to move to the next. 2) I want to hide the year text. can some one tell me how this can be done. Thanks in advance -Amudhan You could try this control instead. Having the source for it would allow you to customize it to your liking... http://www.codeproject.com/miscctrl/minicalendar.asp?df=100&forumid=3190&exp=0&select=967592 It doesn't look to me like t...

Date Format In CMonthCalCtrl Control
Hi, Is there a way to change the date format in a CMonthCalCtrl that comes from a CDateTimeCtrl. If not, how can I hide the "Today: m/d/yyyy" option from view. The big problem is how to get access to CMonthCalCtrl to be able to change these options. Thanks, Marcus de Leon >Is there a way to change the date format in a CMonthCalCtrl that comes >from a CDateTimeCtrl. If not, how can I hide the "Today: m/d/yyyy" >option from view. The big problem is how to get access to CMonthCalCtrl >to be able to change these options. Marcus, Does CDateTimeCtrl::GetMonthCa...

CMonthCalCtrl data retrieval problem
I'm an MFC newbie. After having problems in a real application, I created a project with a single dialog to try to isolate the problem. Using VC ++ 6. I created a dialog with 2 controls, an edit box and a monthly calendar in the dialog editor. Using the wizard, I assigned variables to the two items. I edited the main menu and created an item to invoke a function in the View called OnMenuCal which is being called just fine. In ...View.cpp I created the function OnMenuCal() as follows (edited down very slightly): void CCalDlgView::OnMenuCal() { CTime ctToday =CTime::GetCurrentTime()...

CMonthCalCtrl higlights weekdays in stead of weekends
When the year turned from 2003 to 2004, CMonthCalCtrl started to highlight ordinary days in stead og weekends. Has anyone else seen this problem? Is there a fix? Jarle -- Jarle Aase http://www.jgaa.com mailto:jgaa@jgaa.com <<< no need to argue - just kill'em all! >>> Hi Jarle, Thanks for you posting in the group! >When the year turned from 2003 to 2004, CMonthCalCtrl started to highlight >ordinary days in stead og weekends. I am not able to see the highlight state of the days, do you mean the *Bold* state? If I misunderstand your mea...

URGENT: CMonthCalCtrl::GetCurSel doesn't work!!!
Hello, I don't uderstand why the CMonthCalCtrl::GetCurSel method doesn't work properly :''( I use the CMonthCalCtrl::SetCurSel to set the selection on the system's current time and it's ok... I change to the next day but when I call the CMonthCalCtrl::GetCurSel I got a wrong date! Eg. : CMonthCalCtrl::SetCurSel(CTime::GetCurrentTime()); All ok, the selection is on "05 Feb 2004"... ....change the selection on "06 Feb 2004" (clicking on the control)... CMonthCalCtrl::GetCurSel(&t) .... retrieve the selected date in the CTime object called "t&...

CMonthCalCtrl with custom 'Today Circle' color
Using the Windows XP Themes the CMonthCalCtrl uses a red box for the 'Today Circle.' I would like to change the color of the box to blue. Is there any way to do this easily? Rob These guys have a nice one that might work for you: http://www.bcgsoft.com/bcgdatetime.htm Tom "Rob T." <email@notset.com> wrote in message news:77p0d1t6peh9lnligve3rgkmkbuuu770p8@4ax.com... > Using the Windows XP Themes the CMonthCalCtrl uses a red box for the > 'Today Circle.' I would like to change the color of the box to blue. > Is there any way to do this easily? &g...