All TrueGUI commands that refer to a form or control require a Control-Specifier to define the specific control to which the command applies. Control specifiers take one of the following formats:
Assembly.Form
UserFormName
UserFormName . Control
Assembly - this is the .NET terminology for the file which contains the form(s) that you will be using. It can be either a class library (.DLL) or an executable module (.EXE) depending on the way you build it. Either type will work fine. An assembly must be explicitly loaded by your application program using the TrueGui.LoadAssembly(...) global command before any form in it can be referenced. Multiple assemblies can be loaded by your program at the same time as required. Once an assembly has been loaded, it cannot be explicitly unloaded. This is a requirement of the Microsoft .NET framework. All assemblies are automatically unloaded when your program exits.
Form - this is the name of the form that you are referencing. A form can be directly referenced itself (a form is actually a type of control in the .NET framework) or it can define a form within which a control is located. Some examples of form names are Form1, MyForm, MainForm etc. A form becomes visible when you execute its Show() method. It becomes hidden when you execute its Hide() method. A form is still active even though it may be hidden and you can manipulate its parameters during this time before showing it. You can also harvest data items from a form or its controls whether it is visible or hidden.
UserFormName - this is the name that you give the instance of the form when you create it using the "New" command operator. You will use this name to refer to the form for functionality. This allows you to load multiple instances of the same form (if required) by giving them separate user names.
Control - this is the name of the control that you are referencing. Some examples of control names are button1, textBox1, exitButton, EmployeeList, etc. Control names are set when you define the form.
During processing of the commands sent out by your application program, the current Form, and Control may be stored in the TrueGui.DefaultForm and TrueGui.DefaultControl properties so that it is not necessary to repeat them in successive commands sent to the client program. It is necessary only to explicitly specify them in a command when it is desired to change them. The DefaultForm property is loaded automatically when a form is created and given a user name. The DefaultControl property must be explicitly loaded by your program if you wish to use it. Note the following example:
10 PRINT "{ TrueGui.LoadAssembly(`CsForms`) }"
20 PRINT "{ MyForm = new Form1() }"
30 PRINT "{ MyForm.Show() }"
40 PRINT "{ DefaultControl=button1 }"
50 PRINT "{ Width=80 } { Height=40 }"
60 PRINT "{ button2.Text=Exit }"
Statement 10 is a global command that loads the "CsForms.exe" assembly into the client program. This assembly contains one or more forms designed by you using the Visual Basic layout designer.
Statement 20 shows the creation of one instance of Form1 that is contained in the CsForms assembly file. "MyForm" is a user-defined name that you create to reference this form by. Note that it is not necessary to specify the assembly name in this statement because it is remembered from when it was loaded in statement 20.
Statement 30 "Shows" the form named "MyForm" that makes it visible to the user.
Statement 40 sets the DefaultProperty to button1 for future commands to use.
Statement 50 sets the width and height of button1. The name of the form (MyForm) is remembered from statement 30. The name of button1 was set in line 40 and is not required in the following "Width" and "Height" commands.
Finally, statement 60 demonstrates that "button2" is required to explicitly refer to "button2" instead of "button1".