Managing Windows ( OO question )
- From: Daniel Kasak <dkasak nusconsulting com au>
- To: gtk-perl-list gnome org
- Subject: Managing Windows ( OO question )
- Date: Fri, 04 Nov 2005 09:02:45 +1100
Greetings.
I'm trying to make my apps a little more robust - in particular being
smart about opening windows ... or not opening a window if it's already
open. I'm having limited success.
What I'd like to do is have each Gtk2::GladeXML object inside an OO
object, which gets destroyed when the form is closed. I've tried posting
to the Perl Beginners list, but the advice I got there didn't work.
Here's what I've got so far. Say I've got a Gtk2::GladeXML widget, that
sits inside an OO thingy ( in this example, $self->{form} ), and inside
this, I've got a sub:
---
sub destroy_self {
undef $_[0];
}
---
This gets called when the Gtk2::GladeXML window is destroyed ... and it
runs from inside the same object that is going to be destroyed. The idea
is that from my top-level script, I'd do something like:
---
sub on_Countries_clicked {
if ( $reports ) {
$reports->{form}->get_widget("Reports")->present;
} else {
$reports = forms::reports->new( $form_options );
}
}
---
This doesn't work though. The $reports object never gets destroyed. The
best I can do is to destroy the $reports->{form} object - which
basically does what I want - I can just test for $self->{form} instead,
but it kinda pisses me off that I can't do it the way I want to.
Any clues?
Dan
--
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]