Click here to Skip to main content
11,631,340 members (73,723 online)
Click here to Skip to main content

Multiple Toolbars in the PocketPC 2002

, 16 Mar 2003 CPOL 91.7K 236 18
Rate this:
Please Sign up or sign in to vote.
Handling multiple toolbars - Pocket Word-style.

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)

Share

About the Author

João Paulo Figueira
Software Developer Frotcom International
Portugal Portugal
I work on R&D for Frotcom International, a company that develops web-based fleet management solutions.

You may also be interested in...

Comments and Discussions

 
GeneralUsar com o eVB Pin
JOSE ROBERTO SIQUEIRA17-Aug-04 2:35
memberJOSE ROBERTO SIQUEIRA17-Aug-04 2:35 
GeneralRe: Usar com o eVB Pin
João Paulo Figueira17-Aug-04 3:09
memberJoão Paulo Figueira17-Aug-04 3:09 
GeneralQuestion! Pin
kanglue19-Jul-04 2:41
memberkanglue19-Jul-04 2:41 
GeneralNice Work, Question about Keybord Menu Pin
Fad B17-Apr-04 5:17
memberFad B17-Apr-04 5:17 
GeneralGreat article ! Pin
cedric moonen3-Jul-03 21:23
membercedric moonen3-Jul-03 21:23 
GeneralAn good article Pin
ghmay2-Jun-03 17:51
memberghmay2-Jun-03 17:51 
GeneralRe: An good article Pin
João Paulo Figueira2-Jun-03 22:03
memberJoão Paulo Figueira2-Jun-03 22:03 
GeneralRe: An good article Pin
ghmay2-Jun-03 22:57
memberghmay2-Jun-03 22:57 
QuestionWhat about vertical toolbars? Pin
aseiden27-May-03 20:22
memberaseiden27-May-03 20:22 
AnswerRe: What about vertical toolbars? Pin
João Paulo Figueira2-Jun-03 10:48
memberJoão Paulo Figueira2-Jun-03 10:48 
I've been trying, but they do not seem to work as expected. Cry | :((
GeneralAll I can say is... Pin
John Simmons / outlaw programmer17-Mar-03 23:59
memberJohn Simmons / outlaw programmer17-Mar-03 23:59 
GeneralRe: All I can say is... Pin
João Paulo Figueira18-Mar-03 0:02
memberJoão Paulo Figueira18-Mar-03 0:02 
GeneralRe: All I can say is... Pin
Roger Allen18-Mar-03 6:23
memberRoger Allen18-Mar-03 6:23 
GeneralGreat article, but one question ... Pin
Daniel S.17-Mar-03 7:24
memberDaniel S.17-Mar-03 7:24 
GeneralRe: Great article, but one question ... Pin
João Paulo Figueira17-Mar-03 7:39
memberJoão Paulo Figueira17-Mar-03 7:39 
GeneralRe: Great article, but one question ... Pin
Daniel S.17-Mar-03 7:49
memberDaniel S.17-Mar-03 7:49 
GeneralRe: Great article, but one question ... Pin
Chopper18-Mar-03 4:05
memberChopper18-Mar-03 4:05 
GeneralRe: Great article, but one question ... Pin
João Paulo Figueira18-Mar-03 4:09
memberJoão Paulo Figueira18-Mar-03 4:09 
GeneralRe: Great article, but one question ... Pin
Chopper18-Mar-03 4:27
memberChopper18-Mar-03 4:27 
GeneralRe: Great article, but one question ... Pin
João Paulo Figueira18-Mar-03 4:31
memberJoão Paulo Figueira18-Mar-03 4:31 
GeneralRe: Great article, but one question ... Pin
Chopper18-Mar-03 4:40
memberChopper18-Mar-03 4:40 
GeneralRe: Great article, but one question ... Pin
João Paulo Figueira18-Mar-03 4:45
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   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150723.1 | Last Updated 17 Mar 2003
Article Copyright 2003 by João Paulo Figueira
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid