Is there an example of UnknownToolWindowStatePreservationEna

Docking/MDI for Windows Forms Forum

Posted 17 years ago by Erik Pepping - RADVenture B.V
Version: 2.0.83
Avatar
Hi,

Is there an example app included in the release that shows the effect of the UnknownToolWindowStatePreservationEnabled on the dockmanager?

Erik

Comments (12)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If it is on, you could probably use the Dock sample to create 3 tool windows in a row via the file menu and save the layout. Then close the sample, and open the Dock sample again. Load the layout. Those 3 tool windows will not be there but their layout info is preserved so if you add tool windows again with the same key, they should reaquire that layout info. If you loaded 3 new tool windows with the same keys they will be initialized with that layout info. Although some of the code in the sample is programmatically docking/floating the tool windows. If you comment that code out and just Activate the 3 tool windows instead, you probably can see how this works.


Actipro Software Support

Posted 17 years ago by Erik Pepping - RADVenture B.V
Avatar
Thank you, I'll try that.

Erik
Posted 17 years ago by Erik Pepping - RADVenture B.V
Avatar
I can't seem to get it to work. What I've did:

I've put the following lines at the end of the DockForm() constructor:

dockManager.AutoCreateToolWindowsForLayoutLoad = false;
dockManager.UnknownToolWindowStatePreservationEnabled = true;

In the fileCreate3ToolWindowsInARowMenuItem_Click method I only commented these lines:

//secondToolWindow.DockedSize = new Size(firstToolWindow.ToolWindowContainer.Width, (int)(0.667f * firstToolWindow.ToolWindowContainer.Height));
//thirdToolWindow.DockedSize = new Size(secondToolWindow.ToolWindowContainer.Width, (int)(0.5f * secondToolWindow.ToolWindowContainer.Height));

- I started the sample app, opened the three tool windows in a row through the menu option.
- I moved them a bit around (docking one right, one at the bottom and resizing them a bit).
- Saved the layout xml file
- Restarted the sample app
- Loaded the layout xml
- Executed the three tool windows in a row command again.

Result: the three tool windows did not reposition / resize according to the saved layout.
Expected result: toolwindows would be docked and sized accoriding to the saved layout.
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Instead of your changes in fileCreate3ToolWindowsInARowMenuItem_Click, do this:
// Update border styles
this.UpdateChildControlBorderStyles();

firstToolWindow.Activate();
secondToolWindow.Activate();
thirdToolWindow.Activate();
return;
Make sure the return is in there so the DockTo and DockedSize code doesn't get executed.


Actipro Software Support

Posted 17 years ago by Erik Pepping - RADVenture B.V
Avatar
Thanks,

That raises the question; how can I know when they only need to be activated and when to execute also dockto + docksize, to have some nice defaults?
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Well any time you call DockTo you are essentially updating the docked size. However it won't affect floating size for instance. Any time you have a hidden tool window and you wish to restore it to its previous location, you call Activate.

If you are dynamically creating tool windows you'd have to somehow track on your own whether they were ever activated yet or not.


Actipro Software Support

Posted 17 years ago by Erik Pepping - RADVenture B.V
Avatar
Do I understand it correctly that the application must save somewhere the list of keys of the toolwindows that where activated at time of saving the toolwindow layout? That way the application can determine if only an activate is needed or also first setting the default docking location & size.

If so, then for a next release of UIStudio it would be nice that I could query the dockmanager if the loaded layout file contains layout info for a window with key X.
Posted 17 years ago by Erik Pepping - RADVenture B.V
Avatar
Also,

I think I found a bug that can be reproduced with the demo app with the modifications for the UnknownToolWindowStatePreservation.

When you dock windows 1 t/m 3 to the right, but attached to each other (so you will have three tabs at the bottom for the three toolwindows), save the layout, restart the app, open the layout info and execute the three toolwindows in a row command again you will see that they will all show up docked right, but all next to each other in stead of "nested".
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
This item is added for the next release:
Added the DockManager.UnknownToolWindowStatePreservationInfoExistsFor method that returns whether unknown tool window layout information is available for a tool window with the specified key.

Also you are correct that was a bug. And it is also fixed for the next release:
Fixed a bug where cached layout information for unknown tool windows could be loaded inaccurately in a certain scenario.


Actipro Software Support

Posted 17 years ago by Erik Pepping - RADVenture B.V
Avatar
Do you know when the next release is available?

Regards,

Erik
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Should be this week. We're in the middle of adding some cool new things to UIStudio like Office 2007 themes so as soon as that is done it should be ready.


Actipro Software Support

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
FYI, the new build is up now.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.