This message contains graphics. If you do not see the graphics: Graphic Version.
 
Delphi 5, TX Archive HowTo, Top TX Tip

TX Text Control Newsletter Archive

As we mentioned last week, please do not forget to have a look at the newly designed TX Newsletter Archive. We have put all the past editions of this newsletter into a database, which enables you to search for the information that you - the TX Text Control user - needs to have. Over the coming months, this archive will grow and grow giving you an valuable source of information.

Say for example you wanted to read all the past tips of the week, you would simply go to the search page and enter "Top TX Tips" (without the quotation marks) and you would be returned with a list of all the past tips we have published. Or, take another example: Say you are a savvy Delphi hacker and need all the Delphi articles that we have been published.

Enter "Delphi". On hitting SEARCH you would be returned with a list of Delphi articles. What could be simpler? If your prefer, you can naturally browse the archive by edition. Take a look at the "Browse TX Newsletter" feature by scrollign down the previous page. There you will have access to newlstters dating back to 1999.

Top TX Tip of the Week: Search&Replace

We still get many emails from customers who don't know how to do a customized search through the contents of a Text Control. They say: "The built-in dialog is rather nice, but it's not really what I need!"

As of version 6.0 there is a method available that makes Search&Replace routines a piece of cake!

In the following example, the string "TX" is replaced with "New Text" and the inserted text is marked red. Read all about it:

1) Visual Basic:

Const SEARCHUP = 1 Const MATCHCAS = 4 Const NOHILITE = 8 Const NOMSGBOX = 16 Private Sub Command1_Click() Dim pos As Long Dim oldSt, oldLen As Integer TXTextControl1.FormatSelection = True oldSt = TXTextControl1.SelStart oldLen = TXTextControl1.SelLength pos = TXTextControl1.Find("TX", 0, NOMSGBOX) While (pos <> -1) TXTextControl1.ForeColor = vbRed TXTextControl1.SelText = "New Text" pos = TXTextControl1.Find("TX", pos + 1, NOMSGBOX) Wend TXTextControl1.SelStart = oldSt TXTextControl1.SelLength = oldLen TXTextControl1.SetFocus TXTextControl1.Refresh End Sub

2) Delphi:

Const SEARCHUP = 1; MATCHCAS = 4; NOHILITE = 8; NOMSGBOX = 16; procedure TForm1.Button1Click(Sender: TObject); var pos : LongInt; oldSt, oldLen : Integer; begin TXTextControl1.FormatSelection := True; oldSt := TXTextControl1.SelStart; oldLen := TXTextControl1.SelLength; pos := TXTextControl1.Find('TX', 0, NOMSGBOX); While (pos <> -1) do begin TXTextControl1.ForeColor := clRed; TXTextControl1.SelText := 'New Text'; pos := TXTextControl1.Find('TX', pos + 1, NOMSGBOX); end; TXTextControl1.SelStart := oldSt; TXTextControl1.SelLength := oldLen; TXTextControl1.SetFocus; TXTextControl1.Refresh; end;

The first parameter of the Find method is the string that should be searched for. The second parameter is the input position from where the search should start. The last parameter is the sum of several switches. Refer to the manual to find out more about these switches. If you want to find all occurrences of a string in the document, you have to start the search again from the point where the last occurrence has been found until the word is no more found. That's how the code above works. More from us next week!

Featured TX Reseller: ComponentSource

ComponentSource is the world's leading supplier of components for software developers. Their online catalog includes free evaluations, and the ability to purchase and immediately download 1000's of software components. They offer free technical support, corporate accounts, source code escrow, toll-free numbers, etc. Visit their Web site and download free components worth over $500

http://www.componentsource.com/

Forwarding this newsletter to discussion groups

Last week, we have had many recipients of this newsletter ask whether they may forward it or use it in some way. Feel free to forward the newsletter, or any portion, to whatever newsgroup, mailing list, or online-service forum you wish, however you must include the copyright and newsletter-subscription information that you'll find at the bottom of the newsletter. If you want to use the newsletter in some other way - such as posting it at a Web site or including a portion in a printed document, please contact us, by hitting the reply button.


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.