Print Page | Close Window

CXTPDatePickerControl OnButtonClick

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=2610
Printed Date: 25 April 2024 at 5:05pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPDatePickerControl OnButtonClick
Posted By: tjohnson
Subject: CXTPDatePickerControl OnButtonClick
Date Posted: 20 July 2005 at 9:32am

I'm trying to add functionality to a button added to my CXTPDatePickerControl via the AddButton method.  From what I can tell, I should be able to override the OnButtonClick method to do this.  What I have works, more or less, except that I'm trying to use this control as it is used in the provided sample, that is as part of a CComboBox and popup window.  The normal Today and None buttons, after they are clicked, cause the call to GoModal to return.  When my custom button is clicked, the actions I've coded execute (i.e. the date selection changes), but the GoModal call doesn't return.  I'm sure there is some call or message sending I'm missing, but I don't know what it is.  Can you tell me what I'm missing?

Here is the code I have so far in my OnButtonClick method (be gentle, I'm new to MFC and C++ in general):

if(id == IDS_ButtonText){

NMHDR d;

d.code = NM_CLICK;

d.idFrom = IDS_ButtonText;

d.hwndFrom = m_hWnd;

COleDateTime birthday;

birthday.ParseDateTime("4/30/1979");

EnsureVisible(birthday);

Select(birthday);

SendMessageToParent(XTP_NC_DATEPICKER_BUTTON_CLICK, &d);

}

else{CXTPDatePickerControl::OnButtonClick(id); }



-------------
~Travis



Replies:
Posted By: sserge
Date Posted: 20 July 2005 at 4:19pm
Hi,

There seems to be 2 ways to break modal loop in your case:

1.

SendMessageToParent(XTP_NC_DATEPICKER_SELECTION_CHANGED);


2.

    if(m_bIsModal)
        EndModalLoop(0);


--
WBR,
Serge


Posted By: tjohnson
Date Posted: 20 July 2005 at 5:17pm
I tried Option 1 and it did the trick.  Thanks!

-------------
~Travis



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