Gtk2::Dialog ... adding a label



I've written a sub that displays a GTK2::Dialog ...

sub msgbox {
my ($parent, $title, $message) = @_; my $dialog = Gtk2::Dialog->new ($title,
                                   $parent,
                                   'destroy-with-parent',
                                   'gtk-ok'        => 'accept',
                                   'gtk-cancel'    => 'reject');
my $label = Gtk2::Label->new ($message);
   $dialog->vbox->add ($label);
return $dialog; }

I then call it with:

my $dialog = msgbox($parent, "I'm a title", "I'm a message")

if ('accept' eq $dialog->run) {
   print "Accept pressed\n";
} else {
   print "Cancel pressed\n";
}

$dialog->destroy;

It runs OK ( no errors and returns the right values ) but the label doesn't get added.
What's up?

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au
Title: CanIt Vote for ID 47021

The following links have been placed here by the NUS Consulting internal spam filter and are for use by NUS Consulting staff only.
Please ingore these links.
Spam
Not spam
Forget previous vote


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]