Click here to Skip to main content
16,019,740 members
Articles / Mobile Apps / Windows Mobile

Multiple Toolbars in the PocketPC 2002

Rate me:
Please Sign up or sign in to vote.
4.90/5 (9 votes)
16 Mar 2003CPOL1 min read 116.7K   275   18   22
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)


Written By
Software Developer (Senior) Frotcom International
Portugal Portugal
I work on R&D for Frotcom International, a company that develops web-based fleet management solutions.

Comments and Discussions

 
GeneralUsar com o eVB Pin
JOSE ROBERTO SIQUEIRA17-Aug-04 2:35
JOSE ROBERTO SIQUEIRA17-Aug-04 2:35 
GeneralRe: Usar com o eVB Pin
João Paulo Figueira17-Aug-04 3:09
professionalJoão Paulo Figueira17-Aug-04 3:09 
GeneralQuestion! Pin
kanglue19-Jul-04 2:41
kanglue19-Jul-04 2:41 
GeneralNice Work, Question about Keybord Menu Pin
Fad B17-Apr-04 5:17
Fad B17-Apr-04 5:17 
GeneralGreat article ! Pin
Cedric Moonen3-Jul-03 21:23
Cedric Moonen3-Jul-03 21:23 
GeneralAn good article Pin
ghmay2-Jun-03 17:51
ghmay2-Jun-03 17:51 
GeneralRe: An good article Pin
João Paulo Figueira2-Jun-03 22:03
professionalJoão Paulo Figueira2-Jun-03 22:03 
GeneralRe: An good article Pin
ghmay2-Jun-03 22:57
ghmay2-Jun-03 22:57 
QuestionWhat about vertical toolbars? Pin
aseiden27-May-03 20:22
aseiden27-May-03 20:22 
First of all, thanks very much! I've been trying to figure out how to do this.

Now, call me crazy, but here's what I'd really like: two toolbars, with the first one running along the bottom of the window just like normal, and another one running vertically along the right side of screen (that is, where the scroll bar would normally be).

Anyone have suggestions on the best way to do this?

Thanks very much!


A Seiden

AnswerRe: What about vertical toolbars? Pin
João Paulo Figueira2-Jun-03 10:48
professionalJoão Paulo Figueira2-Jun-03 10:48 
GeneralAll I can say is... Pin
#realJSOP17-Mar-03 23:59
professional#realJSOP17-Mar-03 23:59 
GeneralRe: All I can say is... Pin
João Paulo Figueira18-Mar-03 0:02
professionalJoão Paulo Figueira18-Mar-03 0:02 
GeneralRe: All I can say is... Pin
Roger Allen18-Mar-03 6:23
Roger Allen18-Mar-03 6:23 
GeneralGreat article, but one question ... Pin
Daniel Strigl17-Mar-03 7:24
Daniel Strigl17-Mar-03 7:24 
GeneralRe: Great article, but one question ... Pin
João Paulo Figueira17-Mar-03 7:39
professionalJoão Paulo Figueira17-Mar-03 7:39 
GeneralRe: Great article, but one question ... Pin
Daniel Strigl17-Mar-03 7:49
Daniel Strigl17-Mar-03 7:49 
GeneralRe: Great article, but one question ... Pin
Chopper18-Mar-03 4:05
Chopper18-Mar-03 4:05 
GeneralRe: Great article, but one question ... Pin
João Paulo Figueira18-Mar-03 4:09
professionalJoão Paulo Figueira18-Mar-03 4:09 
GeneralRe: Great article, but one question ... Pin
Chopper18-Mar-03 4:27
Chopper18-Mar-03 4:27 
GeneralRe: Great article, but one question ... Pin
João Paulo Figueira18-Mar-03 4:31
professionalJoão Paulo Figueira18-Mar-03 4:31 
GeneralRe: Great article, but one question ... Pin
Chopper18-Mar-03 4:40
Chopper18-Mar-03 4:40 
GeneralRe: Great article, but one question ... Pin
João Paulo Figueira18-Mar-03 4:45
professionalJoão Paulo Figueira18-Mar-03 4:45 

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

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