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

Problem with visible/invisible ToolWindow in RadDock with SaveLayout

2 Answers 187 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Franco
Top achievements
Rank 1
Franco asked on 13 Jan 2011, 10:15 AM
Good morning.
I have found something strange in the behavior of your RadDock control. I create a simple test project: a Windows Form Application with one RadMenu and one RadDock. In the RadDock I add a new ToolWindow to the left, in the RadMenu I add only one MenuItem. Here's the code (Visual Basic Express 2008 in a Windows XP SP3 environment, Telerik RadControls WinForms Q3 2010):
Imports Telerik.WinControls.UI.Docking
  
Public Class Form1
  Private file As String = "a.xml"
  
  Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Me.Visible = False
  
    If (System.IO.File.Exists(file)) Then RadDock1.LoadFromXml(file)
    RadDock1.Visible = False
  
    Me.Visible = True
  End Sub
  
  Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    RadDock1.SaveToXml(file)
  End Sub
  
  Private Sub RadMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadMenuItem1.Click
    Static flag As Boolean
    If flag Then
      RadDock1.Visible = False
    Else
      RadDock1.Visible = True
    End If
    flag = Not flag
  End Sub
End Class
Now do the following:
1. Run the project.
2. Clik on the RadMenuItem1.
3. Set the ToolWindow Floating.
4. Close the form.
5. Run the project again: the ToolWindow is visible even if the RadDock control isn't.
How can I hide floating windows on startup? And make them visible again when RadDock1.Visible = True?

Thank you very much
Gianfranco

2 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 13 Jan 2011, 11:07 AM
Hello,

This should work for you.
Public Class Form1
  
  
    Private file As String = "a.xml"
  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Visible = False
  
        If (System.IO.File.Exists(file)) Then RadDock1.LoadFromXml(file)
        RadDock1.Visible = False
        ManageToolWindowVisibility(False)
  
        Me.Visible = True
    End Sub
  
    Private Sub RadMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadMenuItem1.Click
        Static flag As Boolean
        If flag Then
            RadDock1.Visible = False
            ManageToolWindowVisibility(False)
        Else
            RadDock1.Visible = True
            ManageToolWindowVisibility(True)
        End If
        flag = Not flag
    End Sub
  
    Private Sub ManageToolWindowVisibility(ByVal show As Boolean)
        If show Then
            Me.ToolWindow1.Show()
        Else
            Me.ToolWindow1.Hide()
        End If
    End Sub
  
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        RadDock1.SaveToXml(file)
    End Sub
  
End Class

Hope that helps
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 14 Jan 2011, 12:53 PM
Hello,

Did this help? If so please remember to mark as answer. If you need more assistance, let me know
Thanks
Richard
Tags
Dock
Asked by
Franco
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Share this question
or