Line | |
---|
1 | # ---------------------------------------------------------------------- |
---|
2 | # EDITOR: atomic element type |
---|
3 | # |
---|
4 | # Used within the Instant Rappture builder to edit the default value |
---|
5 | # for a <periodicelement> object. Uses the PeriodicTable itself to |
---|
6 | # select the element. |
---|
7 | # |
---|
8 | # ====================================================================== |
---|
9 | # AUTHOR: Michael McLennan, Purdue University |
---|
10 | # Copyright (c) 2004-2012 HUBzero Foundation, LLC |
---|
11 | # |
---|
12 | # See the file "license.terms" for information on usage and |
---|
13 | # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
14 | # ====================================================================== |
---|
15 | itcl::class AttrAtomelem { |
---|
16 | constructor {win args} { |
---|
17 | Rappture::getopts args params { |
---|
18 | value -tooltip "" |
---|
19 | } |
---|
20 | |
---|
21 | Rappture::PeriodicElement $win.val -editable no |
---|
22 | pack $win.val -side left -expand yes -fill x |
---|
23 | |
---|
24 | Rappture::Tooltip::for $win.val $params(-tooltip) |
---|
25 | |
---|
26 | set _win $win |
---|
27 | } |
---|
28 | |
---|
29 | public method check {} { |
---|
30 | # any value here is okay -- check at the object level |
---|
31 | return "" |
---|
32 | } |
---|
33 | |
---|
34 | public method load {val} { |
---|
35 | $_win.val value $val |
---|
36 | } |
---|
37 | |
---|
38 | public method save {var} { |
---|
39 | upvar $var value |
---|
40 | set value [$_win.val value] |
---|
41 | return 1 |
---|
42 | } |
---|
43 | |
---|
44 | public method edit {} { |
---|
45 | focus -force $_win.val |
---|
46 | } |
---|
47 | |
---|
48 | public proc import {xmlobj path} { |
---|
49 | $xmlobj get $path |
---|
50 | } |
---|
51 | |
---|
52 | public proc export {xmlobj path value} { |
---|
53 | $xmlobj put $path $value |
---|
54 | } |
---|
55 | |
---|
56 | private variable _win "" ;# containing frame |
---|
57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.