builder on scalar properties
- From: Kevin Ryde <user42 zip com au>
- To: gtk-perl-list gnome org
- Subject: builder on scalar properties
- Date: Sun, 12 Sep 2010 09:35:06 +1000
If an object property is a Glib::Scalar, ie. Glib::ParamSpec->scalar,
can it be set with the <property> thingie in Gtk2::Builder ? The few
lines below get
Gtk-WARNING **: Failed to set property Foo.myscalar to "hello": Could not parse '"hello"' as a GPerlSV at
/tmp/scalar.pl line 21.
and apparently don't set the property.
use strict;
use warnings;
use Gtk2;
{
package Foo;
use strict;
use warnings;
use Glib;
use Glib::Object::Subclass
'Glib::Object',
properties => [Glib::ParamSpec->scalar
('myscalar',
'myscalar',
'Blurb.',
Glib::G_PARAM_READWRITE),
];
}
my $builder = Gtk2::Builder->new;
$builder->add_from_string (<<'HERE');
<interface>
<object class="Foo" id="myfoo">
<property name="myscalar">"hello"</property>
</object>
</interface>
HERE
my $foo = $builder->get_object('myfoo');
print $foo,"\n";
print $foo->get('myscalar')||'[undef]',"\n";
exit 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]