XOTclIDE User Guide | ||
---|---|---|
<<< Previous | Getting Started Tutorial | Next >>> |
In this section you will learn about dynamic and object-oriented aspects of XOTcl programming in XOTclIDE.
Start the XotclIDE per
[artur@rybnik xotclIDE]$ ./XotclIDE |
Now it is time to create some instance of Railroad class. Select the Railroad class in Class view and choose the menu Class->Create Instance you will see following dialog
In this dialog you can specify the arguments (or additional arguments) for init method (passed to init method or parameters). The class definition of Railroad isClass Railroad -parameter {{speed 4}} |
The new created object of class Railroad build a window and gets run.
Additional XOTclIDE shows an another window called object inspector browser. This window shows the internal structure of XOTcl objects. You can see its variables (attributes), subobjects (aggregated objects) and methods.
You can modify the object state per changing variable. Choose the speed variable. You should see the value 4 in your edit-area view. So type 20 in this area and press Control-S or choose menu Edit->Save Have you noticed that, the rail have speeded up.
You can also invoke methods on an object directly in Object Inspector. Select emergencyBreak method and choose menu Method->Invoke. You can also specify which method you should see (only from Railroad or also inherited from Object or Superclasses). You can even see the method available per mixin on viewed object.[1] | Example by Richard Suchenwirth translated from Tcl to XOTcl by Gustaf Neumann and modified by me. Primary published on tclwiki. |
<<< Previous | Home | Next >>> |
Getting Started Tutorial | Up | Programming with XOTclIDE |