05-06-2007 10:29 PM
05-06-2007 11:48 PM
05-07-2007 09:07 AM
Hi Whatcall,
The overall concept you are seeing is that pop-up panels are modal only with
respect to panels of the same thread. Check out the Different
Approaches to MultiThreaded User Interface Programming help topic in
the LabWindows/CVI Help.
Check out the MultiPanel shipping example (<CVI>\samples\utility\Threading\ThreadPool\MultiPanel) which uses the PostDeferredCalltoThread function. Also, here is post
with some good discussion and code snippets on PostDefferedCalltoThread.
Hope this helps!
Best Regards,
05-07-2007 08:20 PM
03-30-2015 10:33 AM
I have the same problem that a call the MessagePopup from a secondary thread, which is then not always on top.
As this thread is from 2007, is there in the later Versions of CVI a new solution?
It would be really nice if SetSystemPopupsAttribute() has the option of "float always", similar like panels. Would be simple and good.
Instead of PostDefferedCalltoThread i think a go with a new Panel with "float always" active.
Is there some new feature from CVI or is it still the same?
Best regards,
Dorian
04-28-2022 07:23 AM
I faced the same problem. The following code is the solution that I have just started to use. After adding the following code, I used “MessageBoxForThread” in the secondary thread and also in the main thread instead of “MessagePopup”. It seems to work. Message popups are always on top.
void CVICALLBACK MessageForThread (void *callbackData);
void MessageBoxForThread(char *text1,char *text2);
#define StringSize 1000
int stop_thread; char *global_text1;char *global_text2;
void CVICALLBACK MessageForThread (void *callbackData)
{
MessagePopup(global_text1,global_text2);
stop_thread=1;
return;
}
void MessageBoxForThread(char *text1,char *text2)
{
int callbackData;
global_text1=malloc( sizeof(char) * (StringSize) );
global_text2=malloc( sizeof(char) * (StringSize) );
sprintf(global_text1,"%s",text1); sprintf(global_text2,"%s",text2);
stop_thread=0;PostDeferredCall (MessageForThread, &callbackData);
do{ProcessSystemEvents();}while(stop_thread==0);
return;
}
04-29-2022 03:52 AM
Thanks for this practical implementation of the paradigm. I just want to warn you about some possible improvements:
Finally, you may want to use PostDeferredCallToThreadAndWait function in the Programmer's Toolbox, which already accomplishes part of the task; you could call it this way:
PostDeferredCallToThreadAndWait (MessageForThread , NULL, CmtGetMainThreadID (), POST_CALL_WAIT_TIMEOUT_INFINITE);
05-09-2022 07:00 AM
Thank you RoberttoBozzolo for this very useful feedback,
Your feedback will really improve the code.