This message contains graphics. If you do not see the graphics: Graphic Version.
New Web Site Being Developed, Scrolling Tip

New Web Site Being Developed

Last time, we mentioned that we would be retiring the current TX Text Control web site. Indeed, it is now more than two years old. As we are currently developing the new version, we hoped that readers would make suggestions in our discussion forum.

Thank you to those of you who have contributed your ideas. Your thoughts are very much appreciated. We have already begun incorporating some of your suggestions into our new site.

For example, following the discussion in the forum, it would seem eminent that you would like to see more sample applications. We are very happy to let you know that a complete source code library has now been written and will be a central part of the new web site.

One of our main design criteria is to keep the new web site sleek. There are therefore no bloated, bandwidth-hogging, graphics nor gratuitous flash animations. In fact, the web site has become a slimline text-delivery engine, filled to the brim with content that will help you, the developers who use TX Text Control, create advanced applications with even more ease.

This week, we have just implemented a site-wide search engine, which not only allows searches to be conducted over the entire site, but also, specific searches of only certain areas. Say for example, you were looking for a specific sample application - you will be able to select 'sample applications' from a combo box to the right of the main search text input box and then just search in the sample applications area.

There has also been a completely new support forum implemented. The new version adds a whole multitude of features to what has become the most popular section of our web site. We are looking forward to serving you even better with this new forum.

Top TX Tip: Scrolling in TX - Part 1

In this week's Top TX Tip column, we are dealing with scrolling. TX Text Control does most of the work for you, but we still get quite a few support queries about the subject.

First of all, take a look at the size archive below. Then you will see that we wrote a short sample that simply searches a text for a given word/phrase. This is not of much use you will say, because TX already has a built-in search dialog. This is of course true, but the sample is only meant to show how to scroll to a certain position in the document.

The new find dialog searches the entire document in one step and saves the found positions in an array. The end user can then click from one found position to the next and back (just like one would expect from a search dialog).

Here is the VB code for the search sub:

Private Sub Search() Dim pos As Integer Dim options As Integer Dim n As Integer options = 24 ' Suppress message box and do not highlight found text If bCase Then options = options + 4 End If nResults = 0 pos = Form1.TXTextControl1.Find(szWhat, 0, options) While pos <> -1 nResults = nResults + 1 pos = Form1.TXTextControl1.Find(szWhat, pos + 1, options) Wend If (nResults > 0) Then ReDim nPositions(nResults) pos = Form1.TXTextControl1.Find(szWhat, 0, options) n = 0 While pos <> -1 nPositions(n) = pos n = n + 1 pos = Form1.TXTextControl1.Find(szWhat, pos + 1, options) Wend End If Label2.Caption = "Found " & Str(nResults) & " matches" nCurrent = -1 End Sub

This code is not very efficient, because it searches the document twice (once it know how many matches are found and once to store the positions), but it's just for demonstration... We are sure that you can think up a hundred ways to make the code more efficient :-).

nPosition is a global variable that stores the positions and nCurrent is a variable that holds the number of the currently displayed result.

Now, all we have to do is make TX Text Control scroll - that is pretty easy. When the "Next match" button is pressed, the selection is set to the stored position and the word is highlighted. And now comes the trick. TX will scroll the selection automatically into the visible area, but only if the HideSelection property is set to False (by default it's True). If this is not done, TX will not scroll, because it doesn't have the focus.

But how do I get a certain line to appear at the top of the scroll window? This is a lot harder to do and so we will cover that next week. It takes some math and some TX message calls to be accomplished. So, if you are interested, be sure to get the next newsletter.

BTW, by all means, feel free to drop us a line here in the support department, if you need any help.

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

© 2020 Text Control GmbH. All Rights Reserved.