|
I am trying to implement a CXTPPopupToolBar as part of a CXTPRibbonGroup in a ribbon bar. What I want is that when the popup displays for it not to close when the user uses any of the controls. I have this working except for a listbox font selector.
The SetCloseSubMenuOnClick method works for all the controls in my popup except for the listbox. If I use that method with the listbox, when the listbox expands it will not close. So I want the listbox to close when the user makes its selection, but not to have it close the underlying popup.
Here is the code I am playing with. I have been experimenting with reacting to messages when the listbox is changed, but not getting good results there. I have not found a way to manually close the listbox once it is open.
CXTPControlPopup* pButtonBasics = (CXTPControlPopup*)pGroupText->Add(xtpControlButtonPopup, ID_TEXT_BASICS); CXTPPopupToolBar* pBasicsBar = CXTPPopupToolBar::CreatePopupToolBar(GetCommandBars()); pBasicsBar->EnableCustomization(FALSE); pBasicsBar->SetBorders(CRect(2, 2, 2, 2)); pBasicsBar->DisableShadow();
CXTPControlComboBox* pComboFont = new CXTPControlComboBox(); pComboFont->SetDropDownListStyle(TRUE); pComboFont->EnableAutoComplete(); pComboFont->SetCloseSubMenuOnClick(FALSE); pBasicsBar->GetControls()->Add(pComboFont, ID_FONT_FACE);
CXTPPopupBar* pPopupBarGallery = CXTPControlComboBoxGalleryPopupBar::CreateComboBoxGalleryPopupBar(pCommandBars); pComboFont->SetCommandBar(pPopupBarGallery);
CXTPControlGallery* pControlGallery = new CXTPControlGallery(); pControlGallery->SetControlSize(CSize(290, 300)); pControlGallery->ShowLabels(TRUE); // doesn't seem to do anything CXTPControlGalleryItems* pItemsFontFace = CXTPControlGalleryItems::CreateItems(pCommandBars, ID_GALLERY_FONTFACE); pItemsFontFace->SetItemSize(CSize(0, 26)); CGalleryItemFontFace::AddFontItems(pItemsFontFace);
pControlGallery->SetItems(pItemsFontFace); pPopupBarGallery->GetControls()->Add(pControlGallery, ID_GALLERY_FONTFACE); pPopupBarGallery->InternalRelease();
|