Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Event for Inventor getting focus?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
gmetcalfe
758 Views, 4 Replies

Event for Inventor getting focus?

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

4 REPLIES 4
Message 2 of 5
jeff.pek
in reply to: gmetcalfe

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

Message 3 of 5
gmetcalfe
in reply to: jeff.pek

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

Message 4 of 5
jeff.pek
in reply to: gmetcalfe

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

Message 5 of 5
gmetcalfe
in reply to: jeff.pek

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report