DoubleClick and Tabbed Documents

5 posts, 0 answers
  1. daniel demesmaeker
    daniel demesmaeker avatar
    6 posts
    Member since:
    Sep 2005

    Posted 27 Nov 2007 Link to this post

    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

  2. Alex Peachey
    Alex Peachey avatar
    56 posts
    Member since:
    May 2006

    Posted 27 Nov 2007 Link to this post

    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.

  3. UI for WinForms is Visual Studio 2017 Ready
  4. daniel demesmaeker
    daniel demesmaeker avatar
    6 posts
    Member since:
    Sep 2005

    Posted 28 Nov 2007 Link to this post

    Thank Alex for your quick response.
    Do you have a code for a DockingStateChanging event.
    Because each object are create dynamically in the code.


  5. Alex Peachey
    Alex Peachey avatar
    56 posts
    Member since:
    May 2006

    Posted 28 Nov 2007 Link to this post

    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.
  6. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 29 Nov 2007 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready