tags:

views:

111

answers:

1

Hi,

I'm developing a Word addin in Delphi, on a task pane I put a Virtual treeview, in the OnFocus event of the Virtual Treeview I call Word to insert a file into the current Word document via method ActiveDocument.Range.InsertFile, but this operation will put the input focus back to the Word document window, so finally in this event handler I call TreeView.SetFocus to set the focus back to the treeview, this works except that the Word document window still has a unblinking caret shown.


I tried sending the WM_KILLFOCUS windows message to the handle of the Word document window but no luck. Any hints? Thank you in advance!

A: 

You can try to call Application.BringToFront or Application.MainForm.BringToFront.

The_Fox
Hi The_Fox,Thanks, both these two ways do not solve the probolem, maybe because the form is embedded in the Word main window. And the Application.MainForm property is nil.
Edwin
Try to call BringToFront on your form containing the TreeView.
The_Fox
Hi The_Fox,Thank you anyway, but this does not work also...
Edwin