Solved

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

Posted on 2011-02-25
2
1,906 Views
Last Modified: 2012-05-11
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 http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_26808908.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.
0
Comment
Question by:enigmasolutions
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
enigmasolutions earned 0 total points
ID: 35178438
Well it seems that no-one has a better solution.

Anyway the screen shot idea worked and whilst a nasty cludge the user experience is quite good (except when MS word crashes).
0
 
LVL 1

Author Closing Comment

by:enigmasolutions
ID: 35178442
No one has come up with a better solution.
If anyone needs help with this then get in touch with me.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question