This message contains graphics. If you do not see the graphics: Graphic Version.
 
VSSPELL Update, How To Alter KeyEvents, TX Humour

VSSPELL Update: More Easy Spell Checking For Your TX App

As I am sure that you remember, a few months ago, we presented VSSPELL to you, as an easy solution to add advanced spell checking to your TX Text Control Application.

After several weeks serious testing and evaluation, an issue surfaced in which many of you have had difficulty with the underline feature of VSSPELL. The underlined words (i.e. words which were spelt incorrectly) were not being displayed correctly.

Well, the issues have been resolved with the release of VSSpell Build # 6.0.18. Please see the VSSpell web site for complete details of the fix (link below). Summarized the following have been corrected:

  1. Improved support for TX Text Control (wiggly underline).
  2. Added LockWindowUpdate when drawing/erasing TX Text Control wiggly line (less flicker).
  3. Not firing Changed event on TXText control.
  4. Improved drawing of wiggly underline for regular and RTF controls.

We are most grateful to the friendly people at VideoSoft to have updated their great spell checking component. Why not download the very latest version from:

http://home.componentone.com/products.aspx?ProductCode=1&ProductID=79

Top TX Tip: Altering KeyEvents

During the last couple of weeks, we have had an increasing number of customers ask us whether it is possible to change the behaviour of key inputs. For example, when you press the TAB key, a tabulator is inserted. Using TX Text Control, this can be changed, so that instead of a tabulator appearing on the screen, the letter 'A' for example is inserted at the current cursor location.

How? That is the topic of this week's TX Top Tip!

Many customers have already tried implementing such behaviour using sub-classing. However, this is somewhat overkill, when a far simpler solution is just a matter of a few lines of code.

The normal KeyDown event is triggered from OLE and is then treated by Windows messages. For example, some special keys - such as the TAB and cursor keys - do not even reach the sub-classing routine, as TX Text Control does not forward them.

Compare this with the standard TXTextControl1_Keypress event. With this event you can get these notifications and react and process them appropriately. As the KeyAscii parameter is passed as standard, you can use this and change it and thus control the behaviour of TX Text Control.

If you set the parameter to Asc("a") for example, it does not matter which key is pressed, a small 'a' will always be inserted into the current position of the cursor. Here is the Visual Basic code:

Private Sub TXTextControl1_KeyPress(KeyAscii As Integer) KeyAscii = Asc("a") End Sub

Using this very same technique, it is pretty easy to create a development environment.

As default, TX Text Control replaces any selected text with a character that is entered. In a development environment or similar text editors, this behaviour is certainly not desirable. For example, when you press TAB in your favourite programming editor after you have selected a certain amount of text, what happens? Well, if you are using anything that the cheapest editors, the selected text will be indented.

This can be implemented using TX Text Control with the following brief code:

Private Sub TXTextControl1_KeyDown(KeyCode As Integer, Shift As Integer) Dim curInputPos As Variant Dim nSelStart As Integer, nSelLength As Integer If KeyCode = 9 Then ' A Tab was pressed - check if the start of the selection ' is the start of a row nSelStart = TXTextControl1.SelStart nSelLength = TXTextControl1.SelLength ' Temporarily set the cursor to start of selection TXTextControl1.SelLength = 0 curInputPos = TXTextControl1.CurrentInputPosition ' And set it back TXTextControl1.SelLength = nSelLength ' Beginning of row If curInputPos(2) = 0 And nSelLength > 0 Then If Shift And vbShiftMask Then RemoveTabs nSelLength Else InsertTabs nSelLength End If ' We handled the event. ' Tell TX to ignore it by setting the KeyCode to 0 KeyCode = 0 End If ' Set the selection back TXTextControl1.SelStart = nSelStart TXTextControl1.SelLength = nSelLength End If End Sub

First, we look at the KeyDown event, as it is the Shift value that interests us. Next we check to see whether the KeyCode is the same as the tabulator. If it is, we can see whether we are currently at the beginning of a line.

All we have to do now is to move all the selected text when the TAB is pressed. To check this, we simply use the CurrentInputPosition property.

If this returns zero to the ArrayIndex 2, the selection starts at the beginning of a line and then depending upon whether the shift key is pressed, tabs will be inserted or deleted before the selected line.

That is all there is to it! As ever, any questions, comments etc to support@textcontrol.com We are delighted to offer you any more assistance, should you require it.

Humor: 10 Ways To Tell You've Been Online Too Long

  1. Someone at work tells you a joke and you say "LOL" out loud.
  2. Three words: Carpal Tunnel Syndrome.
  3. You have to get a 2nd phone line just so you can call Pizza Hut.
  4. You watch TV with the closed captioning turned on.
  5. You type messages to people while you are on the phone with them at the same time.
  6. You wake up in the morning and the first thing you do is get online before you have your first cup of coffee.
  7. You type faster than you think.
  8. Your "buddy list" has over 100 people on it.
  9. You double-click your TV remote.
  10. Your dog leaves you.

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.