🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms
Article #2119

SetDlgItemText()/GetDlgItemText() question

#2119
From: Scott Hammond
Date: Thu, 07 Dec 1989 23:35
33 lines
1972 bytes
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
Technical Details
Message-ID: <323@rdahp.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!ladcgw!rdahp!scott

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!ladcgw!rdahp!scott
From: scott@rdahp.UUCP (Scott Hammond)
Newsgroups: comp.windows.ms
Subject: SetDlgItemText()/GetDlgItemText() question
Message-ID: <323@rdahp.UUCP>
Date: 7 Dec 89 23:35:15 GMT
Reply-To: scott@rdahp.UUCP (Scott Hammond)
Distribution: usa
Organization: R & D Associates, Marina del Rey, CA
Lines: 33