home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / komix / DATA.Z / rwaccessro.tcl < prev    next >
Text File  |  1997-02-21  |  3KB  |  93 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)rwaccessro.tcl    /main/titanic/3
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)rwaccessro.tcl    /main/titanic/3   21 Feb 1997 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12.  
  13. require "propifelem.tcl"
  14.  
  15. # End user added include file section
  16.  
  17. require "propinterf.tcl"
  18.  
  19. Class RWAccessRow : {PropInterface} {
  20.     method destructor
  21.     constructor
  22.     method getProperty
  23.     method getProperties
  24.     method setProperties
  25.     method setValue
  26.     method getValue
  27.     attribute writeAcc
  28.     attribute readAcc
  29. }
  30.  
  31. method RWAccessRow::destructor {this} {
  32.     # Start destructor user section
  33.     # End destructor user section
  34.     $this PropInterface::destructor
  35. }
  36.  
  37. constructor RWAccessRow {class this guiParent propDef} {
  38.     set this [PropInterface::constructor $class $this]
  39.     set grp [NamedGroup new $guiParent.[$propDef name]Group \
  40.         -verStretchFactor 0 -label [$propDef longName]]
  41.     set row [DlgRow new $grp.[$propDef name]Row]
  42.     set rcol [DlgColumn new $row.[$propDef name]ReadColumn]
  43.     set wcol [DlgColumn new $row.[$propDef name]WriteColumn]
  44.     Label new $rcol.OptMnuLab -text Read
  45.     Label new $wcol.OptMnuLab -text Write
  46.     $this config -definition $propDef -ifElement $grp \
  47.         -readAcc  [eval OptionMenu new $rcol.OptMnu [$propDef ifOptions]] \
  48.         -writeAcc [eval OptionMenu new $wcol.OptMnu [$propDef ifOptions]]
  49.     return $this
  50. }
  51.  
  52. method RWAccessRow::getProperty {this elm value sensitive} {
  53.     set ifOpts [[$this definition] ifOptions]
  54.     if {$value == ""} {
  55.         set value [PropIfElement::defaultValue OptionMenu $ifOpts]
  56.     }
  57.     $elm selected $value
  58.     $elm sensitive $sensitive
  59. }
  60.  
  61. method RWAccessRow::getProperties {this propContainer} {
  62.     set key [[$this definition] name]
  63.     set value [$propContainer getPropertyValue $key]
  64.     set sensitive [$propContainer isPropertyEditable $key]
  65.     $this setValue $value $sensitive
  66. }
  67.  
  68. method RWAccessRow::setProperties {this propContainer} {
  69.     set key [[$this definition] name]
  70.     set ifOpts [[$this definition] ifOptions]
  71.     set def [PropIfElement::defaultValue OptionMenu $ifOpts]
  72.     $propContainer changeProperty $key "[$this getValue]" "${def}-$def"
  73. }
  74.  
  75. method RWAccessRow::setValue {this value {sensitive 1}} {
  76.     set rVal ""
  77.     set wVal ""
  78.     if {"$value" != ""} {
  79.         set sep [string last "-" $value]
  80.         set rVal [string range $value 0 [expr $sep - 1]]
  81.         set wVal [string range $value [expr $sep + 1] end]
  82.     }
  83.     $this getProperty [$this readAcc]  $rVal $sensitive
  84.     $this getProperty [$this writeAcc] $wVal $sensitive
  85. }
  86.  
  87. method RWAccessRow::getValue {this} {
  88.     return "[[$this readAcc] selected]-[[$this writeAcc] selected]"
  89. }
  90.  
  91. # Do not delete this line -- regeneration end marker
  92.  
  93.