0

I use EmbeddedWB in edit mode and need to insert tab (4 *  ) when user presses TAB key. I've trapped OnKeyDown event and did the following:

if (Key = VK_TAB) then
begin
EditDesignerMsg.InsertHTML('    ');
EditDesignerMsg.EmbeddedWB.SetFocusToDoc;
end;

The problem is that this moves focus from the control to another control as usual with TAB in Windows. I want to keep the focus within the web browser control and only move away to previous control if the user presses Shift + TAB.

How can this be done?

Coder12345
  • 3,431
  • 3
  • 33
  • 73
  • 1
    Using ` ` to insert whitespace is extremely bad practice in HTML. Use CSS (paragraph indent) or a pre-styled block instead. – Andreas Rejbrand Dec 07 '13 at 15:40
  • 1
    To extend my previous (now deleted) comment, you can inspire in [`this post`](http://stackoverflow.com/q/10470053/960757). – TLama Dec 07 '13 at 22:12

1 Answers1

1

Thanks to TLama, I've managed to do this by intercepting CM_DIALOGKEY message and applying the message handler which inserts specified HTML code at that point and then eats the message by setting AMessage.Result := 1;. More details how to implement this message handler can be found here:

Intercept TAB key and suppress it

Community
  • 1
  • 1
Coder12345
  • 3,431
  • 3
  • 33
  • 73