Floating windows get closed after calling SetFocusedDockable #830
Replies: 4 comments
-
|
Found another clue while debugging. If I go through the following steps:
Then the floating window will work perfectly. It wont be closed by subsequent calls to the ShowTool function, and calling that function with the ToolId for it, it will properly set as active. Edit: Literally changing my code to this fixes the bug. I don't want to be doing this, so whats the solution to get this to work right the first time? |
Beta Was this translation helpful? Give feedback.
-
|
Another interesting thing I've noticed while doing more debugging, is that when a floating tool is in a good state (See previous post as to how to get Tool into a good state), there are two RootDocks that are returned when querying the function FactoryBase.Find like so: This line is pulled directly from the function FactoryBase.SetFocusedDockable. When a tool is floating in a bad state, there is only 1 RootDock that is returned from that function (which checks FactoryBase.DockControls). I believe this may be why the bad state floating Tools are getting destroyed. The DockControl for the floating Tool doesn't get created until after going through the 3 steps to enter the tool into the good state. |
Beta Was this translation helpful? Give feedback.
-
|
The SetFocusedDockable method locates all root docks by iterating over the factory’s DockControls collection: Find searches all dockables starting from each DockControl registered in Factory.DockControls. A DockControl adds itself to this list only when it attaches to the visual tree: Because a floating window’s DockControl gets added only after the window is shown, calling SetFocusedDockable too early (before the floating window is opened and its DockControl registered) means the method sees only the main root dock. It then deactivates other roots and updates focus, which removes the unregistered floating root, effectively closing the floating window. Once the window has been closed and reopened, its DockControl is part of DockControls, so the second call succeeds. To avoid this issue, make sure the floating window is created and its DockControl added to Factory.DockControls (for example by waiting for the WindowOpened event) before calling SetFocusedDockable on it. After the window is registered, subsequent calls will not close your floating tools. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for taking a look at this and explaining it. I really appreciate it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to write a function for showing/opening tools. I have this function inside my DockFactory class implementation. Im not sure if this is a bug, or if I have something implemented wrong, but whenever I call either of the functions:
All of my floating windows get closed. Does anyone know why this is happening?
Here is my full function:
Beta Was this translation helpful? Give feedback.
All reactions