This message contains graphics. If you do not see the graphics: Graphic Version.
 
Customized dictionaries, Headers and Footers

Customized dictionaries and thesaurus files in VSSPELL

So, another week has gone by and you have had a little more time to play with VSSPELL. How are you coming along? Did you know that VSSPELL offers a powerful utility that allows you to create custom-built dictionaries and thesaurus files that you may distribute with your application? At design-time, building a custom dictionary (or thesaurus) is as simple as launching the included DictUtil.exe utility (ThesUtil.exe, respectively) and "dumping" the specified dictionary file (.DCT) into a text file with a single button click.

Then once in the .TXT format, you may open and edit the file with any word processing editor to build up to five different custom libraries. The Dictionary Utility allows you to set read-only or read/write permissions to any dictionary file you create with the simple selection of a checkbox, allowing your end-users to add new words (or not) to your dictionary. Once you are finished modifying the .TXT file, you can use the Utility to convert it back to the .DCT format and distribute it with your application. Customized dictionaries and thesaurus files are particularly helpful for words and phrases specific to certain industries. So those of you who having been asking about getting you legal and medical dictionaries to work in TX Text Control should have no trouble at all.

Perhaps you would be willing to tell the rest of the world about your experiences? Don't forget that you can discuss your experiences with other TX Text Control Users on the TX Discussion Forum.

Top TX Tip: Adding Headers/Footers to your Document

With version 7 of TX Text Control the possibility of adding headers and footers to your documents has been implemented. A new kind of marked text field has also been added - the page number field. It is inserted in a header or footer and automatically displays the current page number. Some users mentioned that they would prefer a footer that also displays the total number of pages ("Page X of Y"), but they don't know how to realize that because there is no special field.

The following example shows how to display the total number of pages in your footer:

Visual Basic:

Have a look at the headers example and add a menu item. Add the following code to the click event:

Private Sub mnuPageNo_Click() With TXTextControl1 .HeaderFooterSelect txHeader .Text = "Page: of " .SelStart = Len("Page: ") .FieldInsert ("") .FieldType(.FieldCurrent) = txFieldPageNumber .SelStart = Len("Page: x of ") .FieldInsert "" fieldNo = .FieldCurrent noPages = .CurrentPages .FieldText = Str(noPages) .HeaderFooterSelect 0 End With End Sub

Add two global variables called noPages and fieldNo. Initialize noPages with -1.

Finally, add the following code to the TX's OnChange event:

Private Sub TXTextControl1_Change() If (noPage <> -1) And (TXTextControl1.CurrentPages <> noPages) Then noPages = TXTextControl1.CurrentPages TXTextControl1.HeaderFooterSelect txHeader TXTextControl1.FieldCurrent = fieldNo TXTextControl1.FieldText = Str(noPages) TXTextControl1.HeaderFooterSelect 0 TXTextControl1.Refresh End If End Sub

Delphi users:

The code above is very short and as the Delphi Headers example matches the VB one almost word-by-word, you should be able to port the above code to Delphi on your own.

What does the code do?

First of all, you need to insert a header. The code assumes that a header has already been inserted, so there might be some need for error checking. Also, some users might want to add the "page x of y" line to the footer and not to the header. Simply replace txHeader with txFooter then. Now let's take a look at the page number menu handler:

The first line set the text of the header to "Page: of ". Then a page number field is inserted between "Page: " and " Of". Finally, a usual field is inserted at the end of the line. Its text is set to the number of currently inserted pages. Now, when the contents of the TX change, we need to check if the number of pages has changed as well. This is done in the OnChange handler. If the number of pages is not equal to our variable noPages, a page has just been inserted. So, change the field in the header and update noPages. And that's all there is to it!

Errata to last week's newsletter

As several of you have mentioned, in the newsletter last week, there was an important link which did not work in Microsoft Internet Explorer. As 80% of you use MSIE, very few of you were able to get the intended web content, as all you saw when you clicked on the links was a MSIE 404 file not found error. Here is the revised link for the sample TX application page.

Sorry for the inconvenience.

Project Analyzer makes your code shine

What if you could automatically optimize, document and measure your source code? Or graphically browse through the code that your colleagues wrote? Now you can. Project Analyzer is a complete code review and quality control tool for Visual Basic. Get rid of unused code and turn your source into HTML in a minute. Free demo.

http://www.aivosto.com/project/tx.html


Best regards

The Newsletter Team

Text Control GmbH respects your online time and privacy. We only send this newsletter to TX Text Control customers and people who have signed up to receive it. However, if you would prefer not to receive future issues of the newsletter, you may unsubscribe at any time. If you received this newsletter forwarded from a colleague or friend, you may wish to subscribe directly.

Sent to: N/A.

Imprint | Unsubscribe | Subscribe

© 2000 Text Control GmbH. All Rights Reserved.