![]() |
How to put a CXTPDatePickerControl in a RibbonBar |
Post Reply ![]() |
Author | |
shineryu ![]() Groupie ![]() Joined: 02 April 2006 Location: China Status: Offline Points: 33 |
![]() ![]() ![]() ![]() ![]() Posted: 14 January 2008 at 12:04am |
I want to put a CXTPDatePickerControl in a RibbonBar.
Please give me some idea!
if I create a DatePickerComboBox like the DatePicker Sample, how to put it in ribbonbar?
and is there any better idea?
sincerely
|
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Use CXTPControlCustom.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
shineryu ![]() Groupie ![]() Joined: 02 April 2006 Location: China Status: Offline Points: 33 |
![]() ![]() ![]() ![]() ![]() |
thanks, oleg!
but I don't know how to use CXTPControlCustom!
i write my code like this:
CXTPRibbonTab* pTab = pRibbonBar->AddTab(ID_TAB_CALENDAR);
CXTPRibbonGroup* pGroup = pTab->AddGroup(ID_GROUP_CALENDAR); pGroup->SetControlsCentering(true); CXTPControlCustom* pDatePicker = new CXTPControlCustom(); CXTPDatePickerControl* pDatePickerCtrl = new CXTPDatePickerControl(); pDatePicker->SetControl(pDatePickerCtrl); pGroup->Add(pDatePicker, ID_DATE_PICKER); it doesn't show the datepicker!
help me
|
|
![]() |
|
shineryu ![]() Groupie ![]() Joined: 02 April 2006 Location: China Status: Offline Points: 33 |
![]() ![]() ![]() ![]() ![]() |
I think i find what is wrong.
I modified my code like this:
pTab = pRibbonBar->AddTab(ID_TAB_CALENDAR);
CXTPRibbonGroup* pGroup = pTab->AddGroup(ID_GROUP_CALENDAR); pGroup->SetControlsCentering(true); CXTPControlCustom* pDatePicker = new CXTPControlCustom(); CXTPDatePickerControl* pDatePickerCtrl = new CXTPDatePickerControl(); pDatePickerCtrl->Create(WS_CHILD | WS_VISIBLE, CRect(0, 0, 300, 128), pRibbonBar, ID_DATE_PICKER_CTRL); pDatePicker->SetControl(pDatePickerCtrl); pGroup->Add(pDatePicker, ID_DATE_PICKER); then it shows on ribbon. but, because the height of CXTPDatePickerControl is bigger than the height of RibbonBar, it shows only the top of CXTPDatePickerControl. it's ugly!
who can give me a better idea?
thanks! |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
try DatePickerComboBox instead of CXTPDatePickerControl
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
shineryu ![]() Groupie ![]() Joined: 02 April 2006 Location: China Status: Offline Points: 33 |
![]() ![]() ![]() ![]() ![]() |
thanks a lot.
but i don't like DatePickerComboBox, because it is not derived from CXTPControlComboBox.
Can u show me how to derive it from CXTPControlComboBox?
i find another choice. like this:
pTab = pRibbonBar->AddTab(ID_TAB_CALENDAR);
CXTPRibbonGroup* pGroup = pTab->AddGroup(ID_GROUP_CALENDAR); pGroup->SetControlsCentering(true); pControl = pGroup->Add(xtpControlSplitButtonPopup, ID_DATE_TEXT); // just static text to show date pControl->SetID(0); pControl->SetStyle(xtpButtonCaption); CXTPControlCustom* pDatePicker = new CXTPControlCustom(); CXTPDatePickerControl* pDateCtrl = new CXTPDatePickerControl(); pDateCtrl->Create(WS_TABSTOP | WS_CHILD, CRect(0, 0, 290, 400), pRibbonBar, ID_DATE_PICKER_CTRL); pDatePicker->SetControl(pDateCtrl); pDatePicker->SetFlags(xtpFlagManualUpdate); pControl->GetCommandBar()->GetControls()->Add(pDatePicker, ID_DATE_PICKER); It's nice except one problem. after i clicked the down arrow, the DatePicker is shown as a drop list, and it's ok. but it doesn't disappear after i cliked a 'date'!
|
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello,
You have manually catch it and close popup - GetCommandBars()->ClosePopups().
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
shineryu ![]() Groupie ![]() Joined: 02 April 2006 Location: China Status: Offline Points: 33 |
![]() ![]() ![]() ![]() ![]() |
thank u very much!
And, it will be very appreciate if u teach me how to "catch it menually".
Oleg
![]() |
|
![]() |
|
Oleg ![]() Senior Member ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Here sample:
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
shineryu ![]() Groupie ![]() Joined: 02 April 2006 Location: China Status: Offline Points: 33 |
![]() ![]() ![]() ![]() ![]() |
Excellent!
![]() Thank you very much!
![]() |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |