This is a migrated thread and some comments may be shown as answers.

DoubleClick and Tabbed Documents

4 Answers 52 Views
Dock
This is a migrated thread and some comments may be shown as answers.
daniel demesmaeker
Top achievements
Rank 1
daniel demesmaeker asked on 27 Nov 2007, 11:06 PM
Hi,
I am just downloaded your last version of Docking solution.
I am dynamically create a DockingManager and 3 DockPanel.
I am use Visual Studio 2005 c# langage.
When I drag and drop a DockPanel, I would like to disabled the posibility to tabbed the document to an other DockPanel. I would like just to move the DockPanel to an other place.

Ma second question is about thr event DoubleClick.
That is a part of my code.
...
DockPanel panel_1 = new DockPanel(); 
panel_1.CaptionVisible = true
panel_1.TabStripVisible = false
panel_1.CloseButtonVisible = false
panel_1.HideButtonVisible = false
panel_1.DropDownButtonVisible = false
panel_1.VerticalScroll.Visible = false
panel_1.DockState = DockState.Docked; 
panel_1.DoubleClick += new EventHandler(Panel_DoubleClick); 
panel_1.Text = "Test"
Dock_1.SetDock(panel_1, DockPosition.Top); 
 
void Panel_DoubleClick(object sender, EventArgs e) 
        { 
            label1.Text = "OKOKOK"
//            throw new Exception("The method or operation is not implemented."); 
        } 

Nothing is append when I doubleclick on the Panel object.
Do you have an idea of wath is wrong ?
Thank for your support and sorry for my english.

Daniel

4 Answers, 1 is accepted

Sort by
0
Alex Peachey
Top achievements
Rank 1
answered on 28 Nov 2007, 02:56 AM
The easiest way to do your first question that I can think of would be add an event handler for the DockingStateChanging event and based on whatever the user is trying to do then you can either just cancel the event or you can move the panel to a default place (like to the right of the DockPanel) and then cancel the event.
I do something similar with the menu and the ability to create tabbed documents. I want the users to be able to do anything on the drop down menu except choose the tabbed document option. So I just put a handler on the event and if they chose that option, I just cancel the event. Ideally it would be nice to be able to customize that drop down and not even show it as an option, but this works for now.

0
daniel demesmaeker
Top achievements
Rank 1
answered on 28 Nov 2007, 07:29 AM
Thank Alex for your quick response.
Do you have a code for a DockingStateChanging event.
Because each object are create dynamically in the code.


0
Alex Peachey
Top achievements
Rank 1
answered on 28 Nov 2007, 06:37 PM
Sure, when setting up your controls just add in:

YourDockingManagerNameGoesHere.DockingStateChanging += new DockingChangingEventHandler(YourDockingManagerNameGoesHere_DockingStateChanging);

Then for me the code inside the handler was simple:
if (e.DockableState == DockState.TabbedDocument)
                e.Cancel = true;

Obviously you can check for any conditions you want.

Also that's just the DockingStateChanging event. You can tap into any of the events to customize the behavior.
0
Julian Benkov
Telerik team
answered on 29 Nov 2007, 03:52 PM
Hello Daniel,

In the DockingStateChanging event handler you can cast the DockObject property to the DockPanel and then check its properties:

if (e.DockableState == DockState.TabbedDocument)  
{  
    DockPanel panel = e.DockObject as DockPanel;  
    if(panel != null)  
    {  
        if(panel.Text == "DockPanel1"// or other object checks...  
        {  
            e.Cancel = true;  
        }  
    }  
}  
 


Alex, thanks for the good solution!

In out next releases we will include API for accessing and managing system dock menus.

 
Sincerely yours,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Dock
Asked by
daniel demesmaeker
Top achievements
Rank 1
Answers by
Alex Peachey
Top achievements
Rank 1
daniel demesmaeker
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or