Hi,
I've created an addon that runs along use the normal user use of revit and allows the user to open certain views - it uses a modeless dialog.
This works well, but I've set TopMost property of the dialog to True otherwise I keep losing the dialog behind other windows.
The issue is, that with this set, the dialog then stays on top and annoyingly covers other windows.
I'd like the window to follow Revit's window, minimise with it and stay the level with it - so when a window covers Revit, it covers the dialog too.
I'd appreciate some examples or pointers.
Thanks,
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
This can be easily fixed by making the Revit main window the owner window of your modeless dialogue, and your modeless dialogue a child of the Revit main window.
I implemented the JtWindowHandle class to help achieve this in the past, so you can search The Building Coder for that term to find a number of solutions:
https://www.google.com/search?q=JtWindowHandle&as_sitesearch=thebuildingcoder.typepad.com
Please note that the Revit API provides official access to the main Revit window nowadays via the UIApplicaiton class MainWindowHandle property:
https://www.revitapidocs.com/2020/e28d23a9-6814-1e70-9943-1ee852887dae.htm
Best regards,
Jeremy
My pleasure!
I fleshed out the answer a bit further still and preserved for posterity here:
https://thebuildingcoder.typepad.com/blog/2019/09/ui-top-forms-buttons-web-etc.html#2