1# ---------------------------------------------------------------------- 2# EXAMPLE: using mega-widgets as components 3# ---------------------------------------------------------------------- 4# COURSE: Object-Oriented Programming with [incr Tcl] 5# AUTHOR: Michael J. McLennan, Bell Labs Innovations 6# ====================================================================== 7# Copyright (c) 1996 Lucent Technologies 8# ====================================================================== 9 10option add *TextInfo.title "Text" widgetDefault 11 12class TextInfo { 13 inherit Info 14 15 constructor {args} { 16 itk_component add textArea { 17 TextDisplay $itk_interior.txt -scrollbar auto 18 } { 19 usual 20 keep -wrap -tabs 21 rename -font -textfont textFont Font 22 } 23 pack $itk_component(textArea) -expand yes -fill both 24 25 eval itk_initialize $args 26 } 27 28 public method display {args} { 29 eval $itk_component(textArea) display $args 30 } 31 32 public method append {args} { 33 eval $itk_component(textArea) append $args 34 } 35} 36 37usual TextInfo { 38 keep -background -cursor -foreground -font 39 keep -activebackground -activeforeground -activerelief 40 keep -disabledforeground 41 keep -highlightcolor -highlightthickness 42 keep -insertbackground -insertborderwidth -insertwidth 43 keep -insertontime -insertofftime 44 keep -selectbackground -selectborderwidth -selectforeground 45 keep -textbackground -troughcolor 46} 47