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
|
#!/usr/bin/env entity
<object>
<window position="center" ondelete="entity:exit"
title="Some Cool App" name="windowone">
<button label="dump_xml" onclick="dump_xml"/>
<button label="select row" onclick="dump_xml"/>
<frame title="test the item tag">
<valign height="500" width="300">
<scrollwindow fill="true" expand="true">
<list expand="true" fill="true" name="l1 one">
<list-item label="test 1" onselect="testlist"/>
<list-item name="has_a_button">
<button label="test 2" onclick="sel_row"/>
</list-item>
<list-item label="booo!" onselect="testlist"/>
</list>
</scrollwindow>
<scrollwindow>
<list expand="true" name="second" onselect="print_args">
<list-item>
<label text="most"/>
</list-item>
</list>
</scrollwindow>
<button label="add one" onclick="add_item"/>
</valign>
</frame>
<perl><![CDATA[
sub testlist
{
my ($node) = @_;
$text = $node->attrib("selected");
print "testlist hears -$text-\n";
#$node->attrib("selected" => "false");
}
sub add_item
{
my $list = enode("list.second");
my $item = $list->new_child("list-item.foo");
my $label = $item->new_child("label.foo", "text" => "foo");
}
sub sel_row
{
my $button = shift;
my $row = $button->parent();
$row->attrib("selected" => "true");
print $row, "\n";
}
sub print_args
{
print @_, "\n";
}
sub dump_xml
{
my $top = enode("object");
print $top->get_xml(),"\n";
}
]]></perl>
</window>
</object>
|