Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CListCtrl inside a CExtControlBar Collapse All
Subject Author Date
Jonas Gauffin Nov 24, 2005 - 9:08 AM

I’m trying to get a ClistCtrl to work inside a CExtControlBar, but I cant get it to fill the entire ControlBar.
All your examples creates both the CListCtrl and CExtControlBar in CMainFrame. I do not want to do that since I want to protect the CListCtrl by making it private in the Control Bar.

Here is my defintion:

class CQueueBar : public CExtControlBar
{
public:
    CQueueBar();
    virtual ~CQueueBar();

    void AddQueues(Queues& qs);
    void UpdateQueue(Queue& queue);
    void ReloadQueues(Queues& qs);

    void SetQueueCount(int queueId, int count);

// Generated message map functions
protected:
    DECLARE_MESSAGE_MAP()
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//    afx_msg void OnSize(UINT nType, int cx, int cy);
//    afx_msg void OnPaint();

private:
    CExtWFF<CListCtrl>    m_queueList;

};


Creation of the ControlBar:

    DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC | CBRS_HIDE_INPLACE;

    CString title;
    title.LoadString(IDS_QUEUES);
    if (!m_wndQueueBar.Create (title, this, ID_VIEW_QUEUES, dwStyle | CBRS_LEFT))
    {
        TRACE0("Failed to create Queue bar 2\n");
        return FALSE; // fail to create
    }


And finally the creation of the listCtrl:
int CQueueBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CExtControlBar::OnCreate(lpCreateStruct) == -1)
        return -1;
    
    CRect rectDummy;
    rectDummy.SetRectEmpty ();

    const DWORD dwViewStyle = WS_CHILD|WS_VISIBLE
        |LVS_REPORT
        |LVS_SHOWSELALWAYS;
    if (!m_queueList.Create (dwViewStyle, rectDummy, this, this->GetDlgCtrlID()))
    {
        TRACE0("Failed to create workspace view\n");
        return -1; // fail to create
    }

    m_queueList.InsertColumn(1, "Namn", LVCFMT_LEFT, 80);
    m_queueList.InsertColumn(2, "#", LVCFMT_LEFT, 20);
    AddQueues(theApp.queues);
    return 0;
}

Technical Support Nov 24, 2005 - 11:56 AM

The CExtControlBar class implements a resizable control bar designed to keep only one child window. This child window is stretched automatically to fit all the bar’s client area. You can override the CExtControlBar::OnRepositionSingleChild() virtual method to implement your own alignment behavior of the child window but we think this is not a good idea because we believe your list control would look better if it is aligned by default. Typically there is no reason to make windows like your list window smaller. If you need to keep some other window near your list window, then you should use container window like a resizable dialog which will keep both the list window and other window inside. This technique is used in the ProfStudio sample application where you can see toolbar window over the list or tree window inside resizable bars like Solution Explorer and Class View.

Jonas Gauffin Nov 24, 2005 - 12:18 PM

I do want CListCtrl to get resized by the CExtControlBar, and it is the only child in it. What am I doing wrong?

Technical Support Nov 24, 2005 - 12:27 PM

If it is the only child inside the resizable bar, then it will be resized automatically. Otherwise you will face lots of assertions at run time. If it is not a child of the resizable bar, then it will not be resized and even may not be visible. Please check all these issues and send us your project if you have any problems.

Jonas Gauffin Nov 25, 2005 - 1:19 AM

I did everything except "DockControlBar( &m_wndQueueBar );"
Everything looks nice docked the control bar.