|  | 
| Problem with ListBox in the RibbonBar | 
| Post Reply   | 
| Author | |
| Tsenoh   Groupie     Joined: 08 November 2006 Status: Offline Points: 69 |  Post Options  Thanks(0)  Quote  Reply  Topic: Problem with ListBox in the RibbonBar 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 | |
|  | |
| Oleg   Senior Member   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |  Post Options  Thanks(0)  Quote  Reply  Posted: 20 December 2006 at 7:20am | 
| 
   Hi,
 I very recommend you use Galleries instead. | |
| 
     Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS | |
|  | |
| Tsenoh   Groupie     Joined: 08 November 2006 Status: Offline Points: 69 |  Post Options  Thanks(0)  Quote  Reply  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 | |
|  | |
| Oleg   Senior Member   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |  Post Options  Thanks(0)  Quote  Reply  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 | |
|  | |
| Tsenoh   Groupie     Joined: 08 November 2006 Status: Offline Points: 69 |  Post Options  Thanks(0)  Quote  Reply  Posted: 20 December 2006 at 10:55am | 
| 
   I have. This is my code: | |
|  | |
| Tsenoh   Groupie     Joined: 08 November 2006 Status: Offline Points: 69 |  Post Options  Thanks(0)  Quote  Reply  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. | |
|  | |
| Tsenoh   Groupie     Joined: 08 November 2006 Status: Offline Points: 69 |  Post Options  Thanks(0)  Quote  Reply  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 | |
|  | |
| 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 |