Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top