Manual Pages for UNIX Darwin command on man itkWidget
MyWebUniversity

Manual Pages for UNIX Darwin command on man itkWidget

Widget(n) [incr Tk] Widget(n)

NAME

Widget - base class for mega-widgets within a frame

IINNHHEERRIITTAANNCCEE

itk::Archetype <- itk::Widget

SSTTAANNDDAARRDD OOPPTTIIOONNSS bbaacckkggrroouunndd ccuurrssoorr See the "options" manual entry for details on the standard options.

DESCRIPTION

The WWiiddggeett class inherits everything from the AArrcchheettyyppee class, and adds a Tk frame called the "hull" component to represent the body of the

mega-widget. The window class name for the hull is set to the most-

specific class name for the mega-widget. The protected variable

iittkkiinntteerriioorr contains the window path name for the "hull" component.

Derived classes specialize this widget by packing other widget compo-

nents into the hull. Since the hull for the WWiiddggeett class is implemented with a Tk frame,

mega-widgets in the WWiiddggeett class can be packed into other frames and

toplevels. CCOOMMPPOONNEENNTTSS Name: hhuullll Class: FFrraammee

The "hull" component acts as the body for the entire mega-wid-

get. Other components are packed into the hull to further spe-

cialize the widget. EEXXAAMMPPLLEE

The following example implements a simple TTeexxttDDiissppllaayy mega-widget. It

creates a read-only display of text with a text widget and a scrollbar.

option add *TextDisplay.wrap none widgetDefault option add *TextDis-

play.textBackground ivory widgetDefault option add *TextDisplay.width 40 widgetDefault option add *TextDisplay.height 10 widgetDefault class TextDisplay { inherit itk::Widget constructor {args} { itkcomponent add text {

text $itkinterior.info -state disabled

-yscrollcommand [code $itkinterior.sbar set]

} { usual

keep -tabs -wrap -width -height

rename -background -textbackground textBackground Back-

ground }

pack $itkcomponent(text) -side left -expand yes -fill both

itkcomponent add scrollbar {

scrollbar $itkinterior.sbar -command [code

$itkinterior.info yview]

}

pack $itkcomponent(scrollbar) -side right -fill y

eval itkinitialize $args

} public method display {info} public method append {info} } body TextDisplay::display {info} {

$itkcomponent(text) configure -state normal

$itkcomponent(text) delete 1.0 end

$itkcomponent(text) insert 1.0 $info

$itkcomponent(text) configure -state disabled }

body TextDisplay::append {info} {

$itkcomponent(text) configure -state normal

$itkcomponent(text) insert end $info

$itkcomponent(text) configure -state disabled }

usual TextDisplay {

keep -background -cursor -foreground -font

keep -activebackground -activerelief

keep -highlightcolor -highlightthickness

keep -insertbackground -insertborderwidth -insertwidth

keep -insertontime -insertofftime

keep -selectbackground -selectborderwidth -selectforeground

keep -textbackground -troughcolor }

# # EXAMPLE: Display the /etc/passwd file # TextDisplay .file -back-

ground red pack .file .file display [exec cat /etc/passwd] KKEEYYWWOORRDDSS

itk, Archetype, Widget, mega-widget

itk 3.0 Widget(n)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™