Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

DockPanel.ActiveDocument is one step behind with DockingMdi style #51

Closed
NekoKoneko opened this Issue Aug 28, 2012 · 3 comments

Comments

Projects
None yet
4 participants
Contributor

NekoKoneko commented Aug 28, 2012

The DockPanel.ActiveDocument value holds the previous active document when switching between documents with keyboard shortcuts (Ctrl+Tab, Shift+Ctrl+Tab) or by selecting document from the Window menu.

Steps to reproduce:

  1. Load the WinFormsUI.Docking.sln.
  2. Open MainForm in the designer.
  3. Add ActiveDocumentChanged event handler to the dockPanel control.
  4. Edit the created event handler to look like this:
    if (this.dockPanel.ActiveDocument != null)
        System.Diagnostics.Debug.WriteLine(this.dockPanel.ActiveDocument);
  1. Build and run.
  2. Create 3 empty documents (File -> New). The Visual Studio Output window should contain 3 lines, the last one being "DockSample.DummyDoc, Text: Document3". (http://imageshack.us/photo/my-images/600/32047518.png)
  3. Go to the Window menu and select "1 Document1". The active tab changes to the "Document1", but there is no new line in the Output window, meaning the event handler wasn't invoked. (http://imageshack.us/photo/my-images/405/78826564.png)
  4. Go to the Window menu again and select "2 Document2". This time the event handler was invoked, but the last line shows, that the ActiveDocument property contains the previous active document (Document1). (http://imageshack.us/photo/my-images/19/64776299.png)
  5. The above step can be repeated multiple times, but the ActiveDocument property will always be one step behind.
  6. Now activate some other window (Toolbox for example). The event handler is immediately invoked and the Output window contains the line with the correct ActiveDocument property value. (http://imageshack.us/photo/my-images/834/19438604.png)

The issue is not present when activating tab with a mouse button.

Testing environment: latest DockPanel Suite source (commit 7154d18), Windows 7 x64, Visual Studio 2008.

Owner

roken commented Aug 30, 2012

Thank you for the incredibly detailed bug report (this should serve as a shining example to all)! I was able to immediately reproduce the behavior and will look into it further.

Shujee commented Oct 3, 2013

Is this bug close to get fixed soon?

Contributor

NekoKoneko commented Dec 16, 2014

Fixed in commit 880a05e

@NekoKoneko NekoKoneko closed this Dec 16, 2014

@lextm lextm removed the in progress label Aug 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment