a simple question about Tcl/Tk

Miguel Angel Martin Fernandez vtk at helios.tel.uva.es
Fri Dec 17 15:53:43 EST 1999


> This is a simple question for guys who are familiar with Tcl/Tk:-)
> I found that in some Tcl/Tk scripts, there are always some expressions
> like: '[a method] anothermethod arguments',

> What does this mean?

In Tcl/Tk the brackets mean command substitution, i.e. a nested Command.
Tcl takes anything in brackets and evaluates ia as a command. It rewrites
the outer command by replacing the square brackets and everything between
them with the result of the nested command. It supports arbitrary number
of nesting levels.

> e.g.:
> vtkTransform si
> [si GetMatrix] SetElement 3 1 0
> [si GetMatrix] SetElement 3 2 0
> ...
> vtkBMPReader reader
> ...
> [reader GetOuput] ReleaseDataFlagOn
> ...
> 
> Can anyone translate this to C++ languange?

The translation could be:

vtkTransform *si;
si = vtkTransform::New();

si->GetMatrix()->SetElement(3,1,0);
si->GetMatrix()->SetElement(3,2,0);
...
vtkBMPReader *reader = vtkBMPReader::New() // Or like done with *si
...
reader->GetOutput()->ReleaseDataFlagOn();
...


> 
> Sorry to bother you guys:-)
> 
> -Tiaoyu
> 

You don't bother anybody :)

	Miguel

                  -----------------------------------
                     Miguel Ángel Martín Fernández
                          ETSI Telecomunicaion
                       Universidad de Valladolid
                         Campus Miguel Delibes 
                    e-mail: miguel at atenea.tel.uva.es
                      Tfono: 983-423000 ext: 25548
                  -----------------------------------



> 
> 
> 
> -----------------------------------------------------------------------------
> This is the private VTK discussion list.  Please keep messages on-topic.
> Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
> To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
> <majordomo at gsao.med.ge.com>.  For help, send message body containing
> "info vtkusers" to the same address.     Live long and prosper.
> -----------------------------------------------------------------------------
> 



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list