File: configfile.e

package info (click to toggle)
entity 1.0.1-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,604 kB
  • ctags: 5,394
  • sloc: ansic: 64,242; sh: 7,377; makefile: 776; perl: 319
file content (74 lines) | stat: -rw-r--r-- 1,788 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

<object name="Config File Test" default-lang="javascript">
  <window title="Config File Test" ondelete="entity:exit">
    <valign border="5" spacing="5">
      <halign>
        <label text="Your Name:" width="100" xalign="0"/>
        <entry/>
      </halign>
      <halign>
        <label text="Your Age:" width="100" xalign="0"/>
        <spinner max="200" value="23"/>
      </halign>
      <!-- This shows a different way you can do it.. you can either
	   have a dedicated XML tree for configuration, or just save
	   your configuration dialog.  We show both in this example
      -->

      <configfile file="~/.entity/configfiledialog.xml">
        <halign>
          <label text="Favorite Word:" width="100" xalign="0"/>
	  <entry/>
	</halign>
	<halign>
	  <label text="Favorite Number:" width="100" xalign="0"/>
	  <spinner max="9" min="0"/>
	</halign>
      </configfile> 
      
      <hseparator/>
      <halign>
        <halign expand="true"/>
        <button label="Save" width="100" onclick="save_config"/>
        <button label="Close" width="100" onclick="entity:exit"/>
        <halign expand="true"/>
      </halign>
    </valign>
  </window>

  <configfile file="~/.entity/configfiletest.xml">
    <data name="Someone Fun" age="65"/>
  </configfile>
 
  <javascript>
<![CDATA[

function load_config ()
{
    var name;
    var age;

    name = enode ("data").attrib.name;
    age = enode ("data").attrib.age;

    enode ("entry").attrib.text = name;
    enode ("spinner").attrib.value = age;
}

function save_config (node)
{
    var name;
    var age;
    
    name = enode ("entry").attrib.text;
    age = enode ("spinner").attrib.value;

    enode ("data").attrib.name = name;
    enode ("data").attrib.age = age;
}

load_config ();
  
]]>
  </javascript>
</object>