SharedSourceCLI.TK.TclInterp.GetVar C# (CSharp) Method

GetVar() public method

public GetVar ( string varName ) : string
varName string
return string
        public string GetVar(string varName) {
            return GetVar(varName, 0);
        }
        

Same methods

TclInterp::GetVar ( string varName, int flags ) : string

Usage Example

Example #1
0
        void cmdOpen(TclInterp interp, string[]argv)
        {
            //Create a file open box.
            interp.Eval("set types { {\"Text files\" {.txt .doc}} {\"All files\" {*}} }");
            interp.Eval("set file [tk_getOpenFile -filetypes $types]");
            
            string filename = interp.GetVar("file");
            
            if(filename != "")
            {
                cur_filename = filename;
                //Clear the text box.
                interp.Eval(".text delete 1.0 end");

                //Open the file and dump it's contents into our text box.
                TextReader file = File.OpenText(filename);
                string command;
                command = ".text insert end {";
                command += file.ReadToEnd();
                command +="}";

                interp.Eval(command);
                file.Close();

                //Update titlebar to reflect filename changes.
                command = "wm title . \"C# Notepad Using TCL - ";
                command += filename;
                command += "\"";
                interp.Eval(command);
            }
        }
All Usage Examples Of SharedSourceCLI.TK.TclInterp::GetVar