VC++ 6.0 GUP application with TCL 8.4 
Author Message
 VC++ 6.0 GUP application with TCL 8.4

HI Friends

Iam making a VC++ dialog based application with a Edit box and Run
Button. In the dialog class called TestDlg.cpp, there is a function
called OnMessage(), it is implemented as,

void OnMessage()
{
MessageBox("Hello World");

Quote:
}

Now iam gonna type in the Edit box,

set a [OnMessage] and click Run Button in GUI

Now the TCL interpreter should be able to find the command OnMessage
and call back the void OnMessage function in TestDlg.cpp in GUI.

Is it possible to do something like this? Can anyone please tell me how
to do this?

Thanks in Advance

Don



Tue, 01 Apr 2008 00:42:37 GMT  
 VC++ 6.0 GUP application with TCL 8.4
Iam Mean, VC++ GUI Application using TCL, not GUP


Tue, 01 Apr 2008 01:14:47 GMT  
 VC++ 6.0 GUP application with TCL 8.4

Quote:

>HI Friends

>Iam making a VC++ dialog based application with a Edit box and Run
>Button. In the dialog class called TestDlg.cpp, there is a function
>called OnMessage(), it is implemented as,

>void OnMessage()
>{
>MessageBox("Hello World");
>}

>Now iam gonna type in the Edit box,

>set a [OnMessage] and click Run Button in GUI

>Now the TCL interpreter should be able to find the command OnMessage
>and call back the void OnMessage function in TestDlg.cpp in GUI.

>Is it possible to do something like this? Can anyone please tell me how
>to do this?

See http://www.patthoyts.tk/programming/TclDemo.zip for a minimal MFC
sample. Fix the include and lib paths to wherever your tcl is
installed when you try to compile it.

--
Pat Thoyts                            http://www.patthoyts.tk/
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD



Wed, 02 Apr 2008 05:08:24 GMT  
 VC++ 6.0 GUP application with TCL 8.4

Quote:


>>HI Friends

>>Iam making a VC++ dialog based application with a Edit box and Run
>>Button
>> ....

> See http://www.patthoyts.tk/programming/TclDemo.zip for a minimal MFC
> sample. Fix the include and lib paths to wherever your tcl is
> installed when you try to compile it.

Pat,
Dude, that's so linear..  Where's the event loop in that?


Fri, 04 Apr 2008 08:18:45 GMT  
 VC++ 6.0 GUP application with TCL 8.4

Quote:



>>>HI Friends

>>>Iam making a VC++ dialog based application with a Edit box and Run
>>>Button
>>> ....

>> See http://www.patthoyts.tk/programming/TclDemo.zip for a minimal MFC
>> sample. Fix the include and lib paths to wherever your tcl is
>> installed when you try to compile it.

>Pat,
>Dude, that's so linear..  Where's the event loop in that?

Just starting simple.

Incorporating TES is not a job for a beginner :D

--
Pat Thoyts                            http://www.patthoyts.tk/
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD



Fri, 04 Apr 2008 16:49:58 GMT  
 VC++ 6.0 GUP application with TCL 8.4

Quote:




>>>>HI Friends

>>>>Iam making a VC++ dialog based application with a Edit box and Run
>>>>Button
>>>>....

>>>See http://www.patthoyts.tk/programming/TclDemo.zip for a minimal MFC
>>>sample. Fix the include and lib paths to wherever your tcl is
>>>installed when you try to compile it.

>>Pat,
>>Dude, that's so linear..  Where's the event loop in that?

> Just starting simple.

> Incorporating TES is not a job for a beginner :D

I hear ya Pat.  I only wrote that thing as a research project.  A
foundation class it isn't.  There's a few loose ends like the "where is
the tcl dll?" issue.

http://sourceforge.net/project/showfiles.php?group_id=1616&package_id...
<IIMOISFST>

Essentially what it does is to allow Tcl to be embedded into windows
programs, but in a way that doesn't interfere with normal message loop
activity of the target.  When embedding Tcl into applications there are
two styles people can use.  Either macro or async.

Macro style is the easiest and the most common found in examples.  It
can be defined as "at opertune times the application calls Tcl_Eval or
other Tcl_*".  In combination with some extended/custom commands in C,
this works pretty nice giving the script a way to work with the
application when you run it.

Where it gets tricky involves background work.  Say I want to create a
server socket and have the script do something when someone connects.
In order to discover that someone connects using this "macro" style of
embedding, I'd have to cause the script to block with [vwait].  The
problem here is that during this time the target app that Tcl is
embedded into is now frozen.  Or maybe with some "luck", if you're using
Tk too, Tcl will call GetMessage(), realize it isn't for itself, then
DispatchMessage() to your main app and hopefully we won't fall back into
ourselves and eat up all the stack space!

What to do, what to do??

We could add a WM_TIMER to the target to flush Tcl and do it every 0.5
second.

void OnTimer() {
    Tcl_DoOneEvent(TCL_DONT_WAIT);

Quote:
}

then we can change from [vwait] to [fileevent] for real background
processing.  That's better, but still isn't putting Tcl into a real wait
state.  The delays with Tk loaded are hideous.  In the source code,
there is an example in /unix for how to combine event loops, but isn't
windows friendly.  I tried and gave up..

Now how can I let Tcl sit in a true wait state ( a.k.a.
while(notDone)Tcl_DoOneEvent(TCL_ALL_EVENTS); )?  Wish (Tk's shell) does
that.

The answer is with threading.  What if Tcl is run, and restricted to, a
different thread from the application it is embedded into?  Then we can
have that thread initialize Tcl, source the main script, and drop into
the event loop just like wish does it.  There's no busy loop flushing
Tcl.  Tcl is now idle in it's own service loop and there isn't any odd
message loop interactions.

But how do we send work to it?  See TES, above.  That experiment adds a
posting method for jobs.  IOW, what was a direct call to Tcl_Eval(),
would become a post instead.

Here's an example, see the TclUp and TclDown classes in use in
WinMain():
http://cvs.sourceforge.net/viewcvs.py/tomasoft/tomahawk/irc_ui/win32/...



Sat, 05 Apr 2008 01:21:56 GMT  
 VC++ 6.0 GUP application with TCL 8.4
http://cvs.sourceforge.net/viewcvs.py/*checkout*/tomasoft/tes/OSCON2K...

Just some different wording from what I posted before.



Sat, 05 Apr 2008 02:59:29 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. VC++ 6.0 GUI application with TCL 8.4

2. debugging python extension modules with MS vc++ 6.0

3. tcl App-Wizard for VC++ 6.0

4. Need advice to compile Tcl/C under VC++ 6.0

5. VC 6.0 and Tcl/Tk

6. TCL 8.2.1 for Win98 under VC++ 6.0

7. Incr Tcl from CVS will not build with my VC++ 6.0 install

8. How To Compile Tcl/Tk with VC 6.0 ?

9. Compiling Tcl/Tk using VC++ 6.0

10. Install tcl 8.4 error, Can't find a usable init.tcl in the following directories

11. Tcl SOAP - Tcl 8.4?!?!?! (Immediate Need)

12. Tcl 7.4 to Tcl 8.4 porting issues

 

 
Powered by phpBB® Forum Software