Click here to Skip to main content
Click here to Skip to main content

Multiple Toolbars in the PocketPC 2002

By , 16 Mar 2003
 

Sample Image - CeMultiBar.jpg

Introduction

This article presents a solution on how to implement multiple toolbars in a PocketPC 2002 application. The idea came from an exchange in the Embedded/Mobile message board where this functionality was sought, especially the Pocket Word-like management of the toolbar ( http://www.codeproject.com/script/comments/forums.asp?forumid=13695#xx435722xx).

Implementation

The demonstration project (illustrated above) has two toolbars that are hidden or shown through commands in the main command bar. Note: the demo project is meant to illustrate the working of the toolbars, so no functionality has been implemented on them.

Both toolbars are created in CMainFrame::OnCreate without the WS_VISIBLE style. When the user issues a command to show a toolbar, the window is shown and RecalcLayout is used to reposition everything inside the frame.

void CMainFrame::OnToolbarFormat() 
{
    CToolBarCtrl& rToolBar = m_wndCommandBar.GetToolBarCtrl();

    m_bFormat = !m_bFormat;

    m_wndFormat.ShowWindow(m_bFormat ? SW_SHOW : SW_HIDE);
    RecalcLayout();

    rToolBar.CheckButton(ID_TOOLBAR2, m_bFormat);
}

Note that there are no ON_UPDATE_COMMAND_UI handlers in the demo. Checking and unchecking of the main command bar buttons is done explicitly in this message handler.

A final note on CToolBar: I found no proper way to have it draw the top border, so I derived the dummy class CCeToolBar with the single purpose of drawing the top border. If there is a better way to achieve this, please post it here.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Joao Paulo Figueira
Software Developer Primeworks
Portugal Portugal
Member
João is a partner at Primeworks, a company that develops remote database access software for Windows Mobile. He also works for Frotcom, a company that develops web-based fleet management solutions.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralUsar com o eVBmemberJOSE ROBERTO SIQUEIRA17 Aug '04 - 2:35 
GeneralRe: Usar com o eVBmemberJoão Paulo Figueira17 Aug '04 - 3:09 
GeneralQuestion!memberkanglue19 Jul '04 - 2:41 
GeneralNice Work, Question about Keybord MenumemberFad B17 Apr '04 - 5:17 
GeneralGreat article !membercedric moonen3 Jul '03 - 21:23 
GeneralAn good articlememberghmay2 Jun '03 - 17:51 
GeneralRe: An good articlememberJoão Paulo Figueira2 Jun '03 - 22:03 
GeneralRe: An good articlememberghmay2 Jun '03 - 22:57 
QuestionWhat about vertical toolbars?memberaseiden27 May '03 - 20:22 
AnswerRe: What about vertical toolbars?memberJoão Paulo Figueira2 Jun '03 - 10:48 
GeneralAll I can say is...memberJohn Simmons / outlaw programmer17 Mar '03 - 23:59 
GeneralRe: All I can say is...memberJoão Paulo Figueira18 Mar '03 - 0:02 
GeneralRe: All I can say is...memberRoger Allen18 Mar '03 - 6:23 
GeneralGreat article, but one question ...memberDaniel S.17 Mar '03 - 7:24 
Thanks for the great article Wink | ;) , but how can I disable the red "tab-and-hold" circle of the toolbar buttons and show some tooltips like the CCeCommandBar does?
 
Daniel Wink | ;)
---------------------------
Never change a running system!
GeneralRe: Great article, but one question ...memberJoão Paulo Figueira17 Mar '03 - 7:39 
GeneralRe: Great article, but one question ...memberDaniel S.17 Mar '03 - 7:49 
GeneralRe: Great article, but one question ...memberChopper18 Mar '03 - 4:05 
GeneralRe: Great article, but one question ...memberJoão Paulo Figueira18 Mar '03 - 4:09 
GeneralRe: Great article, but one question ...memberChopper18 Mar '03 - 4:27 
GeneralRe: Great article, but one question ...memberJoão Paulo Figueira18 Mar '03 - 4:31 
GeneralRe: Great article, but one question ...memberChopper18 Mar '03 - 4:40 
GeneralRe: Great article, but one question ...memberJoão Paulo Figueira18 Mar '03 - 4:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 17 Mar 2003
Article Copyright 2003 by Joao Paulo Figueira
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid