chiark / gitweb /
wip subwindow
[chiark-tcl-applet.git] / example
diff --git a/example b/example
index 3b45d0bd19e76c23033e9ccb4fa7a89f1258f95d..b1a9c862236e90c57b6bc0196f1c00d64d51ad83 100755 (executable)
--- a/example
+++ b/example
@@ -2,25 +2,30 @@
 # -*- Tcl -*-
 
 source applet.tcl
+source subproc.tcl
 
-#----- specifics -----
+#----- menu -----
 
-.m1 add command -command { msel; puts hi } -label hi
-.m3 add command -command { msel; puts boo } -label boo
+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 gs_s.xbm   
 #image create bitmap ims -file /usr/share/ghostscript/8.71/lib/gs_s.xbm   
 #setimage ims
 #setimage ims
 
-setuptooltip
-settooltip "line\nanother"
+applet::setup-tooltip { puts VIS } { puts INVIS }
+applet::tooltip-set "line\nanother"
 
 fconfigure stdout -buffering line
 
 set status none
 
-proc innerwindow-destroying {} {
+proc destroying {} {
     global status
     puts "DESTROYING $status"
     switch -exact $status {
@@ -30,7 +35,7 @@ proc innerwindow-destroying {} {
     }
 }
 
-proc innerwindow-ready {} {
+proc ready {} {
     global status
     puts "READY $status"
     switch -exact $status {
@@ -64,7 +69,7 @@ proc run-child {} {
     }
 
     set status none
-    set status [fork-then child-died {
+    set status [subproc::fork child-died {
        execl xacpi-simple [list -into [winfo id .i.i.b.c]]
     }]
     puts "FORKED $status"
@@ -85,4 +90,4 @@ proc child-died {how how2} {
     }
 }
 
-setupinnerwindow 40
+applet::setup-subwindow 40 destroying ready