File: fixed.e

package info (click to toggle)
entity 0.7.2-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,352 kB
  • ctags: 5,272
  • sloc: ansic: 61,707; sh: 7,921; makefile: 732; perl: 399
file content (45 lines) | stat: -rwxr-xr-x 969 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
#!/usr/bin/env entity

<object>
  <window position="center" border = "10" name="good" visible="false" 
   title="Woop!" ondelete="close_window">
    <label text="Woop!  Good job!"/>
  </window>
  
  <window ondelete="entity:exit" title="Fixed Test">
    <fixed width="600" height="420">
      <button name="test" onclick="good_job" x-fixed="5" y-fixed="5">
        <label text="click me if you can!"/>
      </button>
    </fixed>
  </window>
  <timer interval = "100" action="update_fixed"/>
  
  <perl>
    
    sub good_job
      {
        my $node = enode("window.good");
	$node->attrib("visible" => "true");
      }
    
    sub close_window
      {
	my $node = enode(@_);
	$node->attrib("visible" => "false");
      }
      
    sub update_fixed
      {
        $x += 6;
	$y += 3;
	
	my $node = enode("button.test");
	$node->attrib("x-fixed" => "$x");
	$node->attrib("y-fixed" => "$y");

	$x = 2 if ($x > 500);
	$y = 2 if ($y > 400);
      }
   </perl>
</object>