toolwindow won't close

5 posts, 2 answers
  1. PR
    PR avatar
    5 posts
    Member since:
    Sep 2006

    Posted 07 Jan 2014 Link to this post

    sample link hosted on zippyshare

    In this sample, when you launch it:
    -you can check the listviewitem called 'toto' (this call the AddDockTab() method)
    -you can uncheck the listviewitem called 'toto' (this call the DelDockTab() method) but nothing happens.

    Any idea ?
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 09 Jan 2014 Link to this post

    Hi Patrice,

    Thank you for contacting Telerik support.

    The remove does not work because AddDocument method is used when DocumentWindow is added. And actually DocumentWindow is added rather the ToolWindow. You can add a ToolWindow with the following method:
    Me.radDock1.DockWindow(myToolWindow, DockPosition.Left)

    If you want to use DocumentWindows you can recreate you methods for example like this:
    Private Sub AddDockTab()
        Dim myToolWindow As New DocumentWindow
        myToolWindow.Name = "ToolWindow_" & RadDock1.DockWindows.Count
        myToolWindow.Text = "Onglet n°" & RadDock1.DockWindows.Count
     
        myToolWindow.DocumentButtons = DocumentStripButtons.None      
        myToolWindow.CloseAction = DockWindowCloseAction.CloseAndDispose
     
        Dim myCustomRadScheduler As New CustomControls.AvrScheduler.CustomRadScheduler()
        myCustomRadScheduler.Dock = DockStyle.Fill
     
        Dim myCustomRadSchedulerNavigator As New CustomControls.AvrScheduler.CustomRadSchedulerNavigator()
        myCustomRadSchedulerNavigator.Dock = DockStyle.Top
        myCustomRadSchedulerNavigator.AssociatedScheduler = myCustomRadScheduler
     
        'Don't change order !
        myToolWindow.Controls.Add(myCustomRadScheduler)
        myToolWindow.Controls.Add(myCustomRadSchedulerNavigator)
     
        RadDock1.AddDocument(myToolWindow)
    End Sub
     
    Private Sub DelDockTab()
        For Each tDockWindow As DocumentWindow In RadDock1.DockWindows.DocumentWindows.ToArray()
     
            RadDock1.CloseWindow(tDockWindow)
        Next
    End Sub

    Also I have noticed that the code samples in our documentation articles are switched, which may have misguided you to the use the AddDocument method. I will fix this and it will appear correctly the next time the documentation is uploaded.

    I hope this helps. Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. PR
    PR avatar
    5 posts
    Member since:
    Sep 2006

    Posted 10 Jan 2014 Link to this post

    sorry but change ToolWindow in DocumentWindow doesn't work
  5. PR
    PR avatar
    5 posts
    Member since:
    Sep 2006

    Posted 10 Jan 2014 Link to this post

    it's ok

    the problem was here :
    myToolWindow.AllowedDockState = AllowedDockState.Floating Or AllowedDockState.TabbedDocument
    the line needs to be commented and it's ok but i don't know why...
  6. Answer
    Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 10 Jan 2014 Link to this post

    Hello Patrice,

    Despite that the close action is set to CloseAndDispose you should also include the Hidden dock state if you want to restrict the states and to be able to remove the documents programmatically:
    myToolWindow.AllowedDockState = AllowedDockState.Floating Or AllowedDockState.TabbedDocument Or AllowedDockState.Hidden

    Also another way to close all document windows is to use the RemoveAllDocumentWindows method:
    radDock1.RemoveAllDocumentWindows(DockWindowCloseAction.Close)

    Please let me know if there is something else I can help you with. 

    Regards,
    Dimitar
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready