Re: gtk2-perl / easily accessing objects properties



muppet wrote:

lanzz lanzz org wrote:

would be better to return the old value. so you could say

$old = $window->allow_shrink(0);
...
$window->allow_shrink($old);



i agree completely, as this is a useful and common idiom i've seen in a
fair amount of code.
This is new to me but it seems like a good idea - if the extra 'get' is
not too much of a hit - and it is explained well in the docs.

However, there seems to be a bug in the code somewhere - try running
'perl t/043_Gtk_Window.t' and see what I mean. The resizable($TRUE)
call does not set the value correctly although the resizable() call 
gets the correct value. BTW set_resizable($TRUE) works fine.

also, as another two bits, i prefer the "autoloaded method" form for
properties rather than the hash key form, because the hash key form
offers a possibility for conflict with user data keys.
I agree with this - I am always attaching hash keys/values to objects
that I have constructed.

This brings up another question - why is a widget held as a blessed do{}
rather than a hash as was done in Gtk-Perl? Data::Dumper outputs a
widget as  
    bless( do{\(my $o = 137539536)}, 'Gtk2::Button' )

and I cannot add hash keys/values to this as I used to do when the
widget refs were held as
    bless( { '_gtk' => 137252624 }, 'Gtk::Button' );

Regards, Dermot




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