LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

delay in filling in text box

I'm writing a little program that's supposed to output some information to a text box while it's running, but the updating of the box doesn't occur until after the entire function has finished (i.e. degauss() has completed). Do I need to force the display to update? Contained in degauss() there's a while loop that's supposed to report its status to the text box while it's running, but it also waits until the StartCB function is complete to update. (though all the information fills in just like i want it to when the startcb function is finished).

The attached snippet shows my StartCB function and what the program is supposed to do. The ResetTextBox() function updates the display immediately, as I would imagine it is supposed to.


thanks,

john
0 Kudos
Message 1 of 4
(3,520 Views)
Some of the control functions automatically force a redraw and some do not. For example, SetCtrlVal will always force a redraw, but if you use SetCtrlAttribute to set the value it will not. If there isn't a forced redraw, then the control will redraw with an event that will be processed along with the other events. The function InsertTextBoxLine doesn't force a redraw since you may want to call it multiple times before redrawing.

To force a redraw before you continue in the callback, insert a call to ProcessDrawEvents() after the InsertTextBoxLine call.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 4
(3,520 Views)
Thanks Chris. I figured out to run a ProcessSystemEvents() after the insert text box line. Will the system run a bit faster if I use the ProcessDrawEvents() function instead?

-John
0 Kudos
Message 3 of 4
(3,520 Views)
No, it won't be faster, it just won't process anything but draw events. So, you wouldn't process other button clicks or system events at that call.

Chris
0 Kudos
Message 4 of 4
(3,520 Views)