Re: How to get the Class name of an element
- From: Pelle Nilsson <pellenilsson fastmail fm>
- To: gtk-perl-list gnome org
- Subject: Re: How to get the Class name of an element
- Date: Fri, 16 Apr 2010 12:59:12 +0200
If an object is used in a string context it will return something like
Gtk2::Entry=HASH(0x12cfba8)
so you can use something like
if (substr($text, 0, 11) eq 'Gtk2::Entry') {
print "Entry!\n";
} elsif (substr($text, 0, 14) eq 'Gtk2::ComboBox') {
print "ComboBox!\n";
}
/Pelle
(sorry for double email rds, I first used reply instead of list-reply)
fre 2010-04-16 klockan 09:25 +0000 skrev list guenther-sohler net:
Its really a stupid question.
If I write
$text=Gtk2::Entry->new;
or
$text=Gtk2::ComboBoxEntry->new;
how can I check later in the program if $text is an Entry or an
ComboBoxEntry ?
if($text->get_text != undef)
{
}
does not help. It already tries to call an undefined function
rds
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]