home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)selectitem.tcl /main/titanic/2
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)selectitem.tcl /main/titanic/2 19 Nov 1996 Copyright 1994 Westmount Technology
-
- # Start user added include file section
- # End user added include file section
-
-
- Class SelectItem : {ListDialog} {
- constructor
- method destructor
- method popUp
- method handleOk
- attribute itemList
- attribute editor
- }
-
- constructor SelectItem {class this name} {
- set this [ListDialog::constructor $class $this $name]
- # Start constructor user section
- $this config -okPressed {%this handleOk} \
- -cancelPressed {%this delete} \
- -helpPressed {.main helpOnName selectOne} \
- -selectionPolicy BROWSE \
- -rowCount 10 \
- -font "courier-normal-12" \
- -message "Select item:" \
- -title Items
- # End constructor user section
- return $this
- }
-
- method SelectItem::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method SelectItem::popUp {this} {
- set ed [$this editor]
- set editorArea [$ed editorArea]
- if [catch {set selComps [$editorArea getSelectedComponents]} msg] {
- wmtkerror $msg
- uplevel #0 [$this cancelPressed]
- return
- }
- set localItems ""
- set localItemNames ""
- foreach obj $selComps {
- set indent [$ed indent [$obj type]]
- if {[$obj getProperty initiator] == 1} {
- set condition "INITIATOR"
- } elseif {[$obj getProperty key] == 1} {
- set condition "KEY"
- } else {
- set condition "NOKEY"
- }
- foreach lab [$obj labelSet] {
- foreach itm [$lab itemRefSet] {
- set objName $indent[$itm itemName]
- set itemRec $itm
- lappend itemRec "[$obj type]"
- lappend itemRec "[$lab type]"
- lappend itemRec $condition
- lappend localItems "$itemRec"
- lappend localItemNames "$objName"
- }
- }
- }
- $this itemList $localItems
- $editorArea releaseSelectedComponents
- set count [llength $localItems]
- if {$count == 0} {
- wmtkerror "No items selected"
- uplevel #0 [$this cancelPressed]
- return
- }
- if {$count == 1} {
- $ed selectedItem [lindex $localItems 0]
- [$ed selPopDlg] popUp
- $this delete
- return
- }
- $this entrySet $localItemNames
- $this ListDialog::popUp
- }
-
- method SelectItem::handleOk {this} {
- set index [lindex [$this selectedIndexSet] 0]
- [$this editor] selectedItem [lindex [$this itemList] $index]
- [[$this editor] selPopDlg] popUp
- $this delete
- }
-
- # Do not delete this line -- regeneration end marker
-
-