Calling GUI function from Thread




Hi,

Thanks for the reply. Actually, the API that I am using wants me to register a callback function that would report to me the progress of the function that I have called in my thread. This callback is not able to see the Glib::Dispatcher variable from my application class.  The pseudo code is like this:

class Application
{
         ...................
         -------------------
            Glib::Dispatcher report_message_signal;
            static some_callback_func(arg1, arg2, arg3);
         ...................
         -------------------
         ...................
         -------------------
}

main()
{
----------
----------
Register_API_Callback_func(some_callback_func, .......);
----------
---------
}


on_button_clicked()
{
Glib::Thread::create(thread_function ......);
}

thread_function()
{
---------
---------
API_Function(); //Takes around 10 seconds
----------
----------
report_message_signal();
---------
--------
}

some_callback_func(Message)
{

//This function is internally called by the API giving info about the progress that API_Function
//is making and it is from here that I have to set text, in order to report guiding messages, in the
//label. I know that this is not right but what other options do you think I have.

}

Thanks and Regards,
Taha

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