Container for embedding windows of other processes.
Synopsis
gnocl::socket [-option value...]
Screenshot
Options
- -plugID WindowID
- ID of the window to be embedded.
- -onPlugAdded string (default: "")
- Tcl command which is executed if the plug window is added. Before evaluation the following percent strings are substituted:
%w widget name
- -onPlugRemoved string
- Tcl command which is executed if the plug window is removed. Before evaluation the following percent strings are substituted:
%w widget name
- -visible boolean (default: 1)
- Whether or not the item is visible.
Description
A socket can embed a window from another process using the XEMBED protocol. The GUI of the other process does not have to be written in GTK+ or Gnocl. Qt, Tcl/Tk or pure X should work just fine. If the other side uses Gnocl, it should use the plug widget. The plug widget can either be embedded by setting the -socketID option, or by setting the -plugID option of the socket.
Commands
- id delete
- Deletes the widget and the associated tcl command.
- id configure [-option value...]
- Configures the widget. Option may have any of the values accepted on creation of the widget.
- id getID
- Returns the window ID of the socket widget.
- id getPlugID
- Returns the window ID of the plug widget.
Example
exec wish "$0" "$@"
package require Gnocl
#-------- Create some Tk objects --------
wm state . withdrawn ;# hide tk main window
#-------- Create a Gnocl container --------
set box [gnocl::box -orientation vertical]
gnocl::window -title "Socket" -child $box
set menubar [gnocl::menuBar]
set menu [gnocl::menu]
$menu add [gnocl::menuItem \
-text "%#Quit" \
-onClicked exit]
$menubar add [gnocl::menuItem \
-text "%__File" \
-submenu $menu]
$box add $menubar -expand 0
set socket [gnocl::socket]
$box add $socket
gnocl::update
#-------- More Tk instructions --------
toplevel .embed -use [format "0x%x" [$socket getID]]
button .embed.but -text "tk in Gnocl" -command {puts "Hello tk!"}
pack .embed.but
update
wm minsize .embed [winfo reqwidth .embed] [winfo reqheight .embed]
results in
|