Repository URL to install this package:
|
Version:
7.26.0-0.2 ▾
|
# E N T R Y D I A L O G . I T K
# BRL-CAD
#
# Copyright (c) 2006-2016 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this file; see the file named COPYING for more
# information.
#
###
#
# NAME
# Entrydialog
#
# DESCRIPTION
# Standard entry dialog. Part of standard dialogs.
#
# AUTHOR
# Keith Bowman
# Doug Howard
# Bob Parker
#
##############################################################
#
# Usual options.
#
itk::usual Entrydialog {
keep -background -cursor -foreground -modality
keep -master -title -height -width
}
::itcl::class sdialogs::Entrydialog {
inherit ::iwidgets::Dialog
itk_option define -label label Label ""
constructor {args} {}
destructor {}
public {
method activate {}
method get {}
method insert {index string}
}
protected {
}
private {
}
}
#
# Provide a lowercased access method for the Dialog class.
#
proc ::sdialogs::entrydialog {pathName args} {
uplevel ::sdialogs::Entrydialog $pathName $args
}
# ------------------------------------------------------------
# CONSTRUCTOR
# ------------------------------------------------------------
::itcl::body sdialogs::Entrydialog::constructor {args} {
# remove unneeded buttons
delete Apply
delete Help
# configure OK & Cancel
buttonconfigure OK \
-defaultring yes \
-defaultringpad 1 \
-borderwidth 1 \
-pady 0
buttonconfigure Cancel \
-defaultring no \
-borderwidth 1 \
-pady 0
# add entry widget
set csite [childsite]
itk_component add entryfield {
::iwidgets::entryfield $csite.entryfield \
-labelvariable [::itcl::scope itk_option(-label)]
} {
keep -textbackground -labelpos -labelfont
rename -width -textwidth textWidth Width
}
pack $itk_component(entryfield) -padx 2 -pady 2 -fill x
eval itk_initialize $args
}
::itcl::body sdialogs::Entrydialog::destructor {} {
}
::itcl::body sdialogs::Entrydialog::activate {} {
focus -force [$itk_component(entryfield) component entry]
iwidgets::Shell::activate
}
::itcl::body sdialogs::Entrydialog::get {} {
return [$itk_component(entryfield) get]
}
::itcl::body sdialogs::Entrydialog::insert {index string} {
$itk_component(entryfield) insert $index $string
}
# Local Variables:
# mode: Tcl
# tab-width: 8
# c-basic-offset: 4
# tcl-indent-level: 4
# indent-tabs-mode: t
# End:
# ex: shiftwidth=4 tabstop=8