On Jan 23, 2009, at 16:04 , Michael Carman wrote:

Jeff Hobbs wrote:
E.R. Uber wrote:

how does one distinguish what type of widget is being examined?

Query class with g_winfo_class.

What if it's a megawidget?


 C:\>perl -MTkx -MTkx::ROText -de 1

   DB<1> $mw = Tkx::widget->new('.')

   DB<2> $t = $mw->new_tkx_ROText()

   DB<3> x $t->g_winfo_class()
 0  'Text'

Since Tkx::ROText registers itself via

 __PACKAGE__->_Mega('tkx_ROText');

shouldn't g_winfo_class() return "tkx_ROText" instead? (At least in
theory; I understand that that nugget of information isn't available to
Tcl.)

The megawidget can set the class known by Tk by passing the -class option when it creates its root widget. That's probably a good idea to do. There seems to be a convention that class names start with a capital letter. That means that your megawidget ought to set the class name to be something like "Tkx_ROText".

--Gisle

Reply via email to