how to handle other class event loop ?

View: New views
2 Messages — Rating Filter:   Alert me  

how to handle other class event loop ?

by silent-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi, list
     when I add other Class(not gtk2::*) to programe,
and it has a event loop function like gtk_main(), let me call it "abc_main()",

how can run both gtk_main() and abc_main() ?

when the code run into gtk_main(), it will not return unless destroy
the "Window",


thanks!
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: how to handle other class event loop ?

by Brian Manning :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Sep 26, 2009 at 6:29 PM, silent <silent2600@...> wrote:
> hi, list
>     when I add other Class(not gtk2::*) to programe,
> and it has a event loop function like gtk_main(), let me call it "abc_main()",
>
> how can run both gtk_main() and abc_main() ?
>
> when the code run into gtk_main(), it will not return unless destroy
> the "Window",

You could try calling your abc_main() from a Glib::Timeout [1] event,
assuming your abc_main() event loop is polite about returning control
back to Gtk2->main.  If not, then you might want to look at separate
processes or threads and communicating via pipes/sockets.

Example Glib::Timeout usage (taken from one of my scripts [2]):
Glib::Timeout->add( $timeout, \&subroutine, $sub_args );
# this is how you pass in multiple objects/variables
Glib::Timeout->add( 500, \&check_terminal, [$b_term, $b_term_label] );

Thanks,

Brian

[1] http://gtk2-perl.sourceforge.net/doc/pod/Glib/MainLoop.html
[2] http://tinyurl.com/ydj3btk
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list