Customizable toolbar

Allows user-customization (inserting, removing, reordering toolbar buttons) of the toolbar. Also remembers last position of the toolbar upon application exit.

While monitoring the MFC newsgroup, a friend and I noticed quite a few questions on customizable toolbars, so we went off and created a generic application supporting customizable toolbars.  Unfortunately, I've just noticed that when customizing the toolbar while the toolbar is vertical causes incorrect repainting - to correct the toolbar display, simply float the toolbar, resize it (this corrects the painting), and then re-dock it.  Customization is disabled while the toolbar is floating because we couldn't get the toolbar to repaint correctly (since the customizable toolbar wasn't part of our project, we didn't feel terribly motivated to perfect our generic application - but this project could serve as an excellent springboard to get developers to the point of customizable toolbars).

To exploit the capabilities of the customization functionality, right-click anywhere over the toolbar while the toolbar is docked (I could never get the toolbar to redraw itself correctly when it was floating) and select the menu item. The framework-supplied common dialog will be presented allowing you to reposition the toolbar buttons. The bulk of the processing lies in the header DkToolBar.h and the implementation DkToolBar.cpp. CDkToolBar utilizes message reflection to handle the toolbar customization notification messages (tbn_beginadjust, tbn_begindrag, tbn_custhelp, tbn_endadnust, tbn_enddrag, tbn_getbuttoninfo, tbn_querydelete, tbn_queryinsert, tbn_reset, and tbn_toolbarchange).

Warning: To make the creation of the toolbar a little easier, I've overridden CToolBar::Create in order to default some of the arguments. In doing so, I don't think you can simply drop this class in where you used to have CToolBar's - but it's only a few lines away from a drop-in. Also, in MainFrm.cpp, you'll notice a block of code declaring CMainFrame::mainToolBar. This is a collection of data needed to inform the toolbar what buttons are available to the toolbar and their default ordering on the toolbar.

Download project files 25KB



Comments

  • help porn on toolbar kids computer

    Posted by Legacy on 01/18/2004 12:00am

    Originally posted by: doris

    everytime i try to remove it and i close internet explorer and the reopen it there back this is the kids computer and i can't get it off of there
    

    • RE:help porn on toolbar kids computer

      Posted by Fullmetal99012 on 08/04/2008 10:27pm

      It sounds like you have a spyware, malware, adware or virus problem, try using a program like Spybot search and destroy. download and update Search and destroy, then Disconnect the computer from the internet and run a full system scan. I had a similar problem, and that is how I fixed it. If you need anymore help, you can E-mail me at Cybeastfalzar99@yahoo.com... I'll try to get back to you as soon as I can, but I am Very busy sometimes. Hope this helps

      Reply
    Reply
  • How to acativate ActiveX Control at runtime in my application?(plz reply me soon!!))

    Posted by Legacy on 09/03/2003 12:00am

    Originally posted by: nsaadyah

    hi,
    i am developing a dialog based application. i want a built-in control to run at runtime by an end user
    my application requirement is that a user clicks the activex control and use its built-in functionalities (like zooming, resizing & moving)
    how to make a control container where all my controls will be placed and user can select at runtime any of the controls for enjoying its built-in functionalities at runtime(drag, resize...) !!
    please help me!!
    email address: nsaadyah@yahoo.com
    nsaadyah@hotmail.com
    thanking you in anticipation
    regards
    saadyah

    Reply
  • How to acativate ActiveX Control at runtime in my application?(plz reply me soon!!))

    Posted by Legacy on 09/03/2003 12:00am

    Originally posted by: nsaadyah

    Hi,
    I am developing a dialog based application. i want a built-in control to run at runtime by an end user
    my application requirement is that a user clicks the activex control and use its built-in functionalities (like zooming, resizing & moving)
    how to make a control container where all my controls will be placed and user can select at runtime any of the controls for enjoying its built-in functionalities at runtime !!
    please help me!!
    email address: nsaadyah@yahoo.com
    nsaadyah@hotmail.com
    thanking you in anticipation
    saadyah


    Reply
  • How to add a tool bar in the existing tool bar

    Posted by Legacy on 09/06/2002 12:00am

    Originally posted by: Mallikarjun


    I have to add a tool bar in the existing tool bar
    like in the Microsoft Paint application

    Reply
  • Problem with ToolBar created by D.Keith

    Posted by Legacy on 06/06/2002 12:00am

    Originally posted by: Muthukumar K.

    As a MFC learner / programmer from India, I wish to ask a query regarding your work. It was really superb. I dont really know when you posted this over web. I encountered a problem with the tool bar customization. When i moved the buttons by holding shift keys, I could move the buttons but being your CToolBarInfo struct being static, When I reset the Toolbar customization dialog, using "RESET" button, I found that it wasnot properly reset. Is there any way to go around correctly? pl reply

    Reply
  • See the customisation dialog

    Posted by Legacy on 05/10/2002 12:00am

    Originally posted by: siva

    I've a SDI application with a default toolbar.
    
    

    Now I just added a menu item to see the customization window of the toolbar.
    I've changed the style of the toolbar to CCS_ADJUSTABLE
    and called the function from the menu selection..

    void CMainFrame::OnCustom()
    {
    // TODO: Add your command handler code here

    m_wndToolBar.GetToolBarCtrl().Customize();

    }

    But the dialog doesn't wait for the user input..
    It disappears..
    What could be the problem?

    Reply
  • Vertical Floating

    Posted by Legacy on 03/29/2002 12:00am

    Originally posted by: Bracoute

    Hello mister,

    i've seen one of your article about toolbar on codeguru.com. I hope i'm not
    annoying you when mailing you and asking you: How can i convert my
    horizontal floating bar to a vertical floating bar (n rows X 2 columns of
    buttons) Can you please help. It's very important to me. Help if you can.

    Thanks in advance
    Bernard Racoute
    bracoute

    Reply
  • How to add a NEW toolbar to the exixting toolbar for Windows NT 4.0

    Posted by Legacy on 12/26/2001 12:00am

    Originally posted by: Raghu

    Hello
    i'm very curious to know how to add a toolbar to by windows nt 4.0 existing toolbar.Just by right clicking on toolbar is not enough.I need to add this new one.

    Reply
  • 2 other problems:

    Posted by Legacy on 07/24/2001 12:00am

    Originally posted by: Alf

    1- wenn I delete all the buttons from the toolbar and keep only one on it
    the entire toolbar is redrawn at the new start of the application. In fact I must have minimum 2 buttons
    on it.

    2- wenn I'm playing with the customisation dialog and add separator at
    the beginning or at the end of the
    toolbar, these new buttons are redrawn well wenn the toolbar is
    positioned horizontaly, but not wenn it is
    verticaly... Is there a bug in the mfc's?

    Can someone help?

    Reply
  • Problem with 2 toolbars

    Posted by Legacy on 07/19/2001 12:00am

    Originally posted by: Alf

    Hi,

    I have an application which has 2 toolbars (one under the other at the 1st start) and I'm wanting to save their respective positions. I've included the CDkToolBar class in my projet, the customization works well, my problem is that the toolbars position aren't saved or redrown (?) correctly at the new start of the application. In fact the first toolbar gets the position of the second, the second is always on top...

    Can anyone help me?

    Thanks !

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • Packaged application development teams frequently operate with limited testing environments due to time and labor constraints. By virtualizing the entire application stack, packaged application development teams can deliver business results faster, at higher quality, and with lower risk.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds