I'm using a notebook control to add a tabbed interface to my Wx app.
but when I try to add a grid control to one of the tabs, I get the
error message variable is not an object: it must have type Wx::Window;
what am I doing wrong?

Example code:

my $panel = Wx::Panel->new($self);

    # Create the notebook control
    my $tabs = Wx::Notebook->new($panel, -1, [0, 40], [300, 150]);

    # Create a few pages
    my $projects = Wx::Panel->new($tabs);
    project_grid->new($projects);
    $tabs->AddPage($projects, 'Projects');



package project_grid;
use Wx::Grid;
use Config::Tiny;

sub new {
    my $self  = shift;
    my $ini = Config::Tiny->read("./config.ini");
    my $grid = Wx::Grid->new(
            $self, #parent
            -1, #id
            [0,0], #position
            [700, 300] #dimensions
            );
    $grid->CreateGrid(
            0, #rows
            0 #cols
            );

$grid->SetColLabelValue($column++,"Project");

foreach my $project ($ref->{projects}{project}) {
    $grid->AppendRows();
    $column = 0;
    $grid->SetCellValue($row, $column++, $project->{project_name});
    $row++;
}

Reply via email to