Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VTCL, has anyone ever used it?

Status
Not open for further replies.

IllegalOperation38

Technical User
Jun 13, 2003
9
0
0
US
As I am trying to learn TCL/TK, I have found VTCL seems to be the most up to date GUI of the few I have played with so far, except it comes with zero documentation. (SpecTcl seems primitive?)

I cannot seem for the world of me how to set a variable for my program outside of a procedure. I want to set a variable and refer to it many times via the global scope with the rest of my procs. If I try to edit my source code directly and add the variable, the program wont run. (Example


#!/bin/sh
#The next line starts wish
exec wish "$0" "$@"

set vsftpd "/etc/rc.d/init.d/vsftpd


This will not work.


VTCL offers 2 procedures already, an init and a main. Can anyone kindly tell me how I can add my variable from within VTCL so that I may call it from a global scope (without putting it inside of a procedure itself?
 
I finally solved this, in case anyone else ever has the same question.

Options/bindings/main

You can add whatever command in there below already whats existing and it will be on a global scope (and get evaluated before anything else)
 
you may alternately want to look into using namespaces to create global access to variable scope via an "object" path to the variable, ie:

set ::myGlobalSpace::myvar 1

...
#~later in the code

set x $::myGlobalSpace::myvar

#~where x is local in scope to the current proc

you will have to create the namespace myGlobalSpace in your program via the namespace command. A little reading will help.

hope this helps

John Lopez
Enterprise PDM Architect
lopez.john@goodrich.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top