Menu

Assert after calling CToolBar::SetButtonWidth before attaching toolbar into rebar band

ioannis
2017-09-30
2018-02-09
  • ioannis

    ioannis - 2017-09-30

    I keep running into a problem where i create a toolbar as a child of a rebar.

    If i call CToolBar::SetButtonWidth before attaching the toolbar into a rebar band by CReBar::InsertBand
    I get an assert failure caused by CReBar::OnToolBarResize where GedBand(hToolBar) will return -1 and propagate the value into CReBar::SetBandInfo which will assert

    So had to amend as follows:

    inline LRESULT CReBar::OnToolBarResize(UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
        HWND hToolBar = (HWND)wParam;
        LPSIZE pToolBarSize = (LPSIZE)lParam;
        int nBand = GetBand(hToolBar);
        if (nBand != -1) {
            ResizeBand(nBand, *pToolBarSize);
        }
        return FinalWindowProc(uMsg, wParam, lParam);
    }
    

    Please advise if this is the correct way to resolve and/or if there is any fix planned for this matter.
    Thanks.

     
  • David

    David - 2018-02-09

    Thanks for the information.

    I included the change you suggested into version 8.5.

    Best regards,
    David

     

Log in to post a comment.