4.3.17 Text formatting

Text formatting

Traditionally, text formatting isn't a strength of Visual FoxPro. The Text Formatting foundation classes try to add a little more flexibility in this area. Results seem to be moderate.

 

Font Combobox

Class

_cbofontname

Base class

ComboBox

Class library

_format.vcx

Parent class

_combobox

Sample

...\Samples\Vfp98\Solution\Toolbars\format.scx

Dependencies

_base.vcx

The Font Combobox foundation class is a relatively trivial class. It simply lists the names of all the fonts that are installed on the system. The class doesn't have any special methods or properties. To react to user selections. you have to use the regular methods and events such as InteractiveChange().

Fontsize Combobox

Class

_cbofontsize

Base class

ComboBox

Class library

_format.vcx

Parent class

_combobox

Sample

...\Samples\Vfp98\Solution\Toolbars\format.scx

Dependencies

_base.vcx

The Fontsize combobox goes along well with the Font combobox described above. It displays all the available font sizes for a certain font. This class has two custom properties (nLargestFont and nSmallestFont) that are used to define the range in fontsize. You can also use the FillList() method to automatically set the available fontsizes for a certain font. The font name must be passed as a parameter like so:

THISFORM.cboFontSize.FillList("Arial")

If you use the Fontsize combobox and the Font combobox in combination, you should call the FillList() method from the Font combobox's InteractiveChange() method.

Format Toolbar

Class

_tbrediting

Base class

Toolbar

Class library

_format.vcx

Parent class

_toolbar

Sample

...\Samples\Vfp98\Solution\Toolbars\format.scx

Dependencies

_base.vcx

The Format Toolbar foundation class is a toolbar similar to those found in many applications. It provides standard formatting options such as choosing fonts and font sizes, changing font style to bold, italic and underlined, and choosing different colors. The class uses other foundation classes such as the Font combobox and the Fontsize combobox. Figure 45 shows how this toolbar looks in an undocked position.

Figure 45. A standard formatting toolbar as used by many applications.

The toolbar automatically applies the chosen settings to either the active control in the active form, or to all controls in the active form. Which one of those options is true can be specified through the nAppliesTo property (1=current control; 3=all controls).

RTF Controls

Class

_rtfcontrols

Base class

Container

Class library

_format.vcx

Parent class

_container

Sample

...\Samples\Vfp98\Solution\Toolbars\format.scx

Dependencies

_base.vcx

This container class looks somewhat similar to the Format Toolbar described above. It uses the Font combobox and the Fontsize combobox as well as buttons for bold and italic fonts. However, no behavior is attached to any of these controls, so you have to add it yourself.

 



Advanced Object Oriented Programming with Visual FoxPro 6. 0
Advanced Object Oriented Programming with Visual FoxPro 6.0
ISBN: 0965509389
EAN: 2147483647
Year: 1998
Pages: 113
Authors: Markus Egger

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net