Source

WxPerlBook / example / 02_ruler.pl

Full commit
use v5.12;
use warnings;

package App;
use Wx qw/ :everything /;
use parent qw(Wx::App);

sub OnInit {
	my $app   = shift;
	my $frame = Wx::Frame->new( undef, -1, 'Ruler');

	my $grid = Wx::FlexGridSizer->new(2,1,10,10);
	my %txt;
	for my $label (qw(X Y H W)) {
		#$txt{ $label } = Wx::TextCtrl->new($frame, -1, $label, [-1,-1], [60, -1]);
		$grid->Add( Wx::StaticText->new($frame, -1, $label.':'), 0, &Wx::wxGROW, 0 );
		#$grid->Add( $txt{ $label } );
	}
	$grid->AddGrowableCol(1);
	say $grid->GetCols;

	Wx::Event::EVT_SIZE($frame, sub {
	} );
	Wx::Event::EVT_MOVE($frame, sub {
	} );

	#$frame->SetAutoLayout( 1 );
	$frame->SetSizer( $grid );
	#$grid->Fit( $frame );
	#$grid->SetSizeHints( $frame );

	$frame->Center();
	$frame->Show(1);
	$app->SetTopWindow($frame);
	1;
}

package main;
App->new->MainLoop;