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
|
#!/usr/bin/env entity
<object title="Clock">
<window ondelete="entity:exit" title="Clock" >
<valign>
<object title="clock" name="clock" dragable="true" expand="false">
<label name="time" font="10x20" text = "00:00:00"></label>
<timer interval = "1000" action="update_clock"></timer>
<perl>
sub update_clock
{
my $node = shift;
my $timelabel = enode("label.time");
my $found = enode("/")->child("object.clock");
$num;
# aasdfg( - 3; # this line is for testing the reporting of syntax errors
my ($sec, $min, $hour, $mday) = localtime (time);
my $str = sprintf ("%02d:%02d:%02d", $hour, $min, $sec);
$timelabel->attrib("text" => $str);
print "node = $node\ntimelabel = $timelabel\nfound = $found\n";
enode("label.time")->attrib(text => $str);
$num++;
$found->new_child("button.new-$num",
"label" => "new");
print $timelabel->attrib("text"), "\n";
}
update_clock ();
</perl>
</object>
</valign>
</window>
</object>
|