6 Answers, 1 is accepted
0
Richard Slade
Top achievements
Rank 2
answered on 16 Jan 2011, 06:37 PM
Hello Eric,
To create a document in RadDock from a button click, consider the following code
For more information on creating windows at runtime, please take a look at the following documentation
hope that helps
Richard
To create a document in RadDock from a button click, consider the following code
Private
Sub
RadMenuItem1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadMenuItem1.Click
Dim
documentTop
As
DocumentWindow =
New
DocumentWindow()
documentTop.Text =
"New Document"
Me
.RadDock1.AddDocument(documentTop)
End
Sub
For more information on creating windows at runtime, please take a look at the following documentation
hope that helps
Richard
0
eric
Top achievements
Rank 1
answered on 16 Jan 2011, 08:19 PM
okay great! how can I do a check to make sure only 1 tab gets created. so lets say they cant keep clicking the button and more will generate
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 16 Jan 2011, 08:38 PM
Hi Eric,
Just move the document to private and check to see if it is nothing. E.g.
Hope that helps
Richard
Just move the document to private and check to see if it is nothing. E.g.
Private
m_DocumentTop
As
DocumentWindow
Private
Sub
RadMenuItem1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadMenuItem1.Click
If
m_DocumentTop
Is
Nothing
Then
m_DocumentTop =
New
DocumentWindow()
m_DocumentTop.Text =
"New Document"
Me
.RadDock1.AddDocument(m_DocumentTop)
End
If
End
Sub
Hope that helps
Richard
0
eric
Top achievements
Rank 1
answered on 28 Jan 2011, 09:30 PM
Okay thanks, but how come when i X out of the new window and click the button to create it again. it will not create. its not going back to null;
0
Richard Slade
Top achievements
Rank 2
answered on 29 Jan 2011, 12:31 AM
Hi Eric,
If you are allowing close, but still only want to show one, then you can use the folliwing solution:
Hope that helps
Richard
If you are allowing close, but still only want to show one, then you can use the folliwing solution:
Private
WithEvents
m_DocumentTop
As
DocumentWindow
Private
Sub
RadButton1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadButton1.Click
Dim
canCreate
As
Boolean
If
m_DocumentTop
Is
Nothing
Then
canCreate =
True
Else
If
Not
m_DocumentTop.DockState = DockState.TabbedDocument
Then
canCreate =
True
End
If
End
If
If
canCreate
Then
m_DocumentTop =
New
DocumentWindow()
m_DocumentTop.Text =
"New Document"
Me
.RadDock1.AddDocument(m_DocumentTop)
End
If
End
Sub
Hope that helps
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 29 Jan 2011, 01:03 PM
Hello Eric,
My apologies, it was rather late when I posted the code last night. This is much cleaner. (presuming you want to show the same document each time, and not a new one)
It just makes sure that the current document window is hidden, can only be shown once, and can be closed and re-shown
Let me know if you have any questions
Richard
My apologies, it was rather late when I posted the code last night. This is much cleaner. (presuming you want to show the same document each time, and not a new one)
Private
m_Document
As
New
DocumentWindow()
Private
Sub
RadButton1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadButton1.Click
m_Document.Text =
"New Document"
m_Document.CloseAction = DockWindowCloseAction.Hide
Me
.RadDock1.AddDocument(m_Document)
End
Sub
It just makes sure that the current document window is hidden, can only be shown once, and can be closed and re-shown
Let me know if you have any questions
Richard