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

toolwindow won't close

4 Answers 128 Views
Dock
This is a migrated thread and some comments may be shown as answers.
PR
Top achievements
Rank 1
PR asked on 07 Jan 2014, 04:03 PM
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 ?

4 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 09 Jan 2014, 01:01 PM
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 >>
0
PR
Top achievements
Rank 1
answered on 10 Jan 2014, 10:41 AM
sorry but change ToolWindow in DocumentWindow doesn't work
0
PR
Top achievements
Rank 1
answered on 10 Jan 2014, 11:29 AM
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...
0
Accepted
Dimitar
Telerik team
answered on 10 Jan 2014, 04:35 PM
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 >>
Tags
Dock
Asked by
PR
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
PR
Top achievements
Rank 1
Share this question
or