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
close icon

Prevent Toolbars from Dragging

Hi all, we want to fix / unfix all the toolbars in our application with one click. We have MDIs that have own ChildFrameBarManagers. But how can we fix (allow the user not to drag/drop bars) from the GUI? With the dockingManager this is no problem : dockingManager1.DisallowFloating = true; But the Toolbars are not working. They must be set all exclusive with BarStyle.DrawDragBorder? Why is there no generic access in the BarManagers? Any ideas, worarounds? Thank you... Ralf

13 Replies

AD Administrator Syncfusion Team December 10, 2003 02:06 PM UTC

Hi Ralph, 1. To prevent users from Customizing by right clicking, you need to set the EnableCustomizing property in the MainFrameBarManager to false. 2. If you want to prevent a particular toolbar from appearing in the toolbar visibility menu, kindly refer to the following Knowledgebase article: How do I prevent the user from modifying the visibility of a particular toolbar? Regards, Arun


RH Ralf Huettl December 11, 2003 04:01 AM UTC

Hi Arun, EnableXustomizing = false doesnt disable the dragging of toolbars (only the customization). I want the toolbar be visible but NOT draggable. if we dont set BarStyle.DrawDragBorder this works BUT we have to set this property for every toolbar on and off - there must be a setting in the parent manager to do this (because the same problem does exist in the ChildFrameBarManahgers) What we want to do is a application that the user can fix/free the layout elements (and the toolbars). Any further ideas? Greetings Ralf


RH Ralf Huettl December 11, 2003 08:30 AM UTC

Hi Arun, we solved a part of this problem: We iterate through all ChildBarManagers and for every Manager we iterate through the bars and set the DrawDragBorder false. This works in the active MDI perfect BUT if we open another MDI the settings of the Managers are reset. The MDI1 Manager states are ok(fixed then) but new MDIs are not fixed. But we want ALL toolbars fixed ( all toolbars mean the toolbars of every MDI child) And ideas? Thank you Ralf private void fixBarItem_Click(object sender, System.EventArgs e) { dockingManager1.DisallowFloating = true; foreach( Syncfusion.Windows.Forms.Tools.XPMenus.BarManager c in mainFrameBarManager1.ChildManagers ) { foreach( Syncfusion.Windows.Forms.Tools.XPMenus.Bar b in c.Bars ) { b.BarStyle &= ~Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.DrawDragBorder; } } foreach( Syncfusion.Windows.Forms.Tools.XPMenus.Bar b in mainFrameBarManager1.Bars ) { b.BarStyle &= ~Syncfusion.Windows.Forms.Tools.XPMenus.BarStyle.DrawDragBorder; } }


AD Administrator Syncfusion Team December 12, 2003 08:53 PM UTC

Hi Ralph I am uploading a sample which does what you are looking for. You can toggle between allowing/not allowing dragging of toolbars by using pressing the button on the statusbar. There were workarounds to account for: a)The Main Menu not respecting the DrawDragBorder setting. b) Hiding and showing the DragBorders leading to icons disappearing from the bars as they were resized. The process to do this involves maintaining a global boolean flag and controlling the visibility of the DrawDragBorder in the BarControlBindingChanged event of the Main and the Child form(s). The Essential Tools team is looking into adding a LockToolBars feature and will look into it after the 2.0 release. I am adding this to our database as a feature request. Thanks for your cooperation on this issue. Regards Arun dragborder_3311.zip


RH Ralf Huettl December 15, 2003 05:08 PM UTC

Hi Arun, thank you for the fine working sample code... But there is one problem. If the Bars are really merged (same bar name and merge replacing items) the merged bar is not fixed. All other mdi bars are working perfect. If there is no merging (no mdi window open) then the toolbar is fixed fine, but if there is a mdi with merging this bar then this is not more working? Why? any ideas? Thank you again. Greetings Ralf


RH Ralf Huettl December 15, 2003 05:30 PM UTC

Arun, maybe these informations will help you: if this bar is not merged (no mdi) then the BarStyle before changing it is barStyle: 24 BarStyle: 24 After changing : barStyle: 88 BarStyle: 88 AND if this bar is merged (mdi is active) then the BarStyle before changing it is: barStyle: 81 BarStyle: 24 After changing : barStyle: 81 BarStyle: 24 This means that the merged bar is not changing??? we dont know why the barStyle can not be changed on merged bars. (by the way why are these two values different there?) Cheers :-) Ralf


AD Administrator Syncfusion Team December 15, 2003 08:08 PM UTC

Hi Ralf Making this change in SetBarGripperStyle() seems to take care of this issue: // Workaround for main-menu. The Main menu doesn''t seem to respect the setting above. if(mergedBar is MergedBar) { this.mainFrameBarManager1.GetCommandBarManager().GetCommandBarFromBar(mergedBar).HideGripper = booldrag.hideGripper; } Can you try this out and update this posting. Regards Arun


RH Ralf Huettl December 16, 2003 05:25 AM UTC

Arun, that's it :-) Thank you for helping out. By the way: great support in you forums Greetings Ralf


AD Administrator Syncfusion Team December 16, 2003 01:18 PM UTC

Hi Ralf, You could accomplish this by handling the DockingManager’s DragAllow event and set the DragAllowEventArgs’ Cancel property to true. Please take a look at the following Knowledge Base article for more information on this : How do I lock the docked windows on a form to prevent the layout of the form from being altered accidentally? Thanks for your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team December 16, 2003 01:19 PM UTC

Hi Ralf, You could accomplish this by handling the DockingManager’s DragAllow event and set the DragAllowEventArgs’ Cancel property to true. Please take a look at the following Knowledge Base article for more information on this : How do I lock the docked windows on a form to prevent the layout of the form from being altered accidentally? Thanks for your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


RH Ralf Huettl December 16, 2003 01:32 PM UTC

Hi Arun, another small thing: if we prevent the panels (docking) from floating we set dockingManager1.DisallowFloating = true; This works fine but if you set this you can dock the panels to other sides. But we want to fix the panels. So there must be a property like dockingManager1.DisallowDocking = true; How do we prevent users from docking a docked panel to another side in the container form? Thank you again :-) Ralf


AB Ankur Badola July 9, 2007 09:32 AM UTC


>This works fine but if you set this you can dock the panels to other sides.
>But we want to fix the panels. So there must be a property like
>dockingManager1.DisallowDocking = true;
>
>How do we prevent users from docking a docked panel to another side in the container form?

Any one has a solution for this?

Regards,
Ankur


RF Rashidha F Syncfusion Team July 16, 2007 12:13 PM UTC

Hi Ankur,

My apologies for the delay in responding to you.

You can achieve your requirement using DragAllow Event in DockingManager.

The following code snippet which illustrates how to fix the panel inside the docking control.

private void dockingManager1_DragAllow(object sender, Syncfusion.Windows.Forms.Tools.DragAllowEventArgs arg)
{
arg.Cancel = true;
}

Thanks for your patience.

Regards,
Rashidha.

Loader.
Live Chat Icon For mobile
Up arrow icon