Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Problem with ListBox in the RibbonBar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem with ListBox in the RibbonBar

 Post Reply Post Reply
Author
Message
Tsenoh View Drop Down
Groupie
Groupie
Avatar

Joined: 08 November 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tsenoh Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2006 at 7:20am
Hi,
I very recommend you use Galleries instead.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Tsenoh View Drop Down
Groupie
Groupie
Avatar

Joined: 08 November 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tsenoh Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Tsenoh View Drop Down
Groupie
Groupie
Avatar

Joined: 08 November 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tsenoh Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2006 at 10:55am
I have. This is my code:

Back to Top
Tsenoh View Drop Down
Groupie
Groupie
Avatar

Joined: 08 November 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tsenoh Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Tsenoh View Drop Down
Groupie
Groupie
Avatar

Joined: 08 November 2006
Status: Offline
Points: 69
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tsenoh Quote  Post ReplyReply Direct Link To This Post 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
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.156 seconds.