Yes, thank you. I had thought that ->raise() and ->lower() were using levels, rather than a stack.
The solution here is to use ->raise_to_top() with the text. A general solution is to use ->lower_to_bottom and ->raise(n) with the text, where n is the number of squares.
# Draw some blue text above the squares
for (my $count = 0; $count < 5; $count++) {
my $text = Gnome2::Canvas::Item->new(
$canvasRoot,
'Gnome2::Canvas::Text',
x => (($count * 100) + 25),
y => (($count * 100) + 25),
fill_color => '#0000FF',
font => 'Sans',
size => 10000,
anchor => 'GTK_ANCHOR_W',
text => 'Hello world!',
);
$text->lower_to_bottom();
# Raise the text above the 5 squares in the Canvas stack
$text->raise(5);
}
|