Need a good pattern to restore the docking layout

Docking/MDI for Windows Forms Forum

Posted 13 years ago by Erik Pepping - RADVenture B.V
Avatar
Hi,

I have an application with multiple toolwindows. The user modifies the layout a bit, moves some and closes some of the toolwindows. When closing the UI this layout needs to be saved.

When loading, the toolwindows will be created in a random order by the application. At that point I would like to restore the layout of a toolwindow. If a previous parent is not present, I would like to match the old docking as good as possible. (actually the vs.net behavior)

What would be a good pattern for this? The basic loading to/from xml file mechanism is not usable for this kind of scenario because it wants to create new toolwindows for the ones that are not created yet.

Regards,

Erik

[Modified at 02/20/2006 05:49 AM]

Comments (15)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Erik,

I think what you really need is what I previously posted about, where if a tool window is not found during load, the creation of a the tool window to take its position could be cancelled and DockManager would have to filter up and remove any tool windows containers that were made to support that tool window. Would that accomplish what you want?


Actipro Software Support

Posted 13 years ago by Erik Pepping - RADVenture B.V
Avatar
I'm not sure. What about toolwindows that are opened after the xml layout is loaded (and where present in the xml, but not in the IDE)? Are they assigned their previous positions, or only when i re-load the xml again?

(offcourse this behavior applies when the functionality exists to suppress the creation of placeholder toolwindows)

How do other docking components handle this issue?

Erik

[Modified at 02/21/2006 07:19 AM]
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I know our positioning logic is pretty comprehensive compared to some other competition. We do store the relation positions of tool windows that are hidden. As long as they were docked at some point, they will know what they were attached to or near at that point. If you create a brand new tool window after a layout is loaded, of course that has no history of where it was docked.

So when you say "toolwindows that are opened after the xml layout is loaded," do you mean tool windows that have layout information persisted in the XML but are not currently visible even though the DockManager is managing them? Or do I understand you incorrectly?


Actipro Software Support

Posted 13 years ago by Erik Pepping - RADVenture B.V
Avatar
Yes, toolwindow A has it's layout persisted in the xml, but is not there yet when the xml layout is loaded. Let's pretend that I can suppress the creation of that placeholder toolwindow.

Later on I create toolwindow A manually. What I would like is that it will get the layout that was saved in the xml.

Erik
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Could you load the tool window when the layout is loaded but tell DockManager not to display it, so that it is added to the DockManager with all the layout info however it is not visible yet? Would that work if we gave you a mechanism to do so or are you not wanting to create it at all?


Actipro Software Support

Posted 13 years ago by Erik Pepping - RADVenture B.V
Avatar
Ehm, i'm a bit confused ;-)...let's see if I can explain it in pseude code:

public void CreateToolWindowA(DockManager manager)
{
ToolWindow ToolWindowA = new ToolWindow(manager, "toolA")
ToolWindowA.RestoreLayout("toolA", "XmlLayoutFile.xml");
}

public void ToolWindow.RestoreLayout(string key, string file)
{
XmlLayout layout = XmlLayout.Load(file);

ToolWindowLayout toolWindowLayout = layout.GetToolWindowLayout(key);

if (toolWindowLayout != null)
{
//assign saved layout tool toolwindow. When a parent container doesn't exists, try to put the toolwindow
//in a place that matches the old location as good as possible.
}
}

Hope this helps.

Erik
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Maybe what we could do is this... if there is layout data for a tool window in the XML but you don't have a tool window loaded with that key, we cache the layout data internally in a hashtable. Then if you later create a tool window with that key (before loading any other layout, which would reset the cache), we could initialize your new tool window with the cached layout data. How does that sound?


Actipro Software Support

Posted 13 years ago by Erik Pepping - RADVenture B.V
Avatar
Sounds good! Can you already give a rough timeframe when this feature is going to present in build? I guess I need to upgrade to 2.x builds for that.

Erik
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Erik,

I can bump up the priority for you on this item. We have a maintenance release almost ready for UIStudio but this feature probably won't make it into that. If this is something you need immediately though, we can implement the feature for you for an hourly rate. By doing this, we'll put our other work aside so that you get it immediately. Let us know if you're interested in that. I don't think this would take more than several hours. Otherwise, we have it bumped up to be one of the first new features added in a future maintenance release.


Actipro Software Support

Posted 13 years ago by Erik Pepping - RADVenture B.V
Avatar
Yes, If you can bump up the priority that would be great! I'll keep an eye on the release notes of future releases. Until this feature comes available I just set the positioning of the toolwindows to its default on every start of the application.

Erik
Posted 13 years ago by Erik Pepping - RADVenture B.V
Avatar
Guys,

Is there any news about this point? Is this feature already implemented?

Erik

[Modified at 06/20/2006 09:12 AM]
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Erik,

Sorry we've been completely swamped with SyntaxEditor 4.0 development that we haven't had a chance to come back and work on some UIStudio features like this yet. It does have a high priority flag for us though for when we do work on new UIStudio features.


Actipro Software Support

Posted 13 years ago by Erik Pepping - RADVenture B.V
Avatar
What is the expected timeframe? Weeks? Months?

Regards,

Erik
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
For the next maintenance release we've added a property to DockManager called AutoCreateToolWindowsForLayoutLoad, which defaults to true. If you set it to false it will no longer create empty tool windows that were specified in the layout wich don't currently exist in the DockManager. That will handle one part of your request.

For the other part, are you looking to only restore the previous layout information of the non-existant tool window so that a call to Activate puts it at the old location when you create the tool window later? So this would only set the AutoHideSize, DockedSize, FloatingLocation, FloatingSize properties, along with a couple internal structures that have our detailed previous location information. Does that sound correct?

Please reply ASAP since we'd like to get this in the upcoming maintenance release.


Actipro Software Support

Posted 13 years ago by Erik Pepping - RADVenture B.V
Avatar
Yes correct. Thank you for adding this feature!

Erik
The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.