This document applies to the 3.4.1, 3.5.1, and 3.6.5 releases of TkXext.  It may 
work with future releases as well.

TkXext is a Tcl/Tk extension that provides the ability to:

 o find desktop windows via a titlename

 o embed desktop windows into Tk frames or toplevels

 o record events and play them back

 o send strings to windows
 
 o resize embedded windows or other windows for which you have an id 


This tutorial will teach you how to record events, playback events, find 
windows, and reparent/embed windows into Tk frames.


-- Record/Playback Events -- 

When you compiled TkXext a shared library and an executable should have been 
built.  TkXext.record.bin is used to record events that occur on the X server.  
You can redirect it to a script like so:

 ./TkXext.record.bin > script

To stop recording press the Pause/Break key or type Ctrl-c.

You can view the script with a text editor.  

Now let's try to playback the script.  First we have to have a little script 
that evalutes it.  TkXext comes with a playback.tcl script which you can use 
like so:

 wish8.4 playback.tcl script


It's often desirable to use a pattern like:
 sleep 4 ; echo CHEESE ; ./TkXext.record.bin > script

If you're testing in Xnest you may also find it useful to do a similar pattern 
before you have activated the Xnest window.

-- Finding a Window --

Each toplevel window in X has a window id.  We can use the window id to embed an 
application into another application, or resize/move it.

For example:
package require TkXext

set id [TkXext.find.window "FOO BAR"]

If TkXext is unable to find the window named "FOO BAR" id will have the value 0.


-- Reparenting/Embedding a Window --

Now we shall demonstrate how to reparent/embed the id into a Tk window:

package require TkXext

proc main {} {
 set id [TkXext.find.window "FOO BAR"]
 if {0 == $id} return

 pack [frame .f] -fill both -expand 1

 TkXext.reparent.window $id [winfo id .f]
}
main

We should now have the application with the window title of "FOO BAR" reparented 
into our Tk frame .f

If we resize .f you will find that our $id window doesn't grow.  We can fix this 
by binding .f to <Configure> and adding a proc that calls TkXext.resize.window 
$id $width $height.


By now you should know how to record events, playback events, find windows via 
the title, and reparent or embed windows into Tk frames.

For further information please read the demo.tcl code.
