Just starting to play with Prima. Wrote the following code:
use strict;
use warnings;
use Prima qw(Application Edit Buttons);
my $window = new Prima::MainWindow( size => [ 250, 350] );
my $display_field = $window->insert( Edit =>
size => [ 200, 300],
text => '',
centered => 1,
);
my $butoon = $window->insert( Button =>
size => [ 50, 20],
text => 'Click',
place => { x => 120, y => 340 },
onClick => \&button_Click,
);
sub button_Click {
for (1..5) {
$display_field->insert_text("$_\n\n");
}
}
run Prima;
I expected the display field shows 1 2 3 4 and 5 separately in each line from top to bottom but Prima gives me 5 4 3 2 1. Things get displayed upside down.
I've noticed the x and y coordinates in Prima are different. For example, the x coordinate in Prima starts from left bottom corner of the widget, rather than the usual left top corner. I've found some seemingly relevant methods like translate, but I cant't seem to figure out how to get things displayed the expected way? Does someone have some ideas?
Thanks in advance.