
Introduction
I usually spend a lot of time to give my projects a nice and user friendly GUI. In my opinion, in all desktop projects, it's "almost" mandatory to give the user something that can speed-up functions that are frequently used. The simpler (and most commonly used) method is to build a toolbar. Visual Studio comes with a toolbar editor but, really, I hate it; it's still limited to 16 colors, it can't load external images, and every time you want to add a new button, it is a pain. For all these reasons, I wrote my own toolbar editor for the Visual Studio IDE.
Installation
Simply run the setup, and follow the on-screen instructions (nothing more than the usual: next, next, yes, yes, next, finish). The setup utility of Toolbar Editor (TE) will also create two subdirectories: temp and imgLib. You can put all icons / images that you frequently use to build your toolbars in the imgLib directory: they will be displayed and previewed in TE so you can easily drop them in the toolbar on which you are currently working on. You should also copy your afxres.h file in the main application directory. See the "Limits of the toolbar editor" section for more information. In my original plans, it would have to be a real add-in of Visual Studio, but the extensibility templates are disabled in my VC++ Std., so I started to write an external tool. Despite this, you can still use TE while your project is open: after you have committed the changes, the IDE will ask you to reload the modified files.
How it Works
You can start to edit toolbars in three steps:
- Open the resource file (.rc) of the project that you want to edit.
- Select the resource ID from the combo box.
- Click on "Scan" to get the preview of the currently loaded toolbar.

