Link to home
Start Free TrialLog in
Avatar of enigmasolutions
enigmasolutions

asked on

How to stop MS Word Ribbon disappearing when using tOLEContainer and switching focus

VB Answers also welcome.

We are using Delphi with OLE to create a screen like outlook's email screen (when you create a new email).  Outlook uses OLE to embed MS Word as the editor.  In outlook the To, CC, BCC and Subject feilds appear above the message body.  The MS word ribbon appears accross the top.

We got everything working almost perfectly!  See this link https://www.experts-exchange.com/questions/26808908/tOLEContainer-CreateOleObject-tIDHTMLMessageBuilder-and-MS-WORD-as-HTML-Email-Editor-with-email-stored-retrieved-from-dataset.html.

We have a word document embedded in a TOleContainer with the following code to create/show:
            OleContainer.CreateObject('Word.Document',False);
            OleContainer.DoVerb(ovShow);

THE PROBLEM: We have other Delphi controls (eg: TDBEdit etc) on the form (for the purpose of Email To, Subject & a few other things).  Whilst the word document is active the word toolbars/ribbon are shown, but when we click away into one of the Delphi controls the toolbars/ribbons disappear until we call OleContainer.DoVerb(ovShow) again.  The problem is the dissappearance of the ribbon when the tOLEContainer loses focus - because the ribbon is aligned to top everything jumps up (which looks really bad).  I want to create a header section that works like outlook & keeps the ribbon visible whilst enterign the subject.

QUESTION: Is there any way we can do any of the following
a) permanently have the toolbars/ribbons show whilst the word document doesn’t have focus?  
b) create a header section with our objects that are embedded inside WORD (so they don't take focus away from word)???

I doubt there is a solution to this.  I mean even if you embed WORD in Excel the WORD ribbon dissapears when you click on a cell in Excel (ie remove focus from WORD).

BUT Somehow Outlook makes it work - points go to anyone who can explain how.

FYI - I have a cludge to this.  Basically take a screenshot and paste the result into an image at the top of the form when the tOLEContainer loses focus.  For added effect darken it.
ASKER CERTIFIED SOLUTION
Avatar of enigmasolutions
enigmasolutions

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of enigmasolutions
enigmasolutions

ASKER

No one has come up with a better solution.
If anyone needs help with this then get in touch with me.