Home Technical Writings

Underlining words with Red-wave line format in Tx Text Control:

TxTextControl is good third party editor control comes with various formatting options. It is also an easy to use off-the-shelf third party editor that can be plugged into any windows application without much code to be written. As in the case of new-age editor controls, it is often desirable to have a spell-checker integrated with the TxTextControl that can display the spelling errors with a red-wave underline as it is done in Microsoft Word and other similar editor. There are few third-party spell-checker that can be integrated with the TxTextControl easily and which can give us similar spelling error notification.
But sometimes we find that we already have a spell-checker (either third-party or our own) and we need to integrate that with the TxTextControl and display the error with the red-wave underline, or use red-wave underline for some other use. This can also be achieved with the TxTextControl with a little bit of work-around and using undocumented messages. This article explains the same in a very trivial manner. Eventthough, I have not covered the entire spell-checking logic and all the scenarios that are to be handled for a spell-checking, this article can be a start to achieve the same.
The formatting of the underling is done by

          Selecting the word or group of words for which the formatting has to be changed
          Sending a message to the textcontrol object to set the format.

Looking through the TxTextControl’s messages, we come across the message TX_SETFONTATTR with Hex Value 0x482. Apart from the message we need the LPARAM , the formatting value to be sent to the control.

Again going through the list of format attributes supported by TxTextControl, we come across two defined constants FA_UL_REDZIGZAG and FA_UL_NOREDZIGZAG with values 0x00010000 and 0x00020000 respectively.

  1 2 3 4  >

 

 

© 2008. UnitedPro Software Solutions Pvt. Ltd