|
|
Choice Bar control
I thought it was a nice abstraction that relieves the programmer from messing with button frames, hover effects and layout code - so I wrote a similar control for WTL.
The control is divided into 3 parts: The Default button, the button grid
and the Custom button area. The Default and Custom buttons are optional.
How to use itTo add a Choice Bar control to your frame window, create a new derived control or handle theWM_DRAWITEM in your parent window.
A few sample controls are included in the source file. To add the sample Palette Chooser control shown above as a popup in your application, add a reference to the CPaletteSelectCtrl control class.
Add the following reflection macro to your main message map:
Then in a tool button click event, or where you wish to display the bar,
add this...
The control resizes itself to its preferred size, but uses the supplied rectangle
to position itself. As a true popup bar, it destroys itself when it looses focus even
though this feature can be disabled.
When something is selected, you will receive a WM_NOTIFY notification
with the CHBN_ITEMSELECTED code.
The control sends out a few more notifications to allow you to further customize
each control.
The Choice Bar does not include a matching dropdown button. You can choose to create your own, or, if you display the control from a toolbar button, use the dropdown capabilities of the toolbar. Source Code DependenciesMicrosoft WTL 3.0 LibraryUseful LinksDundas software MFC ToolboxDownload Files
Written by Bjarke Viksoe. Article submitted 7/14/2001. To the top
|
|||