LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does my listbox not clear when I use the ClearListCtrl command?

I have a test result list in a listbox. When I start a new test I want the listbox to clear (used the ClearListCtrl command). The screen does not update. Nor does it update when I write a new line to the listbox. All screen updates happen at the end of my callback (I click a run button, and the program runs through a set of commands, then returns control to the user) . If I put MessagePopups in the code, then after the OK has been clicked the listbox updates.
So, why does my listbox (on the screen) not update - and how do I make it update (on the screen) ?
0 Kudos
Message 1 of 4
(3,291 Views)
Hi Chris,
have you tried inserting a ProcessDrawEvents() after you've done the ClearListCtrl to force the window to re-draw itself (which is what is happening after the MessagePopup has run).
If that doesn't work, try a ProcessSystemEvents(), but I think the ProcessDrawEvents() should work.

Hope that helps

S.
// it takes almost no time to rate an answer Smiley Wink
Message 2 of 4
(3,291 Views)
Hi Chris,
verified it with a quick bit of code - put a ProcessDrawEvents() after your ClearListCtrl call and it will update your panel immediately.

(Did the following :
ClearListCtrl(panel,PANEL_LISTBOX);
ProcessDrawEvents();
Delay(2);

and

ClearListCtrl(panel,PANEL_LISTBOX);
Delay(2);

The first one clears before the 2 second timer, the second, after, when the callback finished.

S.
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 3 of 4
(3,291 Views)
Thanks Sacha,

It worked, the user interface acts how I wanted now. All the updates happen after each event. Thanks again for your help.

Chris 🙂
0 Kudos
Message 4 of 4
(3,291 Views)