I've got the following problem, and I can't see an answer in the previous threads:
When an application loads a panel from a thread, it works but if it is minimized, it cannot be maximized from the taskbar.
I join a sample application that focus on the problem.
Solved! Go to Solution.
Checking the Has taskbar button option in panel settings will permit you to click on the taskbar icon and restore the panel.
But calling HidePanel will leave you with no panel on screen after the second panel has been closed: you can leave the panel on screen, minimize it or display it again when the second thread terminates.
I am adding a revised version of your example.
Thank you for your quick reply, In fact this is not the behaviour expected (for my end user) They want only one icon. And even if I modify the source code to discard the panel1 there are 2 icons in one : "user interface application" and "panel2"
int CVICALLBACK OnGoToPanel2 (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
if (event == EVENT_COMMIT)
SetPanelAttribute(panelHandle1, ATTR_HAS_TASKBAR_BUTTON, 0); // Try to remove 1st panel icon
panelHandle1 = 0;
It is not clear to me why you want to spawn a second thread and handle the entire UI in that thread instead of the main thread (at least this is what I have understood from your posts).
In fact, I wanted to move a long treatment (loop on a finite state machine) started by a button.
the fact is that if I let it in the callback (which is not suitable for long treatment) it works correctly, and if I move the loop in a thread it doesn't, for unknown reason.
This is normally achieved by separating the operative code from the user interface: the panel and the start button remain in the main thread and the operative task passes data to it to let the user know what's happening.
Passing data can be obtained via thread safe queues or by issuing a PostDeferredCall (which is executed in the main thread) or by other means leaving the running thread unaffected.
This framework permits also to handle a stop button in case the operator wants to abort the process
There are a number of examples installed in CVI folder that may help you in designing your application, you can search into shipping examples by means of the Example Finder (Help >> Find examples... menu function): search for "thread" in the search tab and you will seen a bunch of projects listed.
MultiPanel.cws shows how to handle a panel in a separate thread
BuffNoDataLoss.cws shows how to pass data using thread safe queues
Other examples can offer you useful hints on the subject.