Question

Tried to launch a message box in my MyThread Class as below:

Object*
MyThread::Run(void)
{
    AppLog("@ MyThread::Run(void)");

    MessageBox messageBox;
    messageBox.Construct(L"MessageBox Title", L"MessageBox Sample Code.", MSGBOX_STYLE_OK, 10000);

    int modalResult = 0;

    messageBox.ShowAndWait(modalResult);

    return null;
}

Soon after thread instance created and started, application crashed. Cant we launch MessageBox using threads in my UiApp ?

Regards,

Anil

Was it helpful?

Solution

According to the Tizen Dev Guide,

The Tizen UI framework is not thread-safe. Therefore, only the main thread can dispatch events to the UI controls and interact with them. This means UI handling must always be done in the main thread.

You cannot create and show a MessageBox in a thread other than the main thread.

If you would like to show something from the thread you created, use SendUserEvent() in your thread and OnUserEventReceivedN() in the main thread as shown in the guide.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top