I am just experimenting with Add-ins and have written an Add-in which simply displays a dialog that reacts to various different elements as they are selected in a drawing.
What I would like to do now is have the dialog come to the foreground when the Inventor gets focus, ie. the user switches to another application and then switches back to Inventor. Is there an event I can subscribe to that fires when Inventor gets focus back?
thanks
Gav
Solved! Go to Solution.
Solved by jeff.pek. Go to Solution.
HI Guy -
There isn't such an event in the Inventor API.
You could probably do this with a low-level Windows message hook.
Why do you want to do this? Doesn't it behave this way already? What are you seeing?
Jeff
That will be why I was struggling to find one then. :o)
What I have is a dialog (not a modal dialog) that I am using as a custom toolbox, so when Inventor opens this extra dialog is displayed along with the standard dialogs. It shows various buttons depending on what is selected in the drawing.
This dialog is just a standard Windows form so when an application switch is made it loses focus along with Inventor. The problem is when Inventor gets its focus back my dialog is unaware that it needs to be brought forward again.
I may be going about this the wrong way though as I've only been doing this for a couple of days.
Gav
Thanks for explaining.
A couple thoughts:
1) You can set up the "owner" of the dialog as Inventor, and then Windows should take care of this reactivation for you. What language are you working in?
2) With Inventor 2011, you can use the new DockableWindow feature of the Inventor API, and host your dialog in a docking window (similar to the browser window). This way, Inventor will manage this for you.
Jeff
Excellent I have got it working as you say by setting the owner.
I am working in C#. Using the DockableWindows looks interesting I will have to take a look at that.
thank you very much for your help
Gav