Restore a Hidden Doucment Tab

3 posts, 1 answers
  1. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 12 Sep 2012 Link to this post

    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

    but how do you get it to show up again
  2. Answer
    Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 17 Sep 2012 Link to this post

    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()
                radDock.Dock = DockStyle.Fill
                radDock.Parent = Me
                document = New DocumentWindow("Test1")
                document.CloseAction = DockWindowCloseAction.Hide
                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()
            End Sub
            Protected Overrides Sub OnButton2Click()
            End Sub
        End Class
    End Namespace

    I hope this helps.

    Julian Benkov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 20 Sep 2012 Link to this post

    Hi Julian

    I like this idea

    document.CloseAction = DockWindowCloseAction.Hide

    very cleaver way to get around the close..
Back to Top