Creating a StatusBar Control with VFP 8

isual FoxPro 8 offers full support for themes and the XP style look. Unfortunately the Windows Common Control OCX that ships with VFP 8 doesn’t support this same look. This article describes how to build a status bar control that looks and behaves like an XP style status bar, using several new features of VFP 8.

One of the really cool features of VFP 8 is its ability to work with Windows Themes and provide fully themed user interfaces. Some people say that XP themes are nothing more than fancy window dressing that suck up CPU cycles and screen real estate, but once you start using themes it’s hard to look back on the classic Windows interface and not have it feel archaic.

Visual FoxPro 8 now supports fully themed controls for all of its own native controls. Unfortunately, the same is not true of the Common Controls ActiveX controls (MSCOMCTL.OCX) that many of us use to build enhanced user interfaces for our users. Even when using a Manifest file (see sidebar), the various controls such as the TreeView, ListView, StatusBar, ProgressBar and others do not inherit the Windows XP look and feel and instead render in the ‘classic’ style, which looks a little bit funky when you run them inside an otherwise themed application. To me this is most noticeable with the StatusBar control, which gives away a non-XP compliant application immediately.

It’s too bad we have a nice XP style interface for our forms but are stuck with StatusBars, TreeViews, and ListViews that are stuck in the ‘classic’ era.

What’s Wrong with MSCOMCTL StatusBar?
The StatusBar ActiveX control has always had a number of problems. The most obvious is that the StatusBar does not properly show the sizing grip even when you enable the sizing grip in the control. Well, it does?sometimes. If you define the control in code and add it to the form and run it in an MDI form inside of the main VFP or another Fox application window, then it works. But in a Top Level Form the sizing grip never shows. Many of us have gotten around this by utilizing an image and embedding it on the StatusBar (see Figure 1).

Using a VFP-Based wwStatusBar Class
To work around this problem, I decided to ditch the ActiveX control and write a new VFP class that simulates a StatusBar using VFP code. The control can render in XP style, in ‘classic’ style, and in a modified classic style that mixes XP and classic styles. It doesn’t mimic all the functionality of the ActiveX control, but implements most of the important functionality in an easy to use container class. Figure 2 shows a VFP application running with the wwStatusBar control in XP themes mode.

Some Limitations
Keep in mind that this is a minimalist implementation that isn’t completely event enabled. If you change certain properties of the wwStatusBar object, make sure that you always call RenderPanel() or RenderPanels() to refresh the status bar display properly. RenderPanels() is required anytime the sizes of panels change.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

©2023 Copyright DevX - All Rights Reserved. Registration or use of this site constitutes acceptance of our Terms of Service and Privacy Policy.