home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
propifelem.tcl
< prev
next >
Wrap
Text File
|
1996-12-17
|
3KB
|
117 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1996
#
# File: @(#)propifelem.tcl /main/hindenburg/4
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)propifelem.tcl /main/hindenburg/4 17 Dec 1996 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
global valueMethod
global labelMethod
set valueMethod(CheckButton) state
set labelMethod(CheckButton) label
set valueMethod(ComboBox) text
set valueMethod(DropDwnComboBox) text
set valueMethod(DropDwnList) selected
set valueMethod(FloatField) text
set valueMethod(HorControlPanel) selected
set valueMethod(HorRadioGroup) selected
set valueMethod(Image) pixmap
set valueMethod(IntField) text
set valueMethod(Label) text
set valueMethod(MultiLineText) text
set valueMethod(OptionMenu) selected
set valueMethod(SingleLineText) text
set valueMethod(TextList) selectedSet
set valueMethod(VerControlPanel) selected
set valueMethod(VerRadioGroup) selected
require "propifdefs.tcl"
# End user added include file section
require "propinterf.tcl"
Class PropIfElement : {PropInterface} {
method destructor
constructor
method getProperties
method setProperties
}
method PropIfElement::destructor {this} {
# Start destructor user section
# End destructor user section
$this PropInterface::destructor
}
constructor PropIfElement {class this guiParent propDef} {
set this [PropInterface::constructor $class $this]
$this definition $propDef
set name [$propDef name]
set class [$propDef ifClass]
global valueMethod labelMethod
if {![PropIfElement::canHandle $class]} {
error "Invalid interface class '$class'"
}
if [info exists labelMethod($class)] {
$this ifElement [eval $class new $guiParent.$name \
[$propDef ifOptions]]
[$this ifElement] $labelMethod($class) [$propDef longName]
} else {
Label new $guiParent.${name}l -text [$propDef longName]
$this ifElement [eval $class new $guiParent.$name \
[$propDef ifOptions]]
}
return $this
}
proc PropIfElement::defaultValue {className elm} {
global hasEntrySet defIndex
if [info exists defIndex($className)] {
if [info exists hasEntrySet($className)] {
return [lindex [$elm entrySet] $defIndex($className)]
}
return $defIndex($className)
}
return ""
}
proc PropIfElement::canHandle {className} {
global valueMethod
return [info exists valueMethod($className)]
}
method PropIfElement::getProperties {this propContainer} {
global valueMethod
set def [$this definition]
set key [$def name]
set class [$def ifClass]
set elem [$this ifElement]
set value [$propContainer getPropertyValue $key]
if {[string length $value] == 0} {
set value [PropIfElement::defaultValue $class $elem]
}
$elem $valueMethod($class) $value
$elem sensitive [$propContainer isPropertyEditable $key]
}
method PropIfElement::setProperties {this propContainer} {
global valueMethod
set def [$this definition]
set elem [$this ifElement]
set class [$def ifClass]
set value [$elem $valueMethod($class)]
set defVal [PropIfElement::defaultValue $class $elem]
$propContainer changeProperty [$def name] $value $defVal
}
# Do not delete this line -- regeneration end marker