Proof of concept
The following is just a quick proof of concept, so please don’t expect coding brilliance or even real great encapsulation in the class library. With that having been said, I decided yesterday that I would like to create something similar to the System Tasks panel that is shown on the left-hand side of Windows Explorer (when the folders panel isn’t open). Now, that System Tasks panel uses a bunch of cool gradients, handles XP Theme colors and even fades the panels out when they are collapsing… none of which is in this proof of concept. Never-the-less, I like what I was able to come up with in a very short amount of time using pure Visual FoxPro.
The content area of the panels in my creation is actually a grid, so the panels can be data driven. I create a cursor with the following structure…
CREATE CURSORcrsPanel1 (imgfile c(254), capt c(75), selected L, command c(254))
The imgfile field is the name of an image file that has been compiled into the exe, though you could use a fullpath for that if you have an images directory that you distribute. The next field, capt is used to designate what the caption should be for a particular item in the panel. Selected is just a boolean field that I use to control the underlining (via the column’s DynamicFontUnderline) of the items as the mouse passes over them. And, finally there is a command field that will hold the VFP script to be executed (via the ExecScript function) when the user clicks on an item. You can find where I have built the cursors that data drive the 3 panels for the example I’ve included in the download in the Example form’s load event. Pretty straight-forward stuff.
Possible use for the scrollable container
One of the improvements to this that I’ve been thinking of is using the Scrollable Container I created for an earlier blog entry to allow the container that is holding the panels (cparentpanel class) to provide a scrollbar when the stacked panels exceed the length of the form. But, I figure that it is good enough as is to at least put it out there and get some feedback. I recevied an email from Jonathan Clark some weeks back suggesting that something like the interface that is used at http://www.live.com/ would be a pretty cool thing to do with VFP. Eventually, I will encapsulate the expand and collapse functionality and some of the other features that most panels have these days so that it is seperate from the UI portion of this. Once that is done, creating controls and interfaces that provide this sort of look and feel will be a piece of cake.
XP Themes – possible future project
While I’m on the subject of things I’d like to do, I’d also like to get a handle on XP Themes as well. Though the gradients that themes use are difficult to mimic, it would be nice to get closer to the ability to implement some form of XP Themes on most the controls and custom classes we are creating. VFP’s out-of-the-box UI already looks antiquated, and since the MS Fox Team doesn’t appear to have this sort of thing on their radar at the moment, I think it would serve us well to do something about it. I can certainly draw most anything using GDI+, so maybe there is some things we can do to shore this up a little.
Download and screen shot
I’ll stop myself with that lest I ramble for an hour or two… Here’s the download link and a screen shot of VFP Panels in action. NOTE: When you run the example you’ll notice that I allow the panels to be hidden (click the X in the top right-hand corner of the panel you want to hide). In order to re-show a hidden panel, right-click on the dark blue container and select the hidden panel from the Show context menu.
Download VFPPanels.vcx Source and Example (220 KB approx.)