We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Dynamically Created Controls and Dock State

I''m trying to use the DockingManager framework within my app, but am running into an issue. I have several controls that are created dynamically (in response to an event, etc.) and docked to the main window, which is straightforward. I am trying to give the user the ability save & restore the layout/dock state of these ctrls, again fairly straightforward. The problem arises when I restart the app and load the saved dock state. I can not guarantee that all of the ctrls which were present when the layout was saved will be present when the load occurs. If the user does launch a ctrl which does have a saved doc state, I will like it to use that state. DockingManager only let''s be add the ctrl by SetEnableDocking() or DockControl(), both of which first put the ctrl in some other location. I''ve tried calling LoadDockState() again after doing either of these methods. It only works the first time (and not perfectly), then a subsequent call seems to have things corrupted. Basic desired scenario: - User starts app. LoadDockState() does not execute because there is no previous state info. - User clicks btn1 to create Ctrl1, which is docked in a default location. - User clicks btn2 to create Ctrl2, which is docked in a default location - User repositions Ctrl1 & Ctrl2 to some non-default location/dock state. - User clicks save, which successfully calls SaveDockState(). - User closes app. - User restarts app. LoadDockState() successfully loads previous state into DockingManager. - User clicks btn1 which creates Ctrl1 *in the location/dock state from the saved state info*. I know the state info exists because I can check with ContainsSerializationInfo(). I just don''t see any way to easily "add" the ctrl and have it''s previous dock state applied. Any ideas?

9 Replies

DS Dave Sausville February 3, 2006 09:39 PM UTC

I was able to solve the problem by using the InitializeControlOnLoadEventHandler, then creating the missing ctrls while the LoadDockState() was happening. I did, however, uncover a different issue with the UI flickering as a new state is loaded. I tried wrapping the LoadDockState() call with SuspendLayout() and ResumeLayout(), which didn''t work. I also tried wrapping the call with Hide()/Show(), no luck either. Any suggestions?


VS Vijayanand S Syncfusion Team February 6, 2006 10:49 AM UTC

Hi Dave, Sorry for the delay. I have created a sample that implements your desired behavior except step 7. In my sample, I have modified step 7 and loaded the dock state of the control only when it is launched. This way it is not necessary to load all the controls'' dock states first, hide them and then open controls in their corresponding saved location. I am putting forth your desired scenario here: 1. User starts app. LoadDockState() does not execute because there is no previous state info. 2. User clicks btn1 to create Ctrl1, which is docked in a default location. 3. User clicks btn2 to create Ctrl2, which is docked in a default location 4. User repositions Ctrl1 & Ctrl2 to some non-default location/dock state. 5. User clicks save, which successfully calls SaveDockState(). 6. User closes app. 7. User restarts app. LoadDockState() successfully loads previous state into DockingManager. 8. User clicks btn1 which creates Ctrl1 *in the location/dock state from the saved state info*. You could use the statement this.dockingManager1.LoadDockState(serializer,[Any Control]); to load a particular dock state information from the saved file. And also you could avoid the flickering by inserting the LoadDockState() between the LockHostFormUpdate and UnlockHostFormUpdate methods. Please take a look at the attached sample. I hope this helps you. If not, could you please modify this attached sample and send it over to me? let me know the version number of Essential Studio 4.1 currently you are using. Please let me know if you have any questions. Thanks for using Syncfusion products. Regards, Vijay Test Sample


DS Dave Sausville February 6, 2006 02:22 PM UTC

Thanks very much for the reply. As I mentioned in my follow up, I was able to successfully implement the Load/Save routines. I am using v3.2.1.0 (sorry, I forgot to put that in last time). It seems as though LockHostFormUpdate() is only available in new versions. Any other suggestions for stopping the flicker? I am in a production environment and will not be able to update to a newer version for several months still. Thanks, Dave Sausville


VS Vijayanand S Syncfusion Team February 6, 2006 03:14 PM UTC

Hi Dave, Thanks for the update. You could avoid the flickering by call the Win32 API LockWindowUpdate(). Please refer this KB Article : LockWindowUpdate. I hope this helps you. Please let me know if you need any further assistance. Thanks, Vijay


DS Dave Sausville February 10, 2006 02:37 PM UTC

Actually, the LockWindowUpdate doesn''t appear to help either. Any other ideas?


VS Vijayanand S Syncfusion Team February 15, 2006 02:23 PM UTC

Hi Dave, I am afraid, this is the only possible way to reduce the flickering while Load dockstate or application start up in V3.2.1.0. Could you please send me a sample to show your problem? If it''s possible to reproduce the problem at home, it will help us to resolve this issue accurately. Please let me know if you have any qeustions. Thanks, Vijay


AD Abhishek Dudeja May 10, 2011 11:21 AM UTC

Hi Guys,

I'm new to Syncfusion and was trying to use Layout saving and restoring for DockingManager. It simply doesn't work for me. I have made a sample app which I have attached. Please check if I'm missing something.

Steps to reproduce:

1. Create new panels using "New Panel" button
2. Save layout using "SaveLayout" button.
3. Restore layout using "RestoreLayout" button.

Thanks
Abhishek



SyncFusionDockingTest_fcd458c0.zip


JJ Jeraldes J Syncfusion Team May 13, 2011 11:55 AM UTC

Hi Abhishek,

Thanks for the update.

As we have mentioned in the incident we have logged the defect report and we will update you the same as mentioned.

Please let us know if you have any concern.

Regards,
J Jeraldes



JJ Jeraldes J Syncfusion Team May 13, 2011 11:55 AM UTC

Hi Abhishek,

Thanks for the update.

As we have mentioned in the incident we have logged the defect report and we will update you the same as mentioned.

Please let us know if you have any concern.

Regards,
J Jeraldes


Loader.
Live Chat Icon For mobile
Up arrow icon