Creating a StatusBar Control with VFP 8

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:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as

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

Sitemap