| Ticket UUID: | 3609871 | |||
| Title: | Tk 8.5.13 shall not complain about non-container widget | |||
| Type: | RFE | Version: | None | |
| Submitter: | wkechel | Created on: | 2013-04-03 08:33:27 | |
| Subsystem: | 74. Application Embedding | Assigned To: | hobbs | |
| Priority: | 7 High | Severity: | ||
| Status: | Closed | Last Modified: | 2026-11-13 16:24:57 | |
| Resolution: | Out of Date | Closed By: | serhiy.storchaka | |
| Closed on: | 2026-11-13 10:36:57 | |||
| Description: |
Under Windows, Tk complains when using an external widget (via -use) and raises a dialog to allow the user to use/abandon the usage. This may be fine for the general case, but it is useless when Tk is used via th eTcl plugin. I am currently working on a massive update of the tcl plugin using TclTk 8.5.13+ in latest firefix/chromium/... browsers and this dialog is annoying. Here is a patch to fix the behaviour in win/tkWinEmbed.c:TkpUseWindow that avoids to open the dialog when Tk is run inside the plugin. The test is simple but works fine.
if (id == PTR2INT(hwnd)) {
if (!SendMessage(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) {
Tcl_AppendResult(interp, "The container is already in use", NULL);
return TCL_ERROR;
}
} else if (id == -PTR2INT(hwnd)) {
Tcl_AppendResult(interp, "the window to use is not a Tk container",
NULL);
return TCL_ERROR;
} else {
/* wke: perform check only when not in plugin! */
if(!Tcl_GetVar2(interp,"plugin","patchLevel",TCL_GLOBAL_ONLY)) {
/*
* Proceed if the user decide to do so because it can be a legacy
* container application. However we may have to return a TCL_ERROR in
* order to avoid bug 1096074 in future.
*/
char msg[256];
sprintf(msg, "Unable to get information of window \"%.80s\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string);
if (IDCANCEL == MessageBox(hwnd, msg, "Tk Warning",
MB_OKCANCEL | MB_ICONWARNING)) {
Tcl_SetResult(interp, "Operation has been canceled", TCL_STATIC);
return TCL_ERROR;
}
}
}
| |||
| User Comments: |
serhiy.storchaka added on 2026-11-13 10:36:57:
The Tcl browser plugin cannot be used any more: browsers have dropped NPAPI plugins. Closing. wkechel added on 2013-04-03 15:33:31: File Added - 462243: tkWinEmbed.c | |||
Attachments:
- tkWinEmbed.c [download] added by wkechel on 2013-04-03 15:33:31. [details]
