How to find reference to control added to workspace

Topics related to the Krypton Workspace.

Moderators: Phil Wright, Chris Porter

How to find reference to control added to workspace

Postby David Lanham » Fri Apr 15, 2011 2:34 am

I have added a control to a workspace with below code

Dim w As KryptonDockingWorkspace = kryptonDockingManager.ManageWorkspace(KryptonDockableWorkspace)
kryptonDockingManager.ManageControl(KryptonPanel1, w)
KryptonDockingManager.ManageFloating(Me)
KryptonDockingManager.AddToWorkspace("Workspace", New KryptonPage() {NewDocument()})


Private Function NewDocument() As KryptonPage
Dim page As KryptonPage = New KryptonPage()
page.Text = "MainModule"
page.TextTitle = "MainModule"
page.TextDescription = "MainModule"
page.Name = "Project1Page1"
page.UniqueName = "CodePage"

'// Document pages cannot be docked or auto hidden
page.ClearFlags(KryptonPageFlags.DockingAllowAutoHidden)
page.ClearFlags(KryptonPageFlags.DockingAllowDocked)

Dim tmpSyntax As SyntaxBoxControl = New SyntaxBoxControl
tmpSyntax.Dock = DockStyle.Fill
page.Padding = New Padding(0)
page.Controls.Add(tmpSyntax)

Return page
End Function

I now need to go back and add and edit text in the tmpSyntax text box that I added, but I am having trouble finding reference to the control to be able to do this. Have tried a few things like this

Dim ctl As Control = Me.GetNextControl(Me, True)
Do Until ctl Is Nothing
If TypeOf ctl Is SyntaxBoxControl Then
ctl.Text = "found it"
End If
'Do something
ctl = Me.GetNextControl(ctl, True)
Loop

but it does not find the control. Please help...
David
David Lanham
 
Posts: 11
Joined: Fri Jun 12, 2009 2:57 pm

Re: How to find reference to control added to workspace

Postby tspink » Mon Apr 18, 2011 6:56 am

You should declare a private member variable of your class - not quite sure what the VB .NET code is, probably something like:

Private Dim tmpSyntax As SyntaxBoxControl

Put this outside any method declarations. Then, when it comes to initialising it, just do what you've done, but assign it instead:

tmpSyntax = New SyntaxBoxControl

Then, you can use 'tmpSyntax' in any other method, without having to go and find it.
Tom.
tspink
 
Posts: 6
Joined: Tue Mar 09, 2010 11:49 pm
Location: Perth, Scotland, UK

Re: How to find reference to control added to workspace

Postby David Lanham » Mon Apr 18, 2011 11:50 pm

Tom,
Thanks for the response. I knew that I could do that and I had done that, but this is a text editing application where you could have 30 pages open at one time. This means that I would have to have 30 different declarations and keep track of an index for each page. This did not seem like a good way to do it. I have since figured out that doing it that way as you suggested is not going to work either. I need to have code for certain events that happen with the control, so now I have gone to putting all 30 controls on the form and then just using a index to keep track of which one gets assigned to the Krypton Page. I am new to VB.NET and VisualStudio so if I am missing something here maybe somebody could suggest a better way. I realize now this is probably not the best forum for asking this questions since it does not have to do with the Krypton workspace after all, like I thought at first.

Best Regards,
David
David Lanham
 
Posts: 11
Joined: Fri Jun 12, 2009 2:57 pm

Re: How to find reference to control added to workspace

Postby david778866 » Tue Jun 07, 2011 2:59 pm

A workspace is your client-side copy of the files and folders on the source control server. When you add, edit, delete, move, rename, or otherwise manage any source-controlled item, your changes are persisted, or marked as pending changes, in the workspace.

A workspace is an isolated space where you can write and test your code without having to worry about how your modifications might affect the stability of checked-in sources or how you might be affected by changes that your teammates make. Pending changes are isolated in a workspace until you check them in to the source control server.

You can synchronize your workspace with the most recently checked in changes on the server by using the Get Latest command.

If you want to have multiple copies of source on your computer, you can create more than one workspace for a specific source control server.
david778866
 
Posts: 2
Joined: Tue Jun 07, 2011 1:55 pm

Re: How to find reference to control added to workspace

Postby vulkanino » Tue Jun 07, 2011 11:15 pm

david778866 wrote:A workspace is your client-side copy of the files and folders on the source control server.


:?: you drunk, sir? :mrgreen:
vulkanino
 
Posts: 110
Joined: Fri Oct 01, 2010 8:15 pm


Return to Krypton Workspace

Who is online

Users browsing this forum: No registered users and 1 guest