Page 1 of 1

Tab key in RichEdit Control

Posted: Wed Jan 03, 2007 1:29 am
by reinaldocrespo
Hi.

Is there any way to allow the use of the [tab] key to work while in a richtext edit control?



Reinaldo.

Posted: Wed Jan 03, 2007 6:21 pm
by James Bott
Reinaldo,

This is the same problem I mentioned in the other thread. The tab key is trapped in TControl and used to move to the next control. So, you will have to subclass TRichEdit and create a new keyChar() method where you can trap the Tab key before it gets to TControl.

James

Code: Select all

METHOD KeyChar( nKey, nFlags ) CLASS TRichEdit

   if ::lReadOnly
      return 0
   endif

   // Add this section. JB
   if nKey  == VK_TAB
      return 0
   endif

   Super:KeyChar( nKey, nFlags )

   ::PostMsg( FM_CHANGE )

   if ::lHighlight
      ::PostMsg( FM_HIGHLIGHT )
   endif

return nil