Active Window Detection

Hi,

I am wondering if it is possible for Igor to detect changes in the topmost window automatically. For example, if I have Graph1, Graph2, Table1, Table2, Panel1, and Panel2, and I click anywhere on Table1, Igor will execute an action that recognizes not only that I have changed the topmost window, but which window I have changed it to. So if I have a data folder corresponding to Graph1 and another data folder corresponding to Graph2, I can have Igor print which window is the new topmost window into the history, as well as automatically set the current data folder to the one corresponding to plot in the topmost graph.

Thanks.
You need to attach a hook function to your windows and respond to the activate event.
DisplayHelpTopic "Window Hook Functions"

Note that you can use the built in AfterWindowCreatedHook to programatically establish your own hook function on windows created in the future.
But if you add your own hooks to other people's windows, you risk fighting for control with the other hook functions. For most purposes I think it is best to hook your own windows only.
Thank you. I had used windows hook functions before, but was not aware that they could be used this way. It took much less code than I first expected.