TX B2B application example
A couple of weeks ago, we briefly touched on the subject of automatic form population using TX Text Control and a database, by mentioning the Rosebrock Text 32 sample application. In the meantime, we have set up an interactive demonstration, illustrating how easy it is to grab data from your database, create your document and then send the whole thing by e-mail. The professional version of our software product gives you the ability to bridge the gap between traditional, paper-oriented documents, and up-to-date e-mail and web technologies. By clicking on the link below, you will be taken to a page where you can test drive the "quotation-via-e-mail" feature of The Imaging Source Office Suite.
TX Top Tip: Track Changes
Many customers want to make am MS Word-like word processor using TX. Word has many features which have no reference to a TX property, but many of these features can be implemented on your own. The following example shows how to create your own Word-like "Track Changes" function. If you enable this feature via a menu item, all inserted text is marked red and the the deleted text is not deleted but marked red as well and stroked through.
Visual Basic:
Private Sub TXTextControl1_KeyPress(KeyAscii As Integer)
If mnuTrackChanges_Highlight.Checked Then
LockWindowUpdate (TXTextControl1.hwnd)
If KeyAscii = Asc(vbBack) Then
If TXTextControl1.SelStart > 0 Then
TXTextControl1.SelStart = TXTextControl1.SelStart - 1
TXTextControl1.SelLength = 1
TXTextControl1.ForeColor = vbRed
TXTextControl1.FontStrikethru = True
End If
Else
TXTextControl1.SelText = Chr(KeyAscii)
TXTextControl1.SelStart = TXTextControl1.SelStart - 1
TXTextControl1.SelLength = 1
TXTextControl1.FontUnderline = True
TXTextControl1.ForeColor = vbRed
TXTextControl1.SelStart = TXTextControl1.SelStart + 1
End If
TXTextControl1.SelLength = 0
KeyAscii = 0
LockWindowUpdate (0)
UpdateWindow (TXTextControl1.hwnd)
End If
End Sub
Delphi:
procedure TForm1.TXTextControl1KeyPress(Sender: TObject; var Key:
Char);
begin
If Highlight1.Checked Then begin
LockWindowUpdate (TXTextControl1.hwnd);
If (Key = Chr(8)) Then begin
If (TXTextControl1.SelStart > 0) Then begin
TXTextControl1.SelStart := TXTextControl1.SelStart - 1;
TXTextControl1.SelLength := 1;
TXTextControl1.ForeColor := clRed;
TXTextControl1.FontStrikethru := 1;
End;
end Else begin
TXTextControl1.SelText := Key;
TXTextControl1.SelStart := TXTextControl1.SelStart - 1;
TXTextControl1.SelLength := 1;
TXTextControl1.FontUnderline := 1;
TXTextControl1.ForeColor := clRed;
TXTextControl1.SelStart := TXTextControl1.SelStart + 1
End;
TXTextControl1.SelLength := 0;
Key := Chr(0);
LockWindowUpdate (0);
UpdateWindow (TXTextControl1.hwnd);
End;
end;
How it works:
The code above is very simple. If the user presses a key and the "Hightlight" menu item is selected, the inserted character is selected, marked red and underlined. If the user pressed the back space key, the character to the left is selected and marked as above, but is additionally stroked through. Because the user shouldn't see that the character is selected and then marked red, a LockWindowUpdate call is placed before and after the piece of code that performs the selection. Note that the above code doesn't handle the delete key. The example is just a basic version and needs some more coding to get it working in a real-life app, but I think you get the idea.
Short 'n Sweet Tip: Add a ComboBox to a ToolBar
- Add a Toolbar (from the MS Common Controls collection), named tb, to the form.
- Add three buttons to the Toolbar, the second button's style being Placeholder, and the other two's - standard.
- Add a ComboBox, named cbox, to the form;
- Add the following code to the form's Load event:
Private Sub Form_Load()
tb.Buttons(2).Width=2000 'or as needed
cbox.Width=tb.Buttons(2).Width 'or less, of course
cbox.Top=tb.Buttons(2).Top
cbox.Left=tb.Buttons(2).Left
End Sub
- Press F5 to run the Project. The cbox combo should be placed into the placeholder button.
- Add more placeholder buttons and controls to the form and experiment with similar codes. The controls will preserve their properties and any methods and events they have.
- The Resize event on this form should have the same code as for Load.
Free Advertising For Your TX Text Control Application
As mentioned in previous editions of the TX Text Control Newsletter, we are giving you the opportunity of free advertising for your TX Text Control product on our web site.
All we ask is that you send us your text, as well as a few screenshots detailing how TX Text Control was part of the solution and within about two days of receiving this material, we will add your story, along with your logo and your name to our sample application pages.
So far we have had a terrific response to our request for sample TX Text Control applications, but I am know there are thousands of other TX apps out there - all of which should be added to the sample app page. Come one, send me a short text, explaining how you used TX Text Control to implement your application and you get free advertising for this product on our web site. You've got nothing to lose!
Best regards
The Newsletter Team