| Ticket UUID: | 564897 | |||
| Title: | application doesn't activate | |||
| Type: | Bug | Version: | None | |
| Submitter: | rhedin | Created on: | 2002-06-05 15:35:21 | |
| Subsystem: | 68. Win Window Operations | Assigned To: | oehhar | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-10-19 16:34:09 | |
| Resolution: | Fixed | Closed By: | oehhar | |
| Closed on: | 2026-10-19 16:34:09 | |||
| Description: |
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
| |||
| User Comments: |
oehhar added on 2026-10-19 16:34:09:
main branch:
Other branches will follow. Thanks Serghey. Closing, Harald serhiy.storchaka added on 2026-09-22 06:29:42: Added test winWm-12.1 in [b81bf0ffc8]: WM_MOUSEACTIVATE whose top-level parent is a non-Tk window now returns MA_ACTIVATE (it returned MA_NOACTIVATE before). It uses a new test command testforeignwindow (win/tkWinTest.c), which returns a hidden non-Tk toplevel window, and testwinevent now supports WM_MOUSEACTIVATE and returns the result of the message. The branch for [90f5cd3f21] also changes win/tkWinTest.c and tests/constraints.tcl (a different command); merging both will conflict there, and both additions should be kept. serhiy.storchaka added on 2026-09-19 15:01:18: Applied the suggested change: a non-Tk toplevel into which the Tk window has been reparented is now activated as usual. Fixed in [8089b446cf] (branch win-mouseactivate-foreign-toplevel). davygrvy added on 2002-06-05 23:49:18: 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 davygrvy added on 2002-06-05 23:39:01: File Added - 24445: patch.txt Logged In: YES user_id=7549 diff format file of above attached. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki