Two CEdit controls updating each other: infinite loop
Posted on 2008-10-19
I have on my dialog two text edit boxes. The idea is that when the contents of one is changed, the other changes and vice versa. I respond to the EN_CHANGE message (which I thought only fired in response to USER editing).
Needless to say, one EN_CHANGE invokes SetWindowText() in the other control, which causes another EN_CHANGE the other way, and so on ad infinitum.
I could just compare the "new" text with the existing text and do nothing if they are the same.
However, this won't work here because the text results from floating point numbers, so an exact textual match is not a good idea.
It is a simple dialog-based tool to convert kW to HP and vice versa. I don't want to have the user click any buttons to start the conversion; I just want the "other" box to update as the user types in "this" box.
How do I prevent this chain of EN_CHANGE messages ?
Is there a CEdit::SetWindowTextWithoutSendingAnUpdateMessage() call ?
Richard [in LU1]