Stan
Stan

Reputation: 38255

How to design a C++ GUI application that mostly runs tcl script

I am looking for a good approach to build a C++ GUI application. Its core is generating whole bunch of tcl code and execute it through Tcl C++ API (#include <tcl.h>). The GUI provides an easy way for users to complete those tcl scripting tasks.

In other words, inside each callback function associated with the GUI control, it's like using ostringstream to populate tcl code and passes it to tcl interpreter. Eg:

bool execTclProc1(options) {
  ostringstream oss;
  oss << "package require MyPackage \n";
  string optionsForTcl = genOptionsForTcl(options);
  oss << "myTclProc1 " << optionsForTcl << endl;

  if(Tcl_Eval(interp, oss.c_str() == TCL_OK) {
    // print out some messages to the GUI message window
  }

  ...
}

The down side of this design:

I want to seek some insights from the community.

Upvotes: 0

Views: 916

Answers (1)

emsr
emsr

Reputation: 16333

Can't you use the Tk toolkit called as library functions from C++?

Also, there is Tk/C++ - don't know how good it is. They overloaded operator- and use expression templates so that the C++ code like like Tcl. Pretty cool!

Upvotes: 1

Related Questions