gtkSocketNew(show = TRUE)
gtkSocketSteal(object, wid)
gtkSocketAddId(object, window.id)
gtkSocketGetId(object)
gtkSocket(show = TRUE)
gtkSocketGetId
. Before using this function,
the socket must have been realized, and for hence,
have been added to its parent.Obtaining the window ID of a socket. socket <- gtkSocket() parent$add(socket)
## The following call is only necessary if one of
## the ancestors of the socket is not yet visible.
socket$realize()
print(paste("The ID of the sockets window is", socket$getId()))
Note that if you pass the window ID of the socket to another
process that will create a plug in the socket, you
must make sure that the socket widget is not destroyed
until that plug is created. Violating this rule will
cause unpredictable consequences, the most likely
consequence being that the plug will appear as a
separate toplevel window. You can check if the plug
has been created by examining the
plug_window
field of the
NULL
,
then the plug has been successfully created inside
of the socket.
When GTK+ is notified that the embedded window has been
destroyed, then it will destroy the socket as well. You
should always, therefore, be prepared for your sockets
to be destroyed at any time when the main event loop
is running. To prevent this from happening, you can
connect to the gtkSocketSteal
,
though the integration when this is done will not be as close
as between a
gtkSocket
is the equivalent of gtkSocketNew
.