aboutsummaryrefslogtreecommitdiff
path: root/pd/tcl/pdtk_text.tcl
blob: bb37ccc3c4514e0e8e41f6c271573beca1aea7a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

package provide pdtk_text 0.1

############ pdtk_text_new -- create a new text object #2###########
proc pdtk_text_new {mycanvas canvasitem x y text font_size color} {
    $mycanvas create text $x $y -tags $canvasitem -text $text -fill $color \
        -anchor nw -font [get_font_for_size $font_size]
    $mycanvas bind $canvasitem <Home> "$mycanvas icursor $canvasitem 0"
    $mycanvas bind $canvasitem <End> "$mycanvas icursor $canvasitem end"
    if {$::windowingsystem eq "aqua"} { # emacs bindings for Mac OS X
        $mycanvas bind $canvasitem <Control-a> "$mycanvas icursor $canvasitem 0"
        $mycanvas bind $canvasitem <Control-e> "$mycanvas icursor $canvasitem end"
    }
}

################ pdtk_text_set -- change the text ##################
proc pdtk_text_set {mycanvas canvasitem text} {
    $mycanvas itemconfig $canvasitem -text $text
}