If yours is an embedded application, clicking a widget in
a Tk window may not activate your application. It will fail
to activate it if your main window is a Windows window.
Following is some code from the WmProc function in
the tkWinWm.c file that I found solves the problem.
case WM_MOUSEACTIVATE: {
ActivateEvent *eventPtr;
winPtr = GetTopLevel((HWND) wParam);
/*
* If you have Tcl embedded in a C
application,
* your Windows windows may be above
your Tcl windows
* in the window hierarchy. In this case,
the message
* goes to the main application window.
Since the application
* window is above all the Tk windows, and
isn't a Tk window itself,
* when we try to "get its toplevel" we get
a null pointer.
* The result is that the applicate
doesn't activate
* if we click a widget in the application.
The !winPtr || portion
* ensures that the message is passed
through and
* the application activates.
*/
if (!winPtr || winPtr && (TkGrabState
(winPtr) != TK_GRAB_EXCLUDED)) {
/*
* This allows us to pass the
message onto the
* native menus [Bug: 2272]
*/
result = DefWindowProc(hwnd,
message, wParam, lParam);
goto done;
}
I hope that correct operation of Tk in an embedded
context is a priority for the Tcl community.
Regards,
Rick
Logged In: YES
user_id=7549
diff format file of above attached.
Logged In: YES
user_id=7549
To avoid interactions of Tk's message pump with your
windows application, you could consider running all of Tcl in a
seperate thread from your hosting application.
http://prdownloads.sourceforge.net/tomasoft/tes-1.4.zip