1 | # ---------------------------------------------------------------------- |
---|
2 | # RAPPTURE OBJECT: string |
---|
3 | # |
---|
4 | # A string is ASCII or binary data. It can be used as either an |
---|
5 | # input or an output. |
---|
6 | # |
---|
7 | # ====================================================================== |
---|
8 | # AUTHOR: Michael McLennan, Purdue University |
---|
9 | # Copyright (c) 2004-2011 Purdue Research Foundation |
---|
10 | # |
---|
11 | # See the file "license.terms" for information on usage and |
---|
12 | # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
13 | # ====================================================================== |
---|
14 | |
---|
15 | object string -extends base { |
---|
16 | palettes "Inputs" "Outputs" |
---|
17 | |
---|
18 | help http://rappture.org/wiki/rp_xml_ele_string |
---|
19 | |
---|
20 | attr default -title "Default Value" -type string -path default -only input -tooltip "Sets the value that this input has when the program first starts. This value is used by default unless the user explicitly changes it." |
---|
21 | |
---|
22 | attr size -title "Size" -type string:validate=size -path size -only input -tooltip "Sets the desired size for the string. Strings are normally 1 line of text, but if the size is set to some WxH, then the entry area will be at least W chars wide and H lines tall. For example, 40x5 says that the string should be 40 chars wide and 10 lines tall." |
---|
23 | |
---|
24 | attr hints -title "Hint String" -type string -path about.hints -only input -tooltip "Sets a line of text displayed beneath the entry area for the string. This is used to give a hint to the user about what should be entered in the string area." |
---|
25 | |
---|
26 | |
---|
27 | storage { |
---|
28 | private variable _val ;# string value |
---|
29 | } |
---|
30 | |
---|
31 | import xml {xmlobj path} { |
---|
32 | attr import $xmlobj $path |
---|
33 | import_string [$xmlobj get $path.current] |
---|
34 | } |
---|
35 | |
---|
36 | export xml {xmlobj path} { |
---|
37 | $xmlobj put $path $_val |
---|
38 | } |
---|
39 | |
---|
40 | import string {val} { |
---|
41 | set _val $val |
---|
42 | } |
---|
43 | |
---|
44 | export string {var} { |
---|
45 | upvar $var v |
---|
46 | set v $_val |
---|
47 | } |
---|
48 | |
---|
49 | compare { |
---|
50 | return [string compare $_val $_val2] |
---|
51 | } |
---|
52 | } |
---|