[comp.windows.ms] SetDlgItemText

scott@rdahp.UUCP (Scott Hammond) (12/08/89)

I'm new to Microsoft Windows, and I'm trying to fix code written by
someone else.  :-(

Is there a way to guarantee that the text set with the SetDlgItemText()
function will be returned by a subsequent GetDlgItemText()?  I'm seeing
a situation where the GetDlgItemText() is getting the previous text even
though I'm certain that the SetDlgItemText() was done. 

I find that a MessageBox() routine between the Set and Get causes the
problem to go away. 

Related information:

In this same dialog box, there is a pushbutton defined for IDOK.  If the
focus is in an edit control window, pushing the button sends the edit
control window a KILL_FOCUS, but then the pushbutton window turns black
and the IDOK is not sent.  A second click on the pushbutton does send
the IDOK.  I don't understand why the second click is required, or what
Windows is telling me I did wrong by blackening the button.

Relating this to my original question, the SetDlgItemText() occurs while
handling the KILL_FOCUS, and the GetDlgItemText() occurs while handling
the IDOK.  BUT, in this situation the GetDlgItemText() returns the
correct data.  However if, rather than clicking the button, I hit
<ENTER>, the KILL_FOCUS and IDOK are both sent, but GetDlgItemText()
returns the old data. 

Any comments or suggestions would be appreciated.  Please email, I'll
summarize if there is interest.  Thanks in advance.
--
Scott Hammond,  R & D Associates, Marina del Rey, CA  (213) 822-1715
: {tah386,ladcgw,<site-with-router>}!rdahp!scott
:  scott@harris.cis.ksu.edu