Sep 29, 2006

A resize grip on a Foxpro form

As a visual clue that a form can be resized, many forms have a 'resize grip' in the lower right corner. Visual Foxpro does not have native support for showing a resize grip on a form. But that won't stop us, we can make our own!

Over here you can download a zip file containing a resizer class. It's based on a container class and constructs it's own grip shape (Windows XP style). Just drop the class on a form and add This.resizer1.resize to the forms resize method. An example form is also included, which looks like this:

Sep 2, 2006

Images in a VFP grid class

In the listgrid class in this blog, it is possible to have different images in the cells of the same column in a grid. This is done using the DynamicCurrentControl feature and works great if there are only a few images.
When you have a lot of images to show, it seems like a bad idea to add even so much image controls to the grid column.
Luckily, there is another way to do the same. I found out about this here while working on the listgrid class. It works by creating a container class which is used as the control for the column. In the container class itself, you create an access method for the backstyle property of the container (open the class, go to the Class pad in the Foxpro menu, select Edit property/method and check the Access Method for the backstyle.
Then, in the access_method itself, you put code like This.picture = Mytable.Image, where Image is a text field in Mytable used as the grid recordsource. The text field contains the names of the images to use, which can be found on disk along the VFP path.

You can download an example here as a zip compressed file (9.6 Kb). Run the example form and look at the code in the example class. This is how it looks: