You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
public void ShowTool(string toolId)
{
try
{
if (DockableLocator.TryGetValue(toolId, out Func<IDockable?>? getDockable))
{
IDockable? dockable = getDockable();
if (dockable != null)
{
Console.WriteLine("Dockable object retrieved successfully.");
if (dockable.Owner is ToolDock toolDock)
{
if (toolDock.VisibleDockables != null && toolDock.VisibleDockables.Contains(dockable))
{
//then the tool has not been closed
SetActiveDockable(dockable);
SetFocusedDockable(toolDock, dockable);
}
else
{
//tool has been closed
FloatDockable(dockable);
}
}
else
{
//tool has never been opened
}
}
}
}
catch(Exception ex)
{
}
}
The text was updated successfully, but these errors were encountered:
BradBergstrom
changed the title
Floated windows get closed after calling SetFocusedDockable
Floating windows get closed after calling SetFocusedDockable
Aug 12, 2024
Float Tool with float option in GUI provided by the library.
Hit the X on the floating tool to close it.
Call my ShowTool function, which then calls FloatDockable as shown above.
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?
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:
var results = Find(x => x is IRootDock);
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.
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:
The text was updated successfully, but these errors were encountered: