Tk in C: I am going insane 
Author Message
 Tk in C: I am going insane

Quote:

>Hello everyone-
>    I am having a real problem with tk -> C.  What I want to do is
>to call, from a C program, a C function which will draw a tk window.  Not
>a problem, I have been able to do this.  The problem is, after the window
>is displayed, I want the function to return to the main program, where
>other C functions will be called to change the configuration options of
>the window.  The problem comes from event handling: if I use TkMainLoop()
>in the window-initialization function, the TkMainLoop() won't return
>without the window being killed.  If I use TkDoOneEvent(), it creates
>the window then exits the function, and the window is nowhere to be
>seen.  I need to create the window, then return to the main C program
>(with the window still displayed and active), where I can call functions
>to reconfigure the window.  How can I get the window to stay up and
>active but return control to main()?  Anyone who can answer this will
>be my hero.

Try doing an update (via Tcl_Eval) in your function.

==========================================================================
* Gerald W. Lester                        !   Voice:  (504)-889-2784     *
* Computerized Processes Unlimited        !   FAX:    (504)-889-2799     *

* Metairie, LA  70001                     !   Hours:  09:00-17:00 CDT    *
==========================================================================



Tue, 15 Apr 1997 01:12:27 GMT  
 Tk in C: I am going insane

   Hello everyone-
           I am having a real problem with tk -> C.  What I want to do is
   to call, from a C program, a C function which will draw a tk window.  Not
   a problem, I have been able to do this.  The problem is, after the window
   is displayed, I want the function to return to the main program, where
   other C functions will be called to change the configuration options of
   the window.  The problem comes from event handling: if I use TkMainLoop()
   in the window-initialization function, the TkMainLoop() won't return
   without the window being killed.  If I use TkDoOneEvent(), it creates
   the window then exits the function, and the window is nowhere to be
   seen.  I need to create the window, then return to the main C program
   (with the window still displayed and active), where I can call functions
   to reconfigure the window.  How can I get the window to stay up and
   active but return control to main()?  Anyone who can answer this will
   be my hero.

Did you try doing an update after creating the window?

char cmd[200];
sprintf( cmd, "button %s -text %s -command %s; update", win_name, text,
         button_cmd );
Tcl_Eval( interp, cmd );

--
Ed Karrels

What's the height of optimism?  A trombonist with a beeper.



Wed, 16 Apr 1997 03:03:37 GMT  
 Tk in C: I am going insane
I suspect that Tk will only draw the window when it is idle.  Thus it
might help if you called Tk_DoOneEvent with the flag TK_IDLE_EVENTS.
--
<A HREF="http://www.cs.hut.fi/~sti/">Sami Tikka</A>
"Peace and Long Life."
"Live Long and Prosper."


Thu, 17 Apr 1997 07:20:58 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Am I completely insane?...

2. Running CGIs under my uid - going slowly insane.

3. tcl dates - weird bug or am I going insane???

4. ANNOUNCE: ftp.cs.berkeley.edu archive going away

5. I am going to start assembly programming

6. am i gonna go down in flames??

7. Am stupid and now going crazy...

8. to CS: or not to CS: in F-PC assembler

9. I am wondering what I am going to do with the following simulation error.

10. Ruby/Tk, what am I doing wrong...

11. I am looking for Tcl/Tk training courses

12. Help - I am a novice tcl/tk user...

 

 
Powered by phpBB® Forum Software