aboutsummaryrefslogtreecommitdiff
path: root/test/toxy/testmess.wid
blob: 0481e2f9c17607d14338d18e91c99102a0094833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
puts "setup script: evaluated once per Pd session"

proc testmess_list {path target args} {
    set sum 0
    foreach a $args {
        incr sum $a
    }
    set lb [concat [lindex $args 0]]
    foreach a [lrange $args 1 end] {
        lappend lb + $a
    }
    lappend lb = $sum
    set [$path cget -textvariable] $lb
    pd [concat $target _cb $sum \;]
}

proc testmess_command {path} {
    pd [concat lb set [set [$path cget -textvariable]] \;]
}

#> testmess button
#. -bg green -wraplength 350 -text test
#. -command [concat testmess_command .-]
#. @bang .- invoke
#. @float testmess_list .- .| .#args
#. @list testmess_list .- .| .#args

puts "\nwidget initializer: evaluated whenever a Tk widget is created"
puts "which may happen several times during Pd object\'s lifetime"
puts "widget needs reinitializing after:"
puts ". closing and reopening of a subpatch window"
puts ". minimizing and maximizing a window"
puts ". switching virtual desktops"

#@ new
puts "\nconstructor: evaluated once per Pd object"
puts "(after Pd object creation, before Tk widget creation)"

#@ vis
puts "another initializer part added from \"#@ vis\" block"

#@ free
puts "\ndestructor: evaluated once, after Pd object destruction"
puts "(Tk widget should be already gone)"

#@ ini
puts "yet another initializer part added from \"#@ ini\" block"