The user interface is a very important part of your application. After all, it's the only part people will ever see. The classes in this category are meant to help you create better interfaces.
Class |
_folder |
Base class |
Container |
Class library |
_controls.vcx |
Parent class |
Container (base class) |
Sample |
...\Samples\Vfp98\Solution\Ffc\getproject.scx |
Dependencies |
None |
This class is not meant to be used in applications designed for end users. It has been created for developer tools where the user/programmer is required to create new projects.
Class |
_mouseoverfx |
Base class |
Custom |
Class library |
_ui.vcx |
Parent class |
_custom |
Sample |
...\Samples\Vfp98\Solution\Ffc\mousefx.scx |
Dependencies |
_base.vcx |
The MouseOver Effects class allows you to create objects that behave similarly to "hot activate" buttons as used in the Office 97-style toolbars. Those buttons are flat, and the typical 3-D effect appears only when the mouse hovers above the object. If you want to use the MouseOver Effects object for command buttons, you need to use a little trick. Instead of using a real button, you simply create an image. The button's 3-D border is actually drawn manually by the MouseOver Effects object.
To draw a temporary 3-D border around an object (you can draw it around any object, not just buttons), you simply call the HighlightMe() method and pass a reference to the current object like so:
THISFORM.oMouseOverEffects.HighlightMe(THIS)
This code should be executed in the MouseOver() event of the object you want to highlight.
The object has a number of properties that can be used to influence the look and feel of the temporary border. You can set the border width through the nHighlightWidth property. By default it is set to 2, but I recommend setting it to 1, which makes your object look more like the typical Office 97 objects. You can also specify the shadow color as well as the highlight color through the iHighlightColor and iShadowColor properties. Finally, you can set a margin using nMargin, so there is a little space between your object and the temporary 3-D border.
Class |
_resizable |
Base class |
Custom |
Class library |
_controls.vcx |
Parent class |
_custom |
Sample |
...\Samples\Vfp98\Solution\Forms\cresize.scx |
Dependencies |
_base.vcx |
The Resize Object class automatically adjusts object sizes when a form is resized. Similar to most automatic resizing classes, the Resize Object does a sub-optimal job. There simply isn't a generic way to resize Visual FoxPro forms because there is no resize information in any of the objects. So the Resize object has to do all of this by itself, and the best it can do is make some educated guesses. Actually, those guesses aren't that impressive. However, making things more advanced would be extremely difficult and hardly worth the effort. Creating individual resizing algorithms is much easier.
The Resize object is invoked from the Resize() event of a form. You simply call the AdjustControls() method of the Resize object and hope for the best.
Class |
_thermometer |
Base class |
Form |
Class library |
_therm.vcx |
Parent class |
Form (base class) |
Sample |
...\Samples\Vfp98\Solution\Ffc\therm.scx |
Dependencies |
None |
The Thermometer class displays a progress bar as shown in Figure 46. It can be used to inform the user about the progress of long tasks. Using this class is trivial—simply instantiate it and display it. On instantiation you pass the caption of the thermometer, which will be displayed in the first line of the dialog. Later on, during the process, you send Update() messages to the thermometer to display the current state. Once you are done, you send a Complete() message and you're done. Here's a simple example:
LOCAL loTherm
loTherm = NewObject("_thermomenter","_therm.vcx","","My Application")
loTherm.Show()
SELECT Customer
loTherm.iBasis = Recc()
LOCATE
SCAN
loTherm.Update(Recn(),"Scanning record #" + Trans(Recn()))
* More code goes here…
ENDSCAN
loTherm.Complete()
In this example, I use the Thermometer to display progress while I'm scanning the Customer table. Normally, the basis of all calculations is 100, representing 100%. This means that a value of 50 passed to the Update() method actually represents 50%. However, the basis can be set to a different value. If it were set to 200, for instance, a value of 50 passed to the Update() method would represent 25% (because 50 is 25% of 200). In the example above, I set the basis to the number of records. The basis can be defined through the iBasis property. In the scan loop, I constantly update the thermometer by calling the Update() method. I simply pass the current record number as the first parameter. Because I've set the basis, the thermometer automatically calculates the correct percentage. I also pass a message to be displayed, which will actually appear in the second line of the dialog (see Figure 46).
Figure 46
. A thermometer informs the user about the progress of an operation.Once I'm done scanning the customer table, I send a Complete() method, and the thermometer goes out of scope and disappears.