Now you can add new buttons, move around the existing ones, and so on. Both the toolbar and the listbox used for preview supports drag & drop, so you can easily move buttons using your mouse. On the right side of the dialog window, there is a listbox that you can use as a library; it reads all supported types of images from a folder (if you want, you can change it in the Options) so you can take them and drop on the toolbar (you can also drop new images from the Explorer window). If the image loaded is too big (or too small), you can use the Resize function from the main menu.
When your toolbar is ready, you can click on the "Generate" button to merge it with your project: all needed IDs will be created and added to the resource.h file. If you don't want to modify your project files, you can disable this feature, and the new files will only be created in the temp folder of the editor. By default, the bitmap generated has a 4 bit color depth (16 colors) to maintain the preview active in the Visual Studio editor also, but it's possible to create grayed, true color, and "hot" bitmaps.
The bitmaps will be created in the ./res folder of the currently open project. By default, their names are the same as the toolbar's bitmap, with the _TC, _HT, and _GR suffix, but you can change both the destination folder and the name. You can add these bitmaps to your project, and then use them with some true color toolbar class like Dany Cantin's CTrueColorToolbar.
Let's say that YOUR_BITMAP_TC, YOUR_BITMAP_HT, and YOUR_BITMAP_GR are the IDs of these bitmaps, then you can use them in your OnCreate like:
m_ToolBar.LoadTrueColorToolBar(
16,
YOUR_BITMAP_TC,
YOUR_BITMAP_HT,
YOUR_BITMAP_GR);
You should 'always' create the true color bitmap because when you will open the toolbar again for editing, it will be used to create the imagelist instead of the 16 color version. Note that this will work only if the true color bitmap is saved using the default name bitmap_name_TC.bmp.
Finally, if you need only the imagelist, you can save it using the Save button in the bitmap section. This won't update .rc or resource.h in your project.
Creating New Toolbars
Even if you are creating a new toolbar, you need a resource file to put it in. For this reason, remember to open the right resource file before starting to work on the new toolbar. After you select "New" on the "File" menu (or you click on the "New" button in the main TE toolbar), the Toolbar Editor will ask for essential info about the toolbar: ID, size, and type (Visual C++ .NET or Visual C++ 6).
You can choose a new ID also (not previously defined in your resource.h, but be careful: TE won't check if what you typed is a valid ID name, so avoid spaces, special chars, and so on...). After this point, you can work as previously described and, when you are ready, merge the toolbar with the "Generate" button, or copy the toolbar code to the clipboard using the menu entry Tools->Toolbar->Copy to clipboard.
Points of Interest
Well, first of all, I hope that this tool is really useful for someone else other than me. You can also find a custom implementation of a drag and drop enabled toolbar (it works without the Shift button pressed).

Limitations of the Toolbar Editor
There are some considerations about IDs. My editor reads the toolbar structure from the .rc file, and the IDs defined in your project in the resource.h file: it doesn't know anything about any other IDs! So be careful when you edit IDs in the Toolbar editor: if you use an ID already defined somewhere else than resource.h, it can be a problem! In any case TbEditor can read and check for double IDs defined in other files just add them in the file list available in the option dialog box.

Just a note: the setup package doesn't come with afxres.h because I don't know if that file is copyrighted by MS and/or if it's redistributable. You should copy it to the TE main folder so it will also be parsed to avoid double definitions or you can delete the file in the list and add it from your vs installation path. To put in your .rc file the new toolbars, TE uses as marker, this text: // Toolbar. If TE can't find the marker in your file, the merging of new toolbars will fail (note that this is a problem only for new toolbars).
Credits
My work was inspired by Tomkat's [^] great tool (Super ImageList and ToolBar generator [^]) that helped me a lot in the imagelist creation last year. I wish to also thank:
History
- 1.0 - (2005/08/02).
- 1.1 - (2005/08/03).
- Fixed some compatibility issues with VC6.
- 1.2 - (2005/08/05).
- Now it's possible to parse more files with IDs.
- Linked statically to avoid dependency problems.
- Changed true color bitmap generation checkbox to
true as default.
- Now, if available, atrue color bitmap is used to create the imagelist when a toolbar is opened.
- Disabled "error diffusion" in 16 color bitmap creation.
- 1.3 - (2005/09/12).
- Added "new" toolbar feature.
- Added hot imagelist creation.
- Added some accelerators.
- Added MRU list.
- Improved drag and drop (now you can use it to move buttons also, and replace only the image by holding the CTRL key).
- Fixed bug when two buttons have the same ID.
- 1.3b - (2005/10/27).
- Added check for update routine.
- Fixed bug caused by MRU implementation (crash on startup).
- Fixed bug with 16 colors bitmap (ugly view in preview).
- 1.3c - (2005/11/06).
- Some internal modification on code to prepare the new release.
- Fixed bug on "check for updates routine".
- 1.3d - (2006/07/04).
- Some internal modification on code to prepare the new release (again).
- Better error handling during parsing.
- Minor bug-fix.
- 1.41-(2008/01/05) **SHIPON**
- New dialog Layout to handle toolbars up to 48x48px
- Better icon handling: now before use they are all ported to true color
- Added support for png images/icons
- Fixed bug on reopeing an existing toolbar without a true color bitmap
- Fixed bug on first toolbar display: listcontrol without icon preview
- Minor bug fixes
License
This program is free and provided "as is" without any expressed or implied warranty. Use at your own risk!
| You must Sign In to use this message board. |
|
|
 |
|
 |
Won't scan simple .rc file, error message "Cannot scan resource file." Refresh error message "Cannot create preview toolbar control. Aborting" Refresh library button is sunken, does not look like button, confuses user... Buttons 1 and 6 on your toolbar have no tip text. Generate fails with same error as refresh.
Running w2k on a machine with 1 gig of memory running at 1.8 megahertz.
Your error messages are not useful to the user--- are they useful to you?
Help file could stand to have a worked example at a minimum.
--hsm
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
 |
First, thanks for you work. It looks promising.
However, I encountered some issues. First, generating 24 bit bitmaps only works when you use the 'save' button, not when using the 'generate' button. Secondly, a lot of controls look like they are editable but they're not apparently, like the rx and ry parameters. I tried to fix some of the problems but the download didn't contain everything that is needed to compile - I understand it's because of licensing issues.
Have you considered putting this on sourceforge so that there is version control etc.? I would fix some of the issues but the way it is now, it's too hard to collaborate - I'd have to send you the whole project, I wouldn't remember what I changed etc. So if you'd like to put this in a more formal project, let me know and I'll give you a hand. (if you have no interest in maintaining this software, please let me know also - if you'd agree, I'd put it up on sourceforge myself).
Thanks again for your work.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
roel_ wrote: First, thanks for you work. It looks promising.
You are welcome. I'm glad that you like it 
roel_ wrote: First, generating 24 bit bitmaps only works when you use the 'save' button, not when using the 'generate' button.
That is correct. The bitmap itself is created it that way. The generate button is used to merge the toolbar with the current open project. By the way the 24 bit, Hot and Gray bitmap are created in the /res subfolder of your project when you use the generate button (but you have to check the three checkbuttons near the generate one)
roel_ wrote: Secondly, a lot of controls look like they are editable but they're not apparently, like the rx and ry parameters.
Yes I know. I'm still working on this project but only on my free time (that in the last period isn't too much ) and in the code there are some controls disabled in release version like the new icon preview listbox..
roel_ wrote: I tried to fix some of the problems but the download didn't contain everything that is needed to compile - I understand it's because of licensing issues.
You need the CxImage library to compile toolbar editor. But you are right: the project can be surely improved...
roel_ wrote: Have you considered putting this on sourceforge so that there is version control etc.? I would fix some of the issues but the way it is now, it's too hard to collaborate - I'd have to send you the whole project, I wouldn't remember what I changed etc. So if you'd like to put this in a more formal project, let me know and I'll give you a hand. (if you have no interest in maintaining this software, please let me know also - if you'd agree, I'd put it up on sourceforge myself).
No, actually I never considered it but if you are interested in developing Toolbar Editor it's a nice idea for sure. I will arrange a new project on sourceforge in the next days.
Bye, Francesco
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Maybe I don't understand the 'generate' then, but don't worry I'll have a look at the code and that'll help. I'll keep an eye on this article, please post a message here when you have the project up and running.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
roel_ wrote: I'll keep an eye on this article, please post a message here when you have the project up and running.
I finished to setup the repository on sourceforge. I choose to use svn instead of cvs because of in the last project I tryed it and it seems really good... The name of the project is tbeditor.. and the URL is http://sourceforge.net/projects/tbeditor. At this moment there isn't anything but the repository and the 1.3d version (I should learn a little bit more about sourceforge site because this is my first project hosted on it...)
Bye, Francesco
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
You can get it Here 
Changelog:
1.3d - (2006/07/04)
[*] Some internal modification on code to prepare the new release (again) [*] Better error handling during parsing [*] Minor bugfix
TBEditor: a pandapowered app!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
We have a pretty big .rc file and the TBW won't read it - silently fails. Hitting "Scan" results in a failure message, but with no diagnostics.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Umh.. Probably I forgot to display some error message in the scan routine... It fails on every scan or is a random error? Could you send me your rc file?
Francesco
TBEditor: a pandapowered app!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Before I send the .rc file, can you confirm whether TBE needs to be able to find every .h and .rc file referenced by our .rc file ( those files are not needed for the toolbar in question, but does the scanner get upset if the files are not found.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
loopless wrote: Before I send the .rc file, can you confirm whether TBE needs to be able to find every .h and .rc file referenced by our .rc file ( those files are not needed for the toolbar in question, but does the scanner get upset if the files are not found.
No it is not necessary. The scanner is really simple: it just look for toolbar according to the sintax of .rc files without any recursive search in ncluded files. TBE needs to know where you put your "#define" only to avoid double definitions. In other words: if your toolbar is included in the .rc file that is cousing trouble there is some problem with my code 
Bye, Francesco
TBEditor: a pandapowered app!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Great work Francesco.
I'm trying to recreate the look of the VS2005 toolbar but I find it impossible to create truly transparent toolbar button bitmaps. The background can be easily adapted to VS2005 style by subclassing the control, catching WM_ERASEBKGND, and painting the background with a gradient brush. But because the toolbar uses it's own data structure when rendering bitmaps,it interposes a layer of grey control color between a transparent bitmap and the background.
Do you know of a workaround for this problem - other than moving to the new toolstrip control ?
Jon
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
jonnospam wrote: Great work Francesco.
Thank you! 
jonnospam wrote: Do you know of a workaround for this problem - other than moving to the new toolstrip control ?
No I'm sorry. I haven't a so deep knowledge of toolbar control. I use it a lot (actually I'm using the truecolor version) but I have never tried to change the style in this way...
Francesco
TBEditor: a pandapowered app!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Francesco,
First thanks for making this useful project available. I was wondering if you had any idea on how to reduce the height of the toolbar.
Now that I switched to the CTrueColorToolbar class, everything works well - but the toolbar is significantly higher than the regular one - with empty space above and below the icons.
I tried to reduce the size in the .rc file, but I can only cut off some of the space on the bottom. Hence, I don't know how to position the bitmap a big higher - like 2-3 pixels or so.
I already played around with it for a while but was unable to find a solution unfortunately. 
Do you have any idea on how to accomplish that?
Thanks!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Never mind - it took me 2 hours (well, keep in mind that I usually just use the default toolbar), but I finally realized that the SetHeight() function will do it
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
You can get it Here 
changelog:
1.3b - (2005/10/27).
[+] Added check for updates routine
[*] Fixed bug caused by MRU implementation (crash on startup) [*] Fixed bug with 16 colors bitmap (ugly view in preview)
Because of the small amount changes I won't send an update to CP this time (Don't worry I will with the new version on wich i'm working on...)
Bye, Francesco
TBEditor: a pandapowered app!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
i have some question, when i installed the TE1.2, it worked well, but when i install TE1.3 now, i can't run the program, i test in two computer, the first OS is windows2000 professional, the other is windows XP. why?
shuzhonglin@gmail.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
shuzhonglin wrote: i have some question, when i installed the TE1.2, it worked well, but when i install TE1.3 now, i can't run the program, i test in two computer, the first OS is windows2000 professional, the other is windows XP. why?
Well, there aren't enough infos for an answer. By the way, when you try to run TE, there are some error messages? It show up or it crash? Bye, Francesco
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
hi, i run TE1.3 on windows2000 professional Chinese version, it show up error dialog, say "code at 0x004258ea cite memory 0x00000004, this memory address can't be read". and ask you terminate the TE1.3 or debug it. The UI of TE1.3 don't showup. thank you very much!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
shuzhonglin wrote: hi, i run TE1.3 on windows2000 professional Chinese version, it show up error dialog, say "code at 0x004258ea cite memory 0x00000004, this memory address can't be read". and ask you terminate the TE1.3 or debug it. The UI of TE1.3 don't showup. thank you very much!
Umh.. that is really strange. One more question: do you have administrator privileges on that machine? By the way, try this two versions:
V1.3 No Accelerators No MRU
I disabled the two new features loaded at startup: MRU and accelerators. Both of them are not standard in mfc dialog applications so maybe that the problem is due to their implementation. Let me know if one of them can run. Note that I didn't try if the whole TE will works, simply try if it show up... Then you must try on your own if it's all functional 
Bye, Francesco
TBEditor: a pandapowered app!
-- modified at 7:19 Wednesday 19th October, 2005
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Thank you very much. i think maybe the MRU have some problem, i download the V1.3 No Accelerators, it show error like before, when i download the v1.3No MRU, it work well. i use administrator login system.
i have some sugesstion. In TE1.3, when i scan the IDR_MAINFRAME, the Toolbar icon is not clear. but in 1.2, it is very clear.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|