-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMessageInfo.itk
40 lines (34 loc) · 1.31 KB
/
MessageInfo.itk
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
# ----------------------------------------------------------------------
# EXAMPLE: using inheritance to specialize mega-widgets
# ----------------------------------------------------------------------
# COURSE: Object-Oriented Programming with [incr Tcl]
# AUTHOR: Michael J. McLennan, Bell Labs Innovations
# ======================================================================
# Copyright (c) 1996 Lucent Technologies
# ======================================================================
option add *MessageInfo.title "Notice" widgetDefault
class MessageInfo {
inherit Info
constructor {args} {
itk_component add message {
label $itk_interior.mesg -width 20
} {
usual
rename -text -message message Text
}
pack $itk_component(message) -expand yes -fill both
bind $itk_component(message) <Configure> [code $this resize]
eval itk_initialize $args
}
private method resize {} {
set w [winfo width $itk_component(message)]
if {$w > 1} {
$itk_component(message) configure -wraplength $w
}
}
}
usual MessageInfo {
keep -background -cursor -foreground -font
keep -activebackground -activeforeground -disabledforeground
keep -highlightcolor -highlightthickness
}