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
#!perl package MyApp; use strict; use warnings; use Wx qw/:everything/; use Wx::Grid; use base qw(Wx::App); # von Wx::App ableiten sub OnInit { my $app = shift ; my $frame = Wx::Frame->new( undef, # kein Eltern-Fenster -1, # Fenter id 'Wx::Grid', # Titel [-1, -1], # Position x/y [640, 480] # Größe x/y ); my $grid = Wx::Grid->new($frame); $grid->CreateGrid( 5, # int numRows, 5, # int numCols, wxGridSelectCells # wxGridSelectionModes selmode = wxGridSelectCells ); $app->SetTopWindow($frame); # Fenster als oberstes bestimmen $frame->Show(1); # Fenster zeichnen 1; } 1; # /MyApp package main; use strict; use warnings; MyApp->new->MainLoop(); exit(0);
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
#!perl package MyApp; use strict; use warnings; use Wx qw/:everything/; use Wx::Grid; use base qw(Wx::App); # von Wx::App ableiten sub OnInit { my $app = shift ; my $frame = Wx::Frame->new( undef, # kein Eltern-Fenster -1, # Fenter id 'Wx::Grid', # Titel [-1, -1], # Position x/y [640, 480] # Größe x/y ); my $font = Wx::Font->new( 24, # font size wxMODERN, # font family wxNORMAL, # style wxNORMAL, # weight 0, 'Verdana', # face name wxFONTENCODING_SYSTEM); my $grid = Wx::Grid->new($frame); $grid->SetLabelFont($font); $grid->CreateGrid( 5, # int numRows, 5, # int numCols, wxGridSelectCells # wxGridSelectionModes selmode = wxGridSelectCells ); #$grid->AutoSize(); # auto adjust width & height of all cells $grid->AutoSizeRowLabelSize($_) for( 0 .. $grid->GetNumberCols() ); # adjust height of rows 1-5 foreach my $x ( 0 .. $grid->GetNumberRows() ) { foreach my $y ( 0 .. $grid->GetNumberCols() ) { $grid->SetCellFont( $x, # int row, $y, # int col, $font # const wxFont & font ); } } $app->SetTopWindow($frame); # Fenster als oberstes bestimmen $frame->Show(1); # Fenster zeichnen 1; } 1; # /MyApp package main; use strict; use warnings; MyApp->new->MainLoop(); exit(0);