question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reloading layout fails

See original GitHub issue

Hi

This is an old fix i wrote for v2.4 back in 2008. The problem is that when you reload a saved layout, the docking content remains in a inconsistent state. I wrote & added the following code to DockContentCollection.cs to prevent this and allow a smooth reload of saved layouts. All you need to do is to call RemoveAll() before reloading the layout. I also added a public version of the RemoveContent method (doing the extra cleanup) I felt it was missing.

    //veg: 22-12-2008 - Added method to remove all IDockingContent.
    //                  Call before reloading layout.!
    //veg: 01-20-2009 - Reordered code to prevent problems with DockState.
    public void RemoveAll()
    {
        for (int i = Count; i != 0; i--)
        {
            RemoveContent(this[i - 1]);
        }
    }

    //veg: 22-12-2008 - Added Public version of Remove() with some additional cleanup!
    public void RemoveContent(IDockContent content)
    {
        if (content == null)
            throw new InvalidOperationException();

        Remove(content);

        ((DockContent)content).DockState = DockState.Unknown;
        ((DockContent)content).FloatPane = null;
        ((DockContent)content).DockPanel = null;
        ((DockContent)content).Pane = null;
    }

I will have a look asap at the new 2.7.x code and compare code but sofar this isue does not seem to be solved.

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wvdvegtcommented, Sep 14, 2012

Hi

I think the problem is that there is no simple/obvious counterpart of DockContent.Show(DockPanel) that removes a form from the DockContentCollection. But I found that setting:

DockContent.DockHandler.DockPanel = null;

does indeed remove items from the DockContentCollection and allows a restore of forms from xml.

I must have either overlooked this issue or some code has improved in the meanwhile! It solves the reloading problems.

As for the closing of DockContent decendant Forms, I would expect it to set the DockPanel to null and remove themselves from the readonly collection this way. This might be an

I recoded my code and now just walk the DockPanel.Contents collection and set all DockHandler.DockPanel to null.

This removes all HideOnClose=true forms that where Hidden and All Visible Forms from the DockContentCollection.

Closed Forms with HideOnClose=false are already no longer part of the Collection and Disposed by .NET and are recreated by DeserializeDockContent calls.

So i can now use unmodified code, case closed!

regards

0reactions
lextmcommented, Sep 14, 2012

Thanks for sharing the tip. Finding out such workaround is never an easy task, so you did contribute something really valuable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to load window layout error
Failed to load window layout error · 1. In the projects Library folder there is a file "CurrentLayout-default.dwlt" · 2. Go into USER/Library/ ......
Read more >
'Failed to load window layout' Error - How to fix in Unity 3D
In Unity 3D “Failed to load window layout” error is showing when there are any errors in your Editor script. “This happens if...
Read more >
Can not start a new project as unity has "failed to load ...
Quit Unity and do the following: Go to "AppData\Roaming\Unity\Editor-5.x\Preferences\Layouts\default" or ...
Read more >
Anyone else get Relativity Forms failed to load layout error?
When clicking into a document in the viewer, the coding layout sometimes shows the message Relativity Forms failed to load layout.
Read more >
Update flow layout fails because of reload data absent #47
So I change layout to show 7 days and display header by adjusting its height. Before displaying a week I already have some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found