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

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Westmount Technology    1994
  4. #
  5. #      File:           @(#)editseldia.tcl    /main/titanic/2
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)editseldia.tcl    /main/titanic/2   2 Oct 1997 Copyright 1994 Westmount Technology
  10.  
  11. # Start user added include file section
  12.  
  13. require wmt_util.tcl
  14.  
  15. # End user added include file section
  16.  
  17.  
  18. Class EditSelDialog : {TemplateDialog} {
  19.     constructor
  20.     method destructor
  21.     method handleEdit
  22.     method handleHelp
  23.     method handleSelectionChanged
  24.     method popUp
  25.     method text
  26.     attribute entrySet
  27.     attribute editPressed
  28.     attribute message
  29. }
  30.  
  31. constructor EditSelDialog {class this name} {
  32.     set this [TemplateDialog::constructor $class $this $name]
  33.     # Start constructor user section
  34.  
  35.     interface DlgColumn $this.top {
  36.         Label message {}
  37.         ComboBox list {
  38.             rowCount 10
  39.         }
  40.     }
  41.     PushButton new $this.edit \
  42.         -label Edit \
  43.         -activated "$this handleEdit"
  44.     $this config \
  45.         -modal yes \
  46.         -helpPressed "$this handleHelp"
  47.     $this.top.list textModified "$this handleSelectionChanged"
  48.  
  49.     # End constructor user section
  50.     return $this
  51. }
  52.  
  53. method EditSelDialog::destructor {this} {
  54.     # Start destructor user section
  55.     # End destructor user section
  56. }
  57.  
  58. method EditSelDialog::handleEdit {this} {
  59.     $this popDown
  60.     set doDelete [regsub -all "$this delete" "[$this okPressed]" "" okPressed]
  61.     eval $okPressed
  62.     eval [$this editPressed]
  63.     if $doDelete {
  64.     $this delete
  65.     }
  66. }
  67.  
  68. method EditSelDialog::handleHelp {this} {
  69.     [getParent $this] helpOnName [nt_get_type $this]
  70. }
  71.  
  72. method EditSelDialog::handleSelectionChanged {this} {
  73.     if {"[rmWhiteSpace [$this text]]" == ""} {
  74.     set selected 0
  75.      } else {
  76.     set selected 1
  77.     }
  78.     $this okSensitive $selected
  79.     $this okDefault $selected
  80.     $this cancelDefault [expr 1 - $selected]
  81.     $this.edit config \
  82.     -sensitive $selected \
  83.     -default 0
  84. }
  85.  
  86. method EditSelDialog::popUp {this} {
  87.     $this.top.message text [$this message]
  88.     set entrySet [$this entrySet]
  89.     $this.top.list config -entrySet $entrySet
  90.     $this handleSelectionChanged
  91.     $this TemplateDialog::popUp
  92. }
  93.  
  94. method EditSelDialog::text {this} {
  95.     return [$this.top.list text]
  96. }
  97.  
  98. # Do not delete this line -- regeneration end marker
  99.  
  100.