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 Tech Support » Preventing toolbar chevrons - how to always show entire bar? Collapse All
Subject Author Date
Chris Thomas Jul 7, 2005 - 3:03 PM

Hello, I have a app with customization, and have an issue with redocking toolbars occasionally truncating and displaying a right-pointing double chevron.

I saw the FAQ article "How to remove the chevron button from the toolbar?", but that seems to refer to the down arrow glyph, not the right pointing chevron. It seems to me that removing that would also disable the customization system (but I’ll try it anyway).

The first time through, things get docked beautifully. It uses the FAQ "How to set the initial positions of toolbars when the application starts for the first time?" which consists of repeated RecalcLayout() and OffsetRect(1,0) calls. I’ve expanded on that technique to pop bars to the next row if there isn’t enough room on the current row. Again, that is working fine.

The app allows you to reset the toolbars, which runs through the exact same code as the initial docking. Sometimes a bar or two gets "truncated" and the right chevron appears. If you click the chevron you get a context menu with the "spilled over" buttons. Sometimes almost all the bars get this, and you see just one or two buttons on each!

I tried making the bar "fixed size" but then the docking system complains.

Any ideas? Thanks.

Technical Support Jul 9, 2005 - 8:35 AM

We know that it is completely possible to remove the toolbar’s chevron button and, at the same time, to dock toolbars relative to each other regardless whether your application is customizable or not. Unfortunately you did not provide any code snippet demonstrating how you tried to perform this task. Alternatively you can send us your project and we will help you to find out what’s wrong.

Chris Thomas Jul 11, 2005 - 9:24 AM

Is there an example of how to implement "reset toolbars" functionality? What I’m after is a example of starting out with a set of docked toolbars, then the user moves them around and floats some, then hits a menu "reset toolbars", and the app then redocks all the bars as they were before the user moved them.

Perhaps it would be easiest to consider how to do that with the StyleEditor example?

I seem to be having trouble with the redocking part. It seems that if a toolbar is already docked then it wants to keep its position. When the app starts for the first time, the bars are all tight without gaps and without any truncation (chevron).

How can I tell profuis to forget about all the toolbar positions and just start over, without restarting the app?

Also I sometimes (seemingly randomly) get ASSERTs about some "affixment data". I don’t understand what that is or what bearing it would have to docking. Can’t you just put the bar where it fits?

Chris Thomas Jul 11, 2005 - 9:26 AM

Sorry for another question, but perhaps you could answer why I sometimes get toolbar truncation with the right pointing chevron (with truncated menu icons on a popup menu), but I can never drag and drap a bar to force this behavior. It simply does not let the user drop a bar onto another to force truncation, but it happens through code.

Chris Thomas Jul 11, 2005 - 10:45 AM

OK, you can see my problem if you take the StyleEditor example and add an menu item for "Reset Toolbars" and put a handler for it in CMainFrame:

void CMainFrame::OnFileResettoolbars()
{
    //Redock m_wndToolBarStandard to the top left
    DockControlBar(&m_wndToolBarStandard);
    RecalcLayout ();

    CRect rect;
    m_wndToolBarStandard.GetWindowRect (&rect);
    rect.OffsetRect (1,0);

    //Redock m_wndToolBarUiLook to the right of m_wndToolBarStandard

    DockControlBar(&m_wndToolBarUiLook, AFX_IDW_DOCKBAR_TOP, &rect);
    RecalcLayout ();
}

Try moving the bars around then clicking on Reset Toolbars. In this case I always want m_wndToolBarStandard on the top row, and m_wndToolBarUiLook on the same row to right.

Is this the wrong approach?

Thanks

Chris Thomas Jul 11, 2005 - 11:41 AM

And if you replace the reset toolbar routine with this one, that also docks the menu bar, then you will eventually see the affixment ASSERT:

void CMainFrame::OnFileResettoolbars()
{
    DockControlBar(&m_wndMenuBar);
    RecalcLayout ();

    //Redock m_wndToolBarStandard to the top left
    CRect rect;
    m_wndMenuBar.GetWindowRect (&rect);
    rect.OffsetRect (0,1);
    DockControlBar(&m_wndToolBarStandard, AFX_IDW_DOCKBAR_TOP, &rect);
//    DockControlBar(&m_wndToolBarStandard);

//    CRect rect;
    m_wndToolBarStandard.GetWindowRect (&rect);
    rect.OffsetRect (1,0);

    //Redock m_wndToolBarUiLook to the right of m_wndToolBarStandard

    DockControlBar(&m_wndToolBarUiLook, AFX_IDW_DOCKBAR_TOP, &rect);
    RecalcLayout ();
}

Sorry for such a verbose bunch of questions.

Technical Support Jul 11, 2005 - 12:40 PM

You should simply invoke the _AffixmentSafeClearOuter() method for each toolbar immediately before you redock the toolbar by calling DockControlBar().

Technical Support Jul 11, 2005 - 12:38 PM

Please use the _AffixmentSafeClearOuter() method as we described in one of our previous messages in this thread and send us your source code if you encounter any difficulties.

Technical Support Jul 11, 2005 - 12:28 PM

The user really can be unable to drop some toolbar near another. For instance, you have several toolbars which are docked into one row. Then you decrease the width of the main frame window. The toolbars in the row become smaller and even they may be re-organized in two rows which are virtual rows inside one real row. These virtual rows are always assumed to be one row. You can be unable to drop another toolbar in a very compressed row. The same behavior is provided by toolbars in the latest Microsoft products.

Technical Support Jul 11, 2005 - 12:25 PM

To reset positions of your toolbars as though your application starts for the first time, just invoke the code (in your CMainFrame::OnCreate() method) responsible for initioalizing GUI when the control bars’ state is not yet loaded from the registry.

Yes, we confirm that redocking a toolbar in this case has a problem with toolbar affixment. To make a toolbar forget its affixment information, please invoke its _AffixmentSafeClearOuter() method immediately before docking it into a new location.

Chris Thomas Jul 13, 2005 - 8:30 AM

Thanks!