Re: Querying about the type of a given widget
- From: Paolo Molaro <lupus debian org>
- To: "'gtk-perl-list gnome org'" <gtk-perl-list gnome org>
- Subject: Re: Querying about the type of a given widget
- Date: Wed, 10 Jan 2001 22:06:39 +0100
On 01/03/01 Cogan, Gil wrote:
I'd like to query whether a certain Gtk object is of a given type/class
Example:
my $widget = pop @widgets;
if $widget is an entry widget do this else do that.
I looked in "Types - Handle run-time type creation", which is in the GTK+
reference manual, but in vain.
Can't remember if someone already replyed, but here it is anyway:
all the objects derived from GtkObject are represented in perl
with a hash ref that is blessed in a package with a name (usually)
direct derivation of the gtk system's class name.
GdkWindow become Gtk::Gdk::Window (this is not a Gtk::Object though),
GtkEntry becomes Gtk::Entry, GtkWindow becomes Gtk::Window, for example.
The @ISA array for Gtk::Entry contains Gtk::Widget, so proper
information on inheritance is maintained.
Given:
$widget = new Gtk::Entry;
we have:
$widget->isa('Gtk::Entry') => TRUE
$widget->isa('Gtk::Widget') => TRUE
$widget->isa('Gtk::Window') => FALSE
Hope this helps.
lupus
--
-----------------------------------------------------------------
lupus debian org debian/rules
lupus helixcode com Monkeys do it better
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]