Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - CXTPDatePickerControl OnButtonClick
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPDatePickerControl OnButtonClick

 Post Reply Post Reply
Author
Message
tjohnson View Drop Down
Newbie
Newbie
Avatar

Joined: 20 July 2005
Location: United States
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote tjohnson Quote  Post ReplyReply Direct Link To This Post Topic: CXTPDatePickerControl OnButtonClick
    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); }



Edited by tjohnson
~Travis
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
tjohnson View Drop Down
Newbie
Newbie
Avatar

Joined: 20 July 2005
Location: United States
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote tjohnson Quote  Post ReplyReply Direct Link To This Post Posted: 20 July 2005 at 5:17pm
I tried Option 1 and it did the trick.  Thanks!
~Travis
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.