Re: how can I split signal dispatching codes into multi-packages while using Gtk2::GladeXML?




On Jun 27, 2007, at 11:05 PM, zhang liming wrote:

I'd like to know whether there is a way for me to handler signals from child widgets in child packages directly not dispatched by main pakcage or not ?

As the Gtk2::GladeXML manpage, says:

   $gladexml->signal_autoconnect_from_package([PACKAGE])
       Sets up the signal handling callbacks as specified in the glade
XML data. Callbacks will need to have the exact name as specified
       in the XML data and be located in the provided package (or the
       caller's package if none is provided).  It is worth noting that
       callbacks you get for free in c such as gtk_main_quit will not
       exist in perl and must always be defined, for example:

         sub gtk_main_quit
         {
               Gtk2->main_quit;
         }

       Otherwise behavior should be exactly as expected with the use of
       libglade from a C application.


In other words:

    use MyHandlers;
    $glade->signal_autoconnect_from_package ('MyHandlers');

or even in the same file:

    ...
    $glade->signal_autoconnect_from_package ('MyHandlers');
    ...
    package MyHandlers;
    ...



--
It's all very complicated and would take a scientist to explain it.
  -- MST3K





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