Re: tkcon in a C application



Hi,

Regarding my application, it is a GUI one written in Borland C++.

Good - so you would have access to GUI components to build a prompt.

I first tested my registered commands using a simple dialog and and text
control. But I wouldn't like to build a gui around that (execute
command, show prompt, catch errors and print them).

So the first step is done!

I prefer, if possible, use a Tk component for this purpose.

You can try to load Tk into the tcl interpreter and than to source
tkcon.tcl.

I tried it with our MFC/tcl application. The "package require Tk" was
successfull, but there was no root window, and the console command
didn't work and threw no error.

Before extending our distribution to contain Tk too, before exploring
the problem, how to load Tk in an MFC application I decided to use the
MFC CEdit GUI component to create a MFC tcl console.
And it was not that problematic.

So ... you must first try to do a "package require Tk" inside you
application and see if it works. If it works just source tkcon.tcl and
you'll have your console, but I think it won't work, because Tk has its
event loop or must be included in the main event loop of the GUI, so
that Tk is really able to work!

For MFC there was a project introducing a second tcl thread with its on
event loop connected to the main thread event loop, but ... this model
create new problems.

Good luck and still much fun!

Martin Lemburg

On Jan 22, 11:48 am, "iu2" <isra...@xxxxxxxxxxx> wrote:
MartinLemburg@UGS wrote:
Hello iu2,

the problem is, that you started a new process with the command ...

exec wish tkcon.tcl &

This new process is NOT able to communicate with your C application!

With this way you won't get a remote tcl console!

The next problem is, that you need Tk for the "normal" regular tcl
console!
So your using tkcon.tcl in your C application wouldn't be possible.

So some questions:

1. Is your C application a console application or has your C
application a console/terminal window (like on Unix/Linux)?
=> if so, use the console by generating a prompt with C or tcl to
evaluate the user input from the prompt.

2. Has your C application a GUI using on MS Windows e.g. WIN32 or on
Linux using e.g. wxWindows?
=> build your on text widget based dialog and connect the callbacks to
a loaded tcl script containing procedures to be connected with the
dialog callbacks.

The application I'm working on is an MFC based application, which has a
CEdit based dialog with C++ callbacks. The console works fine,
comparable to the tkcon and provides even breakpoint capabilities in
tcl via new tcl commands.

Good luck and much fun!

Martin

Hi Martin and thank you for your response,

Regarding my application, it is a GUI one written in Borland C++. I
first tested my registered commands using a simple dialog and and text
control. But I wouldn't like to build a gui around that (execute
command, show prompt, catch errors and print them). I prefer, if
possible, use a Tk component for this purpose.

.



Relevant Pages

  • Re: Which distro for a server?
    ... > everything that I need with only a text console. ... > that doesn't exactly help me in learning linux on my own. ... command line commands or names of configuration files - field-based editing ... me a virtually seamless full screen linux GUI. ...
    (comp.os.linux)
  • Re: Just about to blow a hemorroid blood vessel. CUPS woes
    ... >> I have just installed mandrake 7.2 on a older system. ... >> runs on console only. ... > command is symlinked to it. ... Whenever I have trouble with the GUI stuff, ...
    (comp.os.linux.networking)
  • Re: v240 console went away :-(
    ... Can you access the operating system running on the box? ... when you give the "break" command at the ALOM prompt, ... Does hitting enter produce an "ok" prompt? ... your console. ...
    (comp.unix.solaris)
  • Re: Cant print to screen
    ... as a windows dialog or as a command line. ... Either your application is GUI ... approach is to make GUI application that will allocate new console ...
    (microsoft.public.vc.language)
  • Help : Redirecting Console results on forms
    ... I'm creating an interface for a network device basically its a GUI for ... Configration Commands are working fine on command ... prompt I just want to make there GUI so my client should not go to that ... TO REDIRECT THE RESULT OF COMMAND IN MY GUI. ...
    (microsoft.public.dotnet.languages.csharp)