[Glade-users] How to handle two separates button code at same time...

Tristan Van Berkom tristan.van.berkom at gmail.com
Sun Apr 30 13:09:40 EDT 2006


kapil sharma wrote:
[...]

>In this I have three buttons. When I press any one the
>code written inside that button function will execute
>and I cannot press any other button while code is
>running.
>
>I want to press another button after I pressed one
>button 
>
>I hope you got my problem.
>  
>
You need the code from the first button to return to the main loop:

on_button1_pressed ()
{
   /* better chop this long operation into itterations
    * in an idle handler.
    */
    g_idle_add (button_1_operation, NULL);

    return;
}

That way, pressing button1 initiates an operation that will go on
in the background while your GUI stays responsive.
(i.e. you might want to push progressbars etc also from the idle
handler).

Cheers,
                          -Tristan



More information about the Glade-users mailing list