I was exploring the possibility to embed a Tk window in
a window owned by another program and so I first tried
the following script:
exec wish -use [winfo id .] &
in the console window under Windows 98 and Windows XP
(using 8.4.1 repsectively 8.4.5).
This causes a crash (a messagebox with an application
error comes up - memory referenced at some invalid
address or a message of similar wordings)
Logged In: YES
user_id=493507
I think you don't use the fonctionnality well.
Try:
frame .f -container 1
pack .f
exec wish -use [winfo id .f] &
The second wish will be displayed inside .f.
Anyway, this shouldn't crash.
The code responsible of the crash is in TkWinEmbed.c (1.7),
at the start of TkWinEmbeddedEventProc(), when the Container
structure is searched.
tsdPtr->firstContainerPtr is NULL.
Logged In: YES
user_id=400048
Yes, that does indeed do the trick. Thanks.
The remaining problem now is: how can I embed a Tk window in
another application? (Well, that is a different question
altogether.)
Okay, the code fragment I found in the book by Brent Welch
was not very explicit about the frame (it is there, but I
overlooked that line and it is not clear that this is
essential). More importantly: the man page for wish does not
mention a container at all
Logged In: YES
user_id=79902
Clarified wish.1; leaving bug open as we might wish to
consider whether we can to things to stop the crash from
happening.
Logged In: YES
user_id=80530
backport.
Logged In: YES
user_id=191079
With the latest change in Tk85, a warning dialog box will pop
up to indicate a failure of container identification if the use-
window is not a container. It is up to the user to choose
either proceeding for attachment or cancel since we can't
expect all Tk container applications will be able to do or have
done the identification correctly in processing attach
request. In the latest Tk85, I'm not able to duplicate the
crash with a use-id of a non-container Tk window. I did my
tests in Windows XP Pro (SP2)