How to be more productive with www.textcontrol.com.development - part 2 of 6
This week: The Source Code Library
As we confirmed a few weeks ago in the support forum, a major missing features of the old web site was the lack of sample applications and freely available source code. Actually, the word 'lack' is not quite correct, as there were many sample applications on the old web site, but they were almost impossible to find. One of the main reasons for this, is that the old web site was not designed with sample applications in mind, hence, when a suitable section was added, it became very difficult to find.
Sorted into a number of (we hope) logical rubrics are all the sample applications that have ever been written for TX Text Control. The source code library, as we have baptized this section of the site, is a simple three level tree structure. The top level, being the general rubrics, the second level being the title of the sample application and finally, the third level being the actual article, with downloadable source code .ZIP file where applicable.
Please go and try it out for yourself. Click on the above link and then on the rubric 'Internet'. You will then be greeted by several articles about using TX Text Control to program internet applications. Choose one of them and the entire article will appear before your eyes.
You can see the general format of the articles. At the top there is a brief summary of who wrote the article, when it was written, the programming languages that can use the sample and finally the number of times that this particular article has been viewed. This is a very valuable statistic so that you can judge the popularity of any specific article.
At the bottom of each article page, you can see a section called 'related articles', which summarizes the other articles in the same rubric as you are currently in. Simply click on one of the titles in order to jump to the rest of that article.
As we urged you last week, so that we can continue to improve on your experience of our web site, please comment on the new layout. Use this thread.
The History Of TX Text Control
Still reminiscing on our ten-year birthday, we have just published a history of the development of TX Text Control. It documents every version ever sold, ranging from 'Office Forms' through 'VisualWriter' to the current 'TX Text Control'. The text is pretty long, so we recommend that if you want to read it all, you print it out:
Related to this story is the history of the TX Text Control software packaging. Take a look at the following page to view some high-resolution images of the various TX Text Control boxes. Again, their progression illustrates how TX Text Control started off as a single, small DLL that has made its way through 16-bit DLL and VBX versions to today's professional edition with its ActiveX and Class Library.
Top TX Tip: Scrolling in TX - part 2
This week we will continue with our article about scrolling in a search context.
What we have now is usable, but we can still improve upon it.
Currently, when we are stepping through the found results we use TX Text Control's built-in search feature to highlight the found word. But if we do the scrolling manually, we can move the highlight right to the top line on the screen; thus the user can easily see what has been highlighted.
Here is how it works. We have simply removed the HideSelection calls from the Load and Unload handlers so TX Text Control does not interfere with our custom scrolling. Then after the selection has been set in the Button handlers, the Sub MovePosToFirstLine is called given the input position of the selection as a parameter.
Here is the VB code:
Private Sub MovePosToFirstLine(nPos As Long)
Dim lResult As Long, lr As LineRect
' Get the absolute line number of the position
lResult = SendMessage2(Form1.TXTextControl1.hwnd, TX_LINEFROMCHAR,
If lResult = 0 Then
lr.lLineIndex = lResult - 1
' Now query the offset of this line
lResult = SendMessage(Form1.TXTextControl1.hwnd, TX_GETLINERECT,
Form1.TXTextControl1.ScrollPosY = lResult
First of all, the absolute line that contains the given position is determined. This is done with the TX_LINEFROMCHAR message. If no error occurs, the result is assigned to the lLineIndex member of the LineRect structure. This structure is sent to TX Text Control via the TX_GETLINERECT message which returns the offset of the line in twips to the very top of the page. This value is the value needed for the ScrollPosY method to scroll right to the found line.
The only tricky thing is the use of the SendMessage API call, but as a Windows user, you should at least have heard of it. In the next version of TX Text Control it will not be necessary to use SendMessage here, because TX 9.0 will come up with a bunch of new methods.
This tip can be used in other cases, as well. For example, if you want to be able to scroll to a given chapter in your application and you have marked the beginning of the chapter with a field, then you scroll right to that chapter by supplying the FieldStart value to the MovePosToFirstLine sub.
The Newsletter Team