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.
Unfortunately, activation email could not send to your email. Please try again.

Dynamically Created Controls and Dock State

Thread ID:

Created:

Updated:

Platform:

Replies:

40495 Feb 3,2006 01:23 PM May 13,2011 07:55 AM Windows Forms 9
loading
Tags: Tools
Dave Sausville
Asked On February 3, 2006 01:23 PM

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?

Dave Sausville
Replied On February 3, 2006 04:39 PM

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?

Vijayanand S [Syncfusion]
Replied On February 6, 2006 05:49 AM

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

Dave Sausville
Replied On February 6, 2006 09:22 AM

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

Vijayanand S [Syncfusion]
Replied On February 6, 2006 10:14 AM

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

Dave Sausville
Replied On February 10, 2006 09:37 AM

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

Vijayanand S [Syncfusion]
Replied On February 15, 2006 09:23 AM

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

Abhishek Dudeja
Replied On May 10, 2011 07:21 AM

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

Jeraldes J [Syncfusion]
Replied On May 13, 2011 07:55 AM

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


Jeraldes J [Syncfusion]
Replied On May 13, 2011 07:55 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;