Contents
MultiText VBX v1.20	(Unregistered)

MultiText VBX (mtext.vbx) is a non-editable text box capable of displaying up to 32K of text using different fonts, font styles, and colors. Hypertext words may be embedded, and will cause an event to occur if clicked upon, as well as altering the cursor to a hand whilst over them. Portions of text may be selected with the cursor and copied to the clipboard, either as straight text or with formatting codes included. Text may be entered either by setting a property, or by directly loading text from within files. If loading text from a file, the text may be in either rich text format (RTF) or MultiText format (MTF).

One application for MultiText is to display text of a mathematical or scientific bias. The font can be switched at any point to include Greek characters from the symbol font, and can also include super- and sub-script text, as well as fractions.

Contents

Text formatting

Hypertext

Properties

Methods

Events

Rich-Text Format

Distribution

Release Notes

Registration

Quick Reference Chart


Text formatting

All of the features which alter how the text is displayed inside MultiText are set by embedding escape codes. This escape code is by default the open square bracket, but this may be altered by changing the SpecialChar property. After the escape code is a single character which instructs MultiText how to display the text which follows. To actually display the escape character, use one after the other, i.e. [[.

For instance to change the text to bold at a certain position would just require inserting [B . All text that follows will now be bold until [b is next encountered, where the bold text is turned off.

For a list of the escape codes, select on the category list that follows:

Fonts

Font styles

Colors

Special


Formatting:Fonts
Text formatting : Fonts

The letters on the left below should be placed after the escape character (default open square bracket) to change the font to that stated to the right.

A	Arial

C	Courier

N	Courier New

F	Fixedsys

M	Modern

E	MS Sans Serif

e	MS Serif

R	Roman

P	Script

L	Small Fonts

Y	Symbol

Z	System

T	Terminal

t	Times New Roman

W	Wingdings

a	UserFont (defined in UserFont property)


Formatting:Font Styles
Text formatting : Font styles

The letters on the left below should be placed after the escape character (default open square bracket) to change the font style to that stated to the right.

B	Bold on.

b	Bold off.

I	Italic on.

i	Italic off.

S	Strikethru on.

s	Strikethru off.

U	Underlining on.

u	Underlining off.


Text formatting : Colors

The letters on the left below should be placed after the escape character (default open square bracket) to change the color to that stated to the right. System default colors may be used.

0	ForeColor0 property, default &H000000& (black).

1	ForeColor1 property, default &H0000FF& (red).

2	ForeColor2 property, default &HFF0000& (dark blue).

3	ForeColor3 property, default &H00FF00& (light green).

4	ForeColor4 property, default &HFF00FF& (purple).

5	ForeColor5 property, default &HFFFF00& (light blue).

6.	ForeColor6 property, default &H00FFFF& (yellow).

7	ForeColor7 property, default &H808080& (grey).

8	ForeColor8 property, default &H008000& (dark green).

9	ForeColor9 property, default &HFFFFFF& (white).


Text formatting : Special

Superscript text can be started by following the escape character with a D. To turn this off use the d character.

Subscript text can be started by following the escape character with a G. To turn this off use the d character.

Fractions can be displayed in proper form, by use of the f character after the escape code. For instance to display 1/3 the notation would be

[f1/3

Note: Within the content of the fraction, other escape characters will cause unpredictable results and should not be used.

To turn the font, font style, and font color back to normal, use the q character after the escape code.


Hypertext

Within the text displayed, words may be tagged as hotspots. As the cursor is moved over these, the appearance of the cursor will change to a hand. By clicking with the left mouse button whilst over a hotspot, a hot event will be caused, which passes back the index number of the word and the actual word itself.

To mark a word as a hotspot, insert an escape code (default open square bracket) followed by a g. The word that follows is now a hotspot.

The end of the word is either a space, or another escape character. The hotspot word will look no different from the rest of the text, but by inserting escape codes before and after the word it is possible to change the color, style, or actual font of the hotspot word.

Note: The maximum number of hotspots that can be embedded in the text is 100, and any more that this will be ignored. It is recommended that the HilightEnabled property be set to false when using hotspots, as a faster event will occur when clicked upon.


Properties

Standard properties are BackColor, Borderstyle, DragIcon, DragMode, Enabled, FontName, FontSize, Height, Index, Left, Mousepointer, Name, Scrollbar, TabIndex, Tag, Top, Visible, Width.

Note: FontSize is the height of the character cell in pixels and not point sizes, thus the values will need to be higher than their corresponding point size. If the mousepointer property is set to anything other that 0-Default then the cursor will not change to a hand when over a hotspot.

Custom properties are:

AutoPaint

This property can be set to either true (default) or false. If set to false the text box will not be refreshed when new text is loaded, nor if another window is placed over it and then moved off. To force a repaint, set the ForcePaint method to true.

BoxLines

This read-only, run-time property contains the maximum number of lines of text that will be seen in the MultiText window using the current fontsize.

ForeColor0 - ForeColor9

These correspond to the escape codes 0 to 9, as detailed in the text formatting topic.

Highlight

This color property represents the background color of the selected region of text. The default is the system setting.

HilightEnabled

This Boolean flag either enables or disables the selecting of text with the mouse. It is recommended that this is set to false if the feature is not required.

HiTextColor

This color property represents that color of text that is within a selected region. The default is the system setting

Lines

This run-time, read-only property contains the number of lines of text.

LoadLength

This numeric long value contains the number of characters to be read in from file during a LoadFile or LoadRtf method. If set to 0 then the file will be read in to the end, up to a maximum of 32760 characters for loading with LoadFile and 65500 characters for ImportRtf.

LoadStart

This numeric long value contains the start position within a file to be read in using the LoadFile method. If set to 0 then loading will resume from the beginning of the file.

NumHots

This run-time, read-only property contains the number of hotspots in the text.

ScrollMax

This run-time, read-only property contains the maximum value for the scroll position, regardless of whether a scroll bar is actually visible.

ScrollPos

This run-time value contains the current scroll position. Changing it will cause the scrollbar to change to the new position.

SpecialChar

This property contains the ANSI character code for the escape character. By default this is 91 which represents the open square bracket.

Text

This contains the actual text, with embedded format codes, that will be shown in the MultiText window. The maximum number of lines of text that may be stored is 700.

UserFont

This property can contain an extra font name of your choice. To use the font within the text, either select UserFont from the FontName property, or insert escape character a in the body of the text to change the font. The maximum length of a font is 19 characters.


Methods

Below are the methods applicable to MultiText at run time.

Copy

By setting to TRUE, the selected region of text will be copied into the clipboard.

CopyFormat

By setting to TRUE, the selected region of text, along with any formatting codes within that region, are copied to the clipboard.

ForcePaint

By setting this to true, a repaint of the mtext box will occur. It will also reset the AutoPaint property back to True. This will usually be used in conjunction with the AutoPaint property.

ImportRTF

By setting this to the full file name of an RTF file, the file will be loaded and converted into MultiText format (MTF). LoadStart and LoadLength properties are also used to determine where in the file the data is loaded from. Click here for a more detailed explanation.

LoadFile

By setting this to the full name of a file, the text property will be replaced by the contents of the file. Characters are read in from position LoadStart, and LoadLength characters are read in. If LoadLength is set to 0 then all characters up the end of the file are loaded, up to a maximum of 32760. The maximum number of lines of text that MultiText can store is 700.

ScrollDown

By setting to TRUE the text will scroll down one line. This will occur even if the scrollbar property is set to false.

ScrollUp

By setting to TRUE the text will scroll up one line. Thus will occur even if the scrollbar property is set to false.


Events

The standard events are Click, DblClick, DragDrop, DragOver, MouseDown, MouseMove, and MouseUp.

One custom event exists :

Hot

This event is fired when the user clicks upon a hotspot. Two parameters are passed back. HotIndex is an integer and contains the hotspot number. The first hotspot word in the text is 0, the next is 1 etc. HotWord contains the actual word pressed (or the first 150 characters of it).


Distribution

If MultiText is to be distributed as part of an application then the file MTEXTRT.VBX must be used, but it must be renamed to MTEXT.VBX on the distribution disk.

Under no circumstances may the design time version be distributed within an application. However, the design time version may be distributed as shareware so long as the accompanying files are distributed with it.

Only registered users of MultiText may distribute the run time version with their applications, or use it commercially. The run time version is only available to registered users.


Registration

To be able to distribute MultiText with your applications, or to use it commercially, or if you just want to continue to use MultiText with a clean conscience, you must first register. Remember, this is just an evaluation copy only. Once registered you will receive the run time version which may be distributed by you in your applications, with no restrictions on the volume sold. The registered version will not place any extra text to the bottom of imported RTF files.

The cost of registering for MultiText is 15 United Kingdom pounds or 25 United States dollars, made payable to Steve Bannister. Please state if you would prefer to receive your copy on disk or sent by e-mail. If you decide on e-mail, you will get a faster reply and will qualify for free upgrades as they are made.

I can also upload the files using FTP if you have a site running an FTP daemon, although I will not upload to an anonymous FTP site.

Please send your cheques or international money orders, and details on which method you would like to receive the files, to :

Steve Bannister

41 Milton Street

Northampton

NN2 7JG

ENGLAND

If you have any queries/comments/bug-reports you can also e-mail me at

s.bannister@open.ac.uk


Release Notes
Release Notes & Known bugs

1.20

New RTF Converter. Files in rich-text format can be directly loaded from disk into MultiText where they are convered into MultiText format (MTF).

New UserFont property. One font of the users choosing may be used.

New AutoPaint property: Ability to suspend normal re-paints of the mtext window.

New ForcePaint method: Ability to force a re-paint of the mtext window.

Bug Fix: CopyFormat method not always copying all data selected.

Bug Fix: Escape code [q not restoring color.

Improved help file.

1.19

Bug Fix: Mousepointer was not being restored from a hand back to an arrow after new text loaded from result of clicking a hyperlink.

1.18

First general release

Known Bugs

Scrollbar is always white.

Italics in some fonts get chopped at the right ends.


Quick Reference
MultiText Quick Reference Escape Character Chart

Fonts	Font Styles

A	Arial	B	Bold on

C	Courier	b	Bold off

N	Courier New	I	Italic on

F	Fixedsys	i	Italic off

E	MS Sans Serif	S	Superscript on

e	MS Serif	s	Superscript off

M	Modern	U	Underline on

R	Roman	u	Underline off

P	Script

L	Small Fonts	Special

Y	Symbol	D	Superscript on

Z	System	d	Superscript off

T	Terminal	f	Fraction

t	Times New Roman	G	Subscript on

W	Wingdings	g	Hypertext

a	UserFont	q	Restore to defaults

Color

0	ForeColor0 (default black)

1	ForeColor1 (default red)

2	ForeColor0 (default dark blue)

3	ForeColor1 (default light green)

4	ForeColor0 (default purple)

5	ForeColor1 (default light blue)

6	ForeColor0 (default yellow

7	ForeColor1 (default grey)

8	ForeColor0 (default dark green)

9	ForeColor1 (default white)


Rich-Text Foramt
Rich-Text Format

RTF files may be loaded into MultiText using the ImportRtf method at run-time only. The entire RTF file must be loaded, if LoadLength or LoadStart are used to 'chop' part of the file it will cause a run-time error. You may concatenate RTF files together and use LoadStart and LoadLength to extract the file part required.

Only the features supported by MultiText will be used from the RTF file. Any other features will not be seen and should still work successfully. If possible it is advisible to keep with MultiText's capabilities.

To incorporate hyperlinks you need to double underline the words, and if you require them in a different color you should do this also. Some RTF writers may define more colors than MultiText can store (which is 10), even if you are not using all these colors. If you choose a color for a hotspot and it does not show then the color has been given a definition number greater than can be used. The way round this is to use a different color that will be shown, then optionally change the corresponding ForeColor property to the color you actually want it to appear as. If this operation is done one after the other then no flicker will occur. In future versions I will get round this by having a hotspot color so there will be no need to color your own hotspots.

Once an RTF file has been loaded the ForeColor properties will change to reflect the color table specified within the RTF file.

RTF files may contain the font specified in the UserFont property.

When loading an RTF file, the maximum length of the file is 65,500 bytes, although the length of the decoded text used within MultiText must not exceed 32,760 bytes. The encoding method used in RTF often increases the length of a straight text file by a considerable amount.

The shareware version will add a message to the bottom of the imported text stating the version is unregistered.