This message contains graphics. If you do not see the graphics: Graphic Version.
 
Getting MS Word Like Features, Feedback On Offline Archive

Offline TX Forum Archive

First up this week, I would like to ask you for your feedback about the downloadable version of your TX Discussion Forum. Please see the article from last week's newsletter if you are not sure what I am talking about.

I have received a few e-mails telling me what you find good and bad, but by far not enough. There have been more that 500 downloads of the compressed archive and therefore I would have expected to have heard a little bit more from you! :-) So, to those 500+ people who have downloaded the offline TX Discussion Forum Archive, how are you coming on with it?

Do you like the ability to get an overview of all the messages on one page, where you can click on the subject and get the entire message?

Or would you prefer to have everything in one text file, like the first version?

I would love to hear your feedback! Thanks in advance for writing to me.

New Tutorial: How To Implement MS Word Like Features. Part I

This week we are going to start a new tutorial in Tips and Tricks. We are going to show you how you can add many of the features to your TX based app that you find in MS Word. We have chosen this topic, as a lot of the support questions we get go something like: "I want to implement that xyz feature from MS Word in my TX based app. How can I do that?"

Over the next few weeks, you can expect to receive instructions on how to implement one MS Word like feature in each newsletter. This week were are going to build a humble 'word count' feature.

So, down to the nitty-gritty: What is 'word count'? 'Word count' is simply a statistical feature that shows how often certain characters, words or lines etc. have been typed by the user.

Certain statistics are easy to work out. Say for example, you want to simply count the number of pages in a TX document - TX Text Control provides you with a property to do exactly that. However, working out other statistics is not quite that simple.

For example, you wanted to find out how many lines were present in a certain TX document. Here you are going to need quite a bit of programming knowledge, as the number of lines is dependent upon several factors, including the page width. Thankfully, TX Text Control provides this functionality and allows you to find out how many lines are present by calling a message.

All of the counting algorithms required for our statistics examples are pretty similar. Thus we shall only present one of them here - namely the most complicated - the infamous 'word count':

Private Function CountWords() As Integer Dim Count, Pos, OldPos As Integer Dim data() As Byte Dim LastChar As Integer data = Form1.TXTextControl1.SaveToMemory(1) If Form1.TXTextControl1.Text <> "" Then LastChar = 10 For i = 0 To UBound(data) If Not IsSpaceRet(data(i)) And Not IsControlChar(data(i)) Then If IsSpaceRet(LastChar) Then Count = Count + 1 End If LastChar = data(i) Next i CountWords = Count End Function

So, what is going on here?

Firstly, the data is loaded into memory in plain text using SaveToMemory.

Then we simply go through every letter in this buffer and check whether it is a CR, LF or space.

If we do not find any of these three characters and the letter that we are currently checking is not a control character, then we know that they are letters from a word.

Should the last letter be a CR, LF or space then we augment the counter by one, as we know that we are at the beginning of a word.

Download the entire VB code from below to see this algorithm in action.

Worthwhile Programmer Site

One of the TX Text Control Webmaster's many duties is to track down web pages where we can publish a link to www.textcontrol.com.development. This week, we came across a magnificent site. In fact, we would even goes as far as to say that this is probably the Internet's most complete source of free downloadable programming files, source codes, utilities, Visual Basic, Delphi, C/C++, graphics, Windows, Java, and other tools for programmers and developers. There are well over 8200 files and 2300 links organized in an easy-to-find format! You really must NOT miss this site.

Visit them at: http://www.programmersheaven.com


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

© 2019 Text Control GmbH. All Rights Reserved.