I have visual studio 2008, and want to build an GUI application that on the left side has a frame that can be minimized like the firefox bookmark sidebar. So my questions are: 1) What type of project do I need? 2) What controls actually make up the sidebar. 3) What do I make the main frame so that I can resize it when the sidebar is open. A example would also be cool. Thanks in advance. CP
views:
45answers:
3It looks like a TaskPane (CTaskPane ) attached to a simple SDI frame window (taking into account firefox is doing a lot of things custom with their own toolkit (I think, and I've been known to be wrong)
Download the MFC VS2008 feature pack (with the new UI controls) and the feature pack samples and have a look at some of the sample projects (for example "TaskPane" and "VisualStudioDemo"
Though often maligned, as Max pointed out, MFC provides CTaskBar
, which is designed for exactly this sort of thing. What you have inside it looks a lot like a CTreeCtrl
(or CTreeeView
) with an associated CImageList
to display the icons for the bookmarks. Resizing the mainframe while the sidebar is open is handled automatically. To create a project that includes this, select the "Visual Studio" application type (after choosing "MFC Application").
Just as a note for the record, I'm reasonably certain that FireFox does not actually use an MFC CTaskBar. FireFox's sidebar is quite limited by comparison -- it only allows one sidebar with one pane in one position. CTaskBar supports multiple task bars, that the user can rearrange at will, each of which can have multiple tiled and/or tabbed panes (and, for example, the user can not only move a complete task bar by dragging, but also drag panes between task bars, drag a pane out on its own to become a separate task bar, etc.
Note that nearly all of this is handled internally by MFC -- you simply create window classes for storing and drawing data in the panes, and it handles things like keeping track of where a pane is at the moment.