Enhanced statusbar class

Displays horizontally scrolling text, vertically scrolling text, changing fonts for each status bar pane, changing font colors for each status bar pane, changing background colors for each status bar pane, displaying a bitmap banner across the status bar.

I was recently involved in a project that required colors along the status bar (basically, an owner-drawn status bar). Although the requirement stopped at colors in certain panes, I went all out and created a class derived from CStatusBar. My new class (CColorStatusBar) allows for different fonts in each pane, different text colors, different background colors, horizontally scrolling text, vertically scrolling text, diagonally scrolling text (I don't know a use for diagonally scrolling text, but it's fun to watch for a minute), and tiling a bitmap across the status bar - excellent for identifying your software as BETA. I tried to create the new class to be as close to a drop-in replacement for CStatusBar as possible, but in order to customize each pane, I had to force a small amount of extra initialization in CMainFrame (or the owner of the status bar).

To exploit the capabilities of the status bar, double-click on a status bar pane to activate the Status Bar Pane Properties. The dialog will allow you to toggle the status bar banner, transparent text, horizontal and vertical scrolling, window pane font, font color, etc. The most remarkable code block is contained in the header file ColorStatusBar.h and implementation file ColorStatusBar.cpp. Contained in these files are the classes CStatusPaneInfo and CColorStatusBar. CStatusPaneInfo contains information specific to a single status bar window pane. Items such as background color, foreground color, horizontal and/or vertical scrolling, pane font, etc. CColorStatusBar keeps an accounting of the status bar window pane information structures through the use of the CObList. Scrolling is accomplished through the use of a timer and a CPoint which remembers the last upper-left position of the previous DrawText call.

Warning: There is a small amount of additional processing that needs to be accomplished during creation of the status bar in MainFrm.cpp. Basically, the CStatusPaneInfo objects need to be created for use by the OnPaint method in the status bar.

Download project files 35KB



Comments

  • what is a status bar?

    Posted by Legacy on 01/05/2003 12:00am

    Originally posted by: Henz

    Isn't it the 'bar' at the base of an sdi/mdi app?
    Henz

    Reply
  • how to put my dialogbar into status bar?

    Posted by Legacy on 04/30/2001 12:00am

    Originally posted by: alwaysky

    I try to put my dialogbar into status bar....
    but I can't do it

    First of All, I can't decide point to create dialogbar
    ,because there is not a funtion in CDialogBar::Create.

    plz help me

    Reply
  • Windows scrolling text prob....

    Posted by Legacy on 04/15/1999 12:00am

    Originally posted by: Jim Carr

    Hello. This is a great site First of all! ;> I just wanted to know, a few of us are designing a game for windows. We are having a problem with the scrolling text. I'm not the programming person..so all i have is what he told me....this is what he asks....

    "...we're looking for sample code for manual word wrap and manual horizontal autoscrolling text on a direct X surface or embeded in our window (front end)..."

    I'm just wondering if this page is what i'm looking for? Will the code above help me? Can anyone help me?? :) Thanks a ton in advance!!!

    Jim

    Reply
  • A bug with horizontal scrolling fixed

    Posted by Legacy on 04/09/1999 12:00am

    Originally posted by: Zemskov Dmitry

    I noticed a bug with horizontal scrolling:
    1) When the scrolling text is longer than the pane, the tail of the text is not displayed.
    2) When the scrolling text is shorter than the pane, there is a delay between disappearing of the last symbol of the text and appearing of the first symbol of the new text (No one could explain better :-)
    To avoid this I inserted these two lines of code :-) into ColorStatusBar.cpp right before the line 379 ( // if we don't have any visible text ):

    // Ajust the right side of the rectangle so that it bounds the last character in the line
    memDC.DrawText(str, rect, DT_LEFT | DT_CALCRECT );

    Now it seems to work OK.

    Reply
  • FYI: BoundsChecker reports dangling pointers

    Posted by Legacy on 03/08/1999 12:00am

    Originally posted by: Dave Richter

    BoundsChecker v6.0 under both MSVC++ 5.0 & 6.0 reports dangling
    pointers whenever graypen is referenced in ColorStatusBar.cpp.
    By creating the pen on the stack once and using CreatePen() and
    DeleteObject(), I was able to get past these warnings. Just
    thought you might want to know.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: October 28, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT The Financial Services industry is a target today like never before, as attackers leverage different techniques to breach and exploit IT security. In recent months, there have been a number of high profile data breaches and attacks that have impacted the Financial Services industry. By examining the recent attacks, several key trends emerge about what attackers are targeting and how organizations can bolster their defenses. Join us for this …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds