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

Restore a Hidden Doucment Tab

2 Answers 176 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Denis Cilliers
Top achievements
Rank 1
Denis Cilliers asked on 12 Sep 2012, 01:54 PM
How do I get the document tab to re display once you hit the close button for that tab.

Me.dwSearchVehicles.AllowedDockState = AllowedDockState.Docked Or AllowedDockState.Hidden
  
 Private Sub mnuSearchVehicles_Click(sender As System.Object, e As System.EventArgs) 
Handles mnuSearchVehicles.Click
        If dwSearchVehicles.DockState.Equals(DockState.Hidden) Then
            dwSearchVehicles.DockState = DockState.TabbedDocument
        End If
  
        Me.radDockMain.ActiveWindow = dwSearchVehicles
  
    End Sub

As this code does not seem to do anything. 
I can prevent the page from hiding buy changing the setting to
Me.dwSearchVehicles.AllowedDockState = AllowedDockState.Docked

But that is not the required action

Also you can easily hide the tab by coding
Me.dwSearchVehicles.AllowedDockState = AllowedDockState.Docked Or AllowedDockState.Hidden
Me.dwSearchVehicles.Hide()

but how do you get it to show up again

2 Answers, 1 is accepted

Sort by
0
Accepted
Julian Benkov
Telerik team
answered on 17 Sep 2012, 11:06 AM
Hi Denis,

To change the default close and dispose behavior of a DocumentWindow you must use the CloseAction property and then use the Hide/Show API to change the visible state of the DocumentWindow. Here is an example:
Imports System
Imports System.Windows.Forms
Imports Telerik.WinControls.UI.Docking
 
Namespace Lab.Dock
    Public Partial Class DockCloseAction
        Inherits MainForm
        Private radDock As New RadDock()
        Private document As DocumentWindow
 
        Public Sub New()
            InitializeComponent()
            radDock.Dock = DockStyle.Fill
            radDock.Parent = Me
            radDock.BringToFront()
 
            document = New DocumentWindow("Test1")
            document.CloseAction = DockWindowCloseAction.Hide
            Me.radDock.AddDocument(document)
            Dim box As New RichTextBox()
            box.Dock = DockStyle.Fill
            box.Parent = document
            box.Text = "Test1"
        End Sub
 
        Private Sub DockCloseAction_Load(sender As Object, e As EventArgs)
            Dim tool1 As New ToolWindow()
            radDock.DockWindow(tool1, DockPosition.Left)
        End Sub
 
        Protected Overrides Sub OnButton1Click()
            Me.document.Show()
        End Sub
 
        Protected Overrides Sub OnButton2Click()
            Me.document.Hide()
        End Sub
    End Class
End Namespace

I hope this helps.

Greetings,
Julian Benkov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Denis Cilliers
Top achievements
Rank 1
answered on 20 Sep 2012, 11:29 AM
Hi Julian

I like this idea

document.CloseAction = DockWindowCloseAction.Hide

very cleaver way to get around the close..
Tags
Dock
Asked by
Denis Cilliers
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Denis Cilliers
Top achievements
Rank 1
Share this question
or