From: SourceForge.net <no...@so...> - 2004-10-01 22:35:29
|
Bugs item #1038760, was opened at 2004-10-01 15:35 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1038760&group_id=12997 Category: 70. Event Loop Group: None Status: Open Resolution: None Priority: 5 Submitted By: Niraj (nirajvdesai) Assigned to: Jeffrey Hobbs (hobbs) Summary: Tcl_DoOneEvent doesn't return when modal dialog is open. Initial Comment: I have a problem with Tcl_DoOneEvent when used with modal dialog box. I am using C-Tcl/Tk interface on linux platform with C as backend and Tcl/Tk as GUI front end. In C program I use the call Tcl_DoOneEvent to service all Tcl events. If TCL_DONT_WAIT flag is specified with this call, this call should return when there are no events to handle. It does return normally, but not when a modal dialog is opened in Tcl/Tk. Thus, when a modal dialog box is opened, my C program is effectively 'blocked' and I cannot use C program to update display in GUI front end. I have attached a sample C and Tcl program to simulate this problem. It can be compiled for linux with gcc -o tclmodal main.c -ltcl8.4 -tk8.4 Following is the event loop shown here from attached file main.c while (TclIsRunning) { while (Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT)); printf("Returned from Tcl_DoOneEvent "); usleep(10); } When you run tclmodal, it will repeatedly print "Returned from Tcl_DoOneEvent". But if you click File->Open, it will open a dialog box and you will see that print messages are stopped indicating that Tcl_DoOneEvent has not returned. Closing the dialog box will resume printf messages. Can anybody explain this behavior of Tcl_DoOneEvent and help me find a solution so that my C program is not 'blocked' when modal dialog box is open ? I would really appreciate the help. The file attached is : main.c I could attach only one file with the tracker, so I have printed here contents of modaldlg.tcl. Just copy following part to modaldlg.tcl file and run C application. # modaldlg.tcl file for eventloop testing . configure -menu .mbar menu .mbar .mbar add cascade -label "File" -menu .mbar.file menu .mbar.file -tearoff 0 .mbar.file add command -label "Open..." -command {set openFile [tk_getOpenFile - title "Select File to Open"]} ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1038760&group_id=12997 |