X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=example;h=7cf6b15111ecee755463996772bece81ca484260;hb=9ab567c4ba2e3627372f9b39733297ac3df93fb4;hp=57e87083d5bf1a19d295895efac94dbd50749e6a;hpb=0349c2ee7dd8de362873aa14e63aa4e8f91b5009;p=chiark-tcl-applet.git diff --git a/example b/example index 57e8708..7cf6b15 100755 --- a/example +++ b/example @@ -1,14 +1,45 @@ -#!/usr/bin/wish8.4 +#!/usr/bin/wish -f +# -*- Tcl -*- -source applet.tcl +# Copyright 2016,2020 Ian Jackson +# SPDX-License-Identifier: GPL-3.0-or-later +# There is NO WARRANTY. -#----- specifics ----- +# usage: +# .../example program arguments... +# will run +# program arguments... WINDOWID +# and program sbould put up an X11 window as a child of WINDOWID +# +# eg, for a silly example: +# .../example xterm -id -.m1 add command -command { msel; puts hi } -label hi -.m3 add command -command { msel; puts boo } -label boo +set lib . -image create bitmap ims -file /usr/share/ghostscript/8.71/lib/gs_s.xbm -setimage ims +source $lib/applet.tcl +source $lib/subproc.tcl +source $lib/utils.tcl -setuptooltip -settooltip "line\nanother" +set debug::debug puts + +foreach b {1 3} { + applet::setup-button-menu $b +} + +.m1 add command -command { applet::msel; puts hi } -label hi +.m3 add command -command { applet::msel; puts boo } -label boo + +#image create bitmap ims -file gs_s.xbm +#image create bitmap ims -file /usr/share/ghostscript/8.71/lib/gs_s.xbm +#setimage ims +#setimage ims + +applet::setup-tooltip { puts VIS } { puts INVIS } +applet::tooltip-set "line\nanother" + +proc cmdline {id orientation} { + global argv + return [concat $argv $id] +} + +applet::setup-subproc cmdline