chiark / gitweb /
build system: debian/copyright file
[chiark-tcl-applet.git] / example
1 #!/usr/bin/wish -f
2 # -*- Tcl -*-
3
4 # Copyright 2016,2020 Ian Jackson
5 # SPDX-License-Identifier: GPL-3.0-or-later
6 # There is NO WARRANTY.
7
8 # usage:
9 #   .../example program arguments...
10 # will run
11 #   program arguments... WINDOWID
12 # and program sbould put up an X11 window as a child of WINDOWID
13 #
14 # eg, for a silly example:
15 #   .../example xterm -id
16
17 set lib .
18
19 source $lib/applet.tcl
20 source $lib/subproc.tcl
21 source $lib/utils.tcl
22
23 set debug::debug puts
24
25 foreach b {1 3} {
26     applet::setup-button-menu $b
27 }
28
29 .m1 add command -command { applet::msel; puts hi } -label hi
30 .m3 add command -command { applet::msel; puts boo } -label boo
31
32 #image create bitmap ims -file gs_s.xbm   
33 #image create bitmap ims -file /usr/share/ghostscript/8.71/lib/gs_s.xbm   
34 #setimage ims
35 #setimage ims
36
37 applet::setup-tooltip { puts VIS } { puts INVIS }
38 applet::tooltip-set "line\nanother"
39
40 proc cmdline {id orientation} {
41     global argv
42     return [concat $argv $id]
43 }
44
45 applet::setup-subproc cmdline