![]() |
|
QA: How to add dropdown buttons in the CCeCommandBar?
By Louis-Xavier Vignal, February 01, 2002.
QuestionI have created a menu bar using the MFC class CCeCommandBar. Now, I would like to insert a button that uses the TBSTYLE_DROPDOWN style. How can I do it and then receive the TBN_DROPDOWN notification message sent by the toolbar control when the user clicks the button? AnswerTo add dropdown style to a certain button you should delete it, add TBSTYLE_DROPDOWN style and insert again. To show dropdown menu you should handle TBN_DROPDOWN notification message in OnNotify function. Here is a sample based in a dialog: It adds a dropdown arrow to the second button in the toolbar. Finally, in order to receive the TBN_DROPDOWN notification, override the OnNotify message handler. You can show a popup menu in the handler. Sample projectYou can download sample dialog based project with dropdown feature - DropDownSample.zip (40 Kb). Related resources:
DiscussDiscuss this article. Here you can write your comments and read comments of other developers. |
|||||||||||||||||||||