File: focus.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 (34 lines) | stat: -rwxr-xr-x 736 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
#!/usr/bin/env entity

<object>
  <window ondelete="entity:exit">
    <button name="me" label="me" onfocus="got_focus"/>
    <button name="you" label="you"/>

    <button label="focus you" onclick="focus_you"/>
  </window>

  <timer interval="10000" action="who_has_focus" />
  <timer interval="3600" action="focus_you" />

  <perl><![CDATA[
  sub who_has_focus
  {
    my $me = enode("button.me")->attrib("focused");
    my $you = enode("button.you")->attrib("focused");

    print "me focused? $me\n";
    print "you focused? $you\n";
  }
  sub focus_you
  {
    print "going to focus 'you'\n";
    enode("button.you")->attrib("focused" => "true");
  }
  sub got_focus
  {
    print shift, " got focus\n";
  }
  ]]></perl>
</object>