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 » Inserting button into toolbar dynamicly Collapse All
Subject Author Date
Andrew Nanopoulos Apr 4, 2006 - 12:49 PM

How can I insert a button into the middle of a toolbar at runtime?

Technical Support Apr 5, 2006 - 10:59 AM

To insert a button object, please use the CExtToolControlBar::InsertButton() or CExtToolControlBar::InsertSpecButton() method. The next step is to recompute the toolbar’s layout (and the layout of neighboring bars if needed). If your toolbar is dockable toolbar inside the main frame window, invoke pToolBar->GetParentFrame()->RecalcLayout(). If your toolbar is not enabled for docking (e.g., when it is placed on the dialog), then use this the following code:

    pToolBar->GetParent()->RepositionBars( 0, 0x0FFFF, 0 );
    pToolBar->SetWindowPos(
        NULL, 0, 0, 0, 0,
        SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE
        |SWP_NOZORDER|SWP_NOOWNERZORDER
        |SWP_FRAMECHANGED
        );