mfc how do you refresh/update dialog

mfc how do you refresh/update dialog

Hi, at present I refresh/update a dialog box by adding CDialog::OnOk() to the event handler. The side effect is that it causes the dialog to flicker. Is there any other way of updating the control variables.

UpdateData(true) means "save and validate".  In other words, it retrieves the values from the controls and sets the variables with those values.  Updatedata(false) means reverse : it takes the values in the variables and sets the controls to those values.
You can also use getitemtext and setitemtext.
Maybe the OnChange handler is not the place to call UpdateData(), because by definition, the change is in progress and might not have taken effect yet.  Instead, in Onchange, I would call PostMessage(<user defined message>) so that once all existing messages in the queue are processed, your user defined message handler will be called.  At that point, the change will have completed.  That is where you call UpdateData().

Copyright © 2007-2012 www.chuibin.com Chuibin Copyright