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

DockingManager: SetAutoHideMode during Form_Load

Our product is tracking the autohide mode of each docked control for each user. Therefore, we need to set this whenever the page loads based on stored settings. However, i cannot get the autohide to behave properly when it is set during the loading of the form using the SetAutoHideMode method. Either it is ignored completely (see attached sample, based on a tabbed control sample provided by Syncfusion, which tries to autohide the docked controls), or causes a painting problem which eventually leads to an out of virtual memory error (see attached screenshots from our product. i have not had the time to reproduce in a sample yet. NoPaint.bmp shows how it loads, AfterToggle.bmp shows that setting programmatically after load has no painting issue). What is the best way to set autohide mode programmatically on form load? Thanks, Julie

WindowsApplication1_SetAutoHide.zip

12 Replies

JK Joy K George Syncfusion Team July 5, 2006 11:07 PM UTC

Hi Julie, The FormLoad event is not suitable for doing any docking activities.Because at that time dockingmanager will be in initializing all the docked controls. You could use event DockingManager.NewDockStateEndLoad.It will get fired only after loading the dockstate. private void dockingManager1_NewDockStateEndLoad(object sender, EventArgs e){ dockingManager1.SetAutoHideMode(pnlpanel3, true); } For more information please refer this knowledge base article. Thanks for choosing Syncfusion products. Regards, Joy


JL Julie Levy July 7, 2006 04:27 AM UTC

thanks, sorry i didn''t check the kbs before posting - i only searched the forum. thanks again, Julie


JL Julie Levy July 8, 2006 12:29 AM UTC

Joy - I''m still experiencing the painting problem even though i am setting autohide (and size) in NewDockStateEndLoad. I notice that this event fires twice and if i try to set them the first time through, the setting is ignored. If i set it the second time through, if autohide is true, the settings is not ignored, but the first time i change autohide to false, the control doesn''t paint. It will take me quite some time to try and reproduce this in a sample project, is there anything else i should look at. The only other Dock event i am using is OnDockStateChanged to set the borderstyle and tabforecolor of the docked control''s tabs. Thanks, Julie


JL Julie Levy July 11, 2006 05:29 PM UTC

Joy - i think i''ve finally figured out the timing of everything and have gotten this work ok. I''m having to do some of it in the DockVisibilityChanged event too. One last question. When a control is in autohide mode, is there a way for me get the size it was when it was docked? Currently i am recording it in the AutoHideAnimationStart event, but am wondering if the value is stored somewhere that i can get from the DockingManager (the size of the control itself is zero). Thanks, Julie


JK Joy K George Syncfusion Team July 17, 2006 11:02 PM UTC

Hi Julie, Here ia a sample to meet your requirements.Please go through that and let me know,if you have any queries regarding that. Regards, Joy

sample54.zip


JL Julie Levy July 25, 2006 12:02 AM UTC

Joy -
Thanks. I have discovered one more problem. When the page loads, i need to set the autohide mode and the size based on user preferences. If the autohidemode is false, then when i set the control size (in the NewDockStateEndLoad event), it causes a painting problem the first time the autohidemode is set to true.
See the attached sample, Form 3. If you hover over the tab or use the keyboard shortcut to show the control (ctrl+B), the control doesn''t paint unless you autohide and show again using the keyboard (pin button never paints).

Note that we want the page to always load with the docked controls in authide mode to avoid excessive UI flickering (don''t want to show it, only to hide it).

Also, I tried setting dcHostForm.GetAHTabControl(DockingStyle.Bottom).Size to see if that worked, but it produced the same results.

Any suggestions?

Thanks,
Julie

DockedGrids0.zip


JK Joy K George Syncfusion Team July 26, 2006 12:18 AM UTC

Hi Julie,

I have slightly modified your code to resolve the issue.Here is the code snippet.

void dockingManager1_NewDockStateEndLoad( object sender, EventArgs e )
{
Size szNewSize = new Size( 1, 200 );//It is not working if you set width as 0
this.dockingManager1.SetAutoHideMode( this.gridWithDocking, true );
this.dockingManager1.SetControlSize(this.gridWithDocking, szNewSize);

}

If you want to dock the controls in Autohidden mode you could use the DockControlInAutohideMode method of dockingmanager.

Please let me know,if this works for you.
Regards,
Joy


JL Julie Levy July 27, 2006 07:09 PM UTC

Thanks, i''m glad this was an easy fix, it was driving me crazy.

Another thing driving me crazy. I have 3 tabbed controls docked to the bottom, only 2 are visible at a time. Is there a clean way to keep the hidden tab in sync with the autohide mode and size (height) of the visible tabbed controls? Can this be done without a lot of flickering. These settings seems to be ignored when the controls are not visible.

Thanks again.


JL Julie Levy July 27, 2006 09:53 PM UTC

Sorry to keep piling on the questions, but i''m getting an "Object reference not set to an instance of an object." error when i am hiding and showing the tabs. It always happens on the same tab, always when showing it after hiding it.

I''m able to call GetDockVisibility(), but the error happens when i call SetDockVisibility.
My code which gets called based on user interaction just looks like this:
if (this.GetDockVisibility( controlToShow ) == false)
if (this.GetDockVisibility( controlToShow ) == false)
{
this.SetDockVisibility( controlToShow, true );
}
The call stack of the error is:
at Syncfusion.Windows.Forms.Tools.DockHostController.AttemptPrevAHDocking(AHTabControl autoHideTab, DockControllerBase ctrl, Boolean animate)
at Syncfusion.Windows.Forms.Tools.DockHostController.ToggleAutoHideMode(Boolean animate)
at Syncfusion.Windows.Forms.Tools.DockHostController.set_DockVisibility(Boolean value)
at Syncfusion.Windows.Forms.Tools.DockingManager.SetDockVisibility(Control ctrl, Boolean bvisible)
at Advent.MxRules.Win.Controls.MxrDockingManager.ShowControl(Control controlToShow)


Have you seen this before? It will take me a while to try and reproduce it in a sample project, so i thought i would ask first if you had seen this before.

Thanks again,
Julie


JK Joy K George Syncfusion Team July 28, 2006 12:07 AM UTC

Hi Julie,

Sorry for the inconvenience.

Unfortunately we have not seen this stack trace before.It would be highly appreciable if you send us a sample which is exhibiting this issue.

In the mean time we will also try to reproduce this issue here.
Regards,
Joy


JL Julie Levy July 28, 2006 09:51 PM UTC

Joy -
i''ve run into so many problems showing and hiding the tabbed control that i''ve abandoned that approach. I won''t have time to try and reproduce the error in code that i can send to you, at least not right now. If you have any questions about our code, i''ll be happy to answer them.
I have one more question, but i think i will start a new thread, this one is so long. Thanks for all of your help. And if there are any patches available soon with DockingManager fixes, please let me know.
Julie


AH Asrul Harahap replied to Julie Levy April 5, 2018 03:18 AM UTC

Thanks, i''m glad this was an easy fix, it was driving me crazy.

Another thing driving me crazy. I have 3 tabbed controls docked to the bottom, only 2 are visible at a time. Is there a clean way to keep the hidden tab in sync with the autohide mode and size (height) of the visible tabbed controls? Can this be done without a lot of flickering. These settings seems to be ignored when the controls are not visible.

Thanks again.

mantap

Loader.
Live Chat Icon For mobile
Up arrow icon