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);
}
}