Entangled text boxes

Posted by user38329 on Stack Overflow See other posts from Stack Overflow or by user38329
Published on 2011-01-03T22:49:14Z Indexed on 2011/01/03 22:54 UTC
Read the original article Hit count: 253

Filed under:
|

Hi StackOverflow,

A mere Windows textbox greatly surprised me today.

I have two unrelated text boxes inside an application. I can type in either text box and switch the focus by clicking on them. Then happens some event X, which I can't describe here for reasons given below. After this event happens, the two text boxes become "entangled" in an almost quantum way.

Say, text box A was focused before X happened. When I click text box B to type in some text, the new text appears in text box A, whereas the blinking cursor happily moves along in text box B through the void, as if the text were there.

No amount of clicking on either text boxes can resolve this. The cursor will always remain in B, whereas the text will always go to A.

Message spying reveals that after the event X, the text boxes lose the ability to lose or gain focus. When I click on B, WM_LOSE_FOCUS does not come to A, and WM_SET_FOCUS does not come to B. (The rectangles and visibility of the boxes are OK.)

The same thing happens in Windows XP and Windows 7.

Now, event X: it's a big event in a third-party UI library which I cannot reverse-engineer in a timely manner. (Namely, docking a pane in wxAUI.)

I am sure that this behavior is the result of incorrect WinAPI calls to the text boxes (garbage in - garbage out). I would like to know what could possibly cause such "textbox trip" to know where to start looking for the bug.

Thanks!

© Stack Overflow or respective owner

Related posts about winapi

Related posts about textbox