Problem with ListBox in the RibbonBar
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=5848
Printed Date: 04 March 2025 at 3:08am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Problem with ListBox in the RibbonBar
Posted By: Tsenoh
Subject: Problem with ListBox in the RibbonBar
Date Posted: 20 December 2006 at 5:41am
Hi!
I have added a listbox to the ribbonbar, but there are some issues with it. When I switch to another tab, the listbox stays on the top of other controls, where it should dissapear. The ListBox is not drop-down. It is there at all times. It is also the only control in a group, and for the time, the only one in the tab.
Any ideas? Or a sample how a ListBox can be used in a Ribbon?
Thanks,
Bojan
|
Replies:
Posted By: Oleg
Date Posted: 20 December 2006 at 7:20am
Hi,
I very recommend you use Galleries instead.
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Tsenoh
Date Posted: 20 December 2006 at 9:26am
Sorry, can't do it. The problem is that I already have a very complicated control inherited from CListCtrl, that allready has all functionality I need. I created my own class CMyXTPControlListBox : public CXTPControl, that has my CMyListCtrl control instead of the original one. Maybe you could shortly explain me the mechanism inside a control that hides it when a tab is switched? That would be great!
Thanks!
Sincerely,
Bojan Hrnkas
|
Posted By: Oleg
Date Posted: 20 December 2006 at 10:14am
check sources of CXTPControlCustom.
You need override
void CXTPControlCustom::SetHideFlags(DWORD dwFlags)
and
void CXTPControlCustom::SetRect(CRect rcControl)
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Tsenoh
Date Posted: 20 December 2006 at 10:55am
Posted By: Tsenoh
Date Posted: 20 December 2006 at 10:58am
Code:
void CMyXTPControlListBox::SetRect(CRect rcControl) { ASSERT_VALID(this);
if (m_rcControl == rcControl && m_pListBox->GetParent() == m_pParent) { return; }
m_rcControl = rcControl;
m_pListBox->EnableWindow(GetEnabled());
m_pListBox->ModifyStyle(WS_POPUP, WS_CHILD); m_pListBox->SetParent(m_pParent); m_pListBox->MoveWindow(rcControl); m_pListBox->SetWindowPos(0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | (!IsVisible() ? SWP_HIDEWINDOW : SWP_SHOWWINDOW)); }
void CMyXTPControlListBox::SetHideFlags(DWORD dwFlags) { m_dwHideFlags = dwFlags; if (m_dwHideFlags != xtpNoHide) { if (m_pListBox && m_pListBox->GetSafeHwnd()) m_pListBox->SetWindowPos(0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_HIDEWINDOW); DelayLayoutParent(); } else { if (m_pListBox && m_pListBox->GetSafeHwnd()) m_pListBox->SetWindowPos(0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); DelayLayoutParent(); } }
The code for hiding is executed properly, but the control just won't go away.
|
Posted By: Tsenoh
Date Posted: 20 December 2006 at 12:42pm
Solved the problem by using MoveWindow(CRect(0,0,0,0)) when the control should be hidden. Not the perfect solution, but it works.
Thanks for your time, Oleg! I appriciate it!
Bojan Hrnkas
|
|