Event for Inventor getting focus?

Event for Inventor getting focus?

gmetcalfe
Contributor Contributor
921 Views
4 Replies
Message 1 of 5

Event for Inventor getting focus?

gmetcalfe
Contributor
Contributor

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

0 Likes
Accepted solutions (1)
922 Views
4 Replies
Replies (4)
Message 2 of 5

jeff.pek
Community Manager
Community Manager

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

0 Likes
Message 3 of 5

gmetcalfe
Contributor
Contributor

That will be why I was struggling to find one then. 🐵

 

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

0 Likes
Message 4 of 5

jeff.pek
Community Manager
Community Manager
Accepted solution

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

0 Likes
Message 5 of 5

gmetcalfe
Contributor
Contributor

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

0 Likes