By default, vTcl stores variables for widgets in separate namespaces. Each
toplevel has its own namespace. There is no obligation to use the names
like .mywindow::myvar of course. What the name means is that the variable
myvar belongs to the namespace ".mywindow". A namespace is kind of a
container for variables and procedures, and it helps avoid naming conflicts
as well as reduce pollution with global variables. Namespaces can be used
for object-oriented programming too.

The idea behind this is to allow multiple instances of the same toplevel
(eg. copy/paste an existing toplevel). If variables where global, typing a
value in an entry field in one toplevel would change the entry in the other
toplevel that is the copy of the first.

Outside vTcl when your program runs, you can also programmatically create
multiple copies of toplevels:

Window Show .mywindow .mywindow_1
Window Show .mywindow .mywindow_2

The first name .mywindow is the initial toplevel, the second parameter
represents the name of the copy. In this example you will have three
toplevels, the original .mywindow, plus .mywindow_1 and .mywindow_2

It could be an option in the preferences to choose using namespaces for
storing widget variables (like -textvariable, ...) or use global variables
(the former being recommended).

CG



|--------+------------------------------------->
|        |          [EMAIL PROTECTED] |
|        |          Sent by:                   |
|        |          [EMAIL PROTECTED]|
|        |          eforge.net                 |
|        |                                     |
|        |                                     |
|        |          11/13/2001 05:56 AM        |
|        |                                     |
|--------+------------------------------------->
  
>-----------------------------------------------------------------------------------------------------------|
  |                                                                                    
                       |
  |       To:     [EMAIL PROTECTED]                                      
                       |
  |       cc:                                                                          
                       |
  |       Fax to:                                                                      
                       |
  |       Subject:     [vtcl-user] Another question...defining own variables as global 
                       |
  |                                                                                    
                       |
  
>-----------------------------------------------------------------------------------------------------------|




Hi again,

i have another question concerning additional global variables in VTCL.
Where is the place where i have to insert additional (not VTCL generated)
variables
that should be global and available to any procedure ?

I saw that any VTCL variable is available in any procedure but my own vars
does not.
When hacking the script and inserting them into any proc - one way, but
after reopening
in VTCL and saving all of these are removed.

Is it neccessary to use special names bounded to the window (e.g.
.mywindow::myvar)  ??
Or also possible to use "standard" names like   $myvar  ???

Any help is appreciated

Thanks

Herbert



_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/vtcl-user




_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/vtcl-user

Reply via email to