Click here to Skip to main content
16,015,097 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: a question of edit control Pin
ilavl31-May-02 17:07
ilavl31-May-02 17:07 
GeneralRe: a question of edit control Pin
valikac31-May-02 5:15
valikac31-May-02 5:15 
GeneralRe: a question of edit control Pin
Tomasz Sowinski31-May-02 5:32
Tomasz Sowinski31-May-02 5:32 
GeneralRe: a question of edit control Pin
valikac31-May-02 5:27
valikac31-May-02 5:27 
GeneralRe: a question of edit control Pin
Tomasz Sowinski31-May-02 5:38
Tomasz Sowinski31-May-02 5:38 
GeneralRe: a question of edit control Pin
valikac31-May-02 5:36
valikac31-May-02 5:36 
GeneralRe: a question of edit control Pin
Tomasz Sowinski31-May-02 6:01
Tomasz Sowinski31-May-02 6:01 
GeneralRe: a question of edit control Pin
James R. Twine31-May-02 10:26
James R. Twine31-May-02 10:26 
   Two things: First (as I go into Pedantic mode...)

Anonymous wrote:
CEdit* ped=(CEdit*)GetDlgItem(IDC_EDIT_ap1);<br />
ped->SetSel(0, -1, FALSE);


   I would recommend that you do not get into the habit of casting the return value of GetDlgItem(...) to a CEdit* (or other class type) like that.  There are certain situations where GetDlgItem(...) will return a pointer to a real CEdit (or other Control Class) object, but if you do not know what those situations are, it is best to avoid this entirely.  Bind a CEdit member variable to the control, and use it instead.

   True, in the case of MFC, doing that is usually safe, but in general C++ practices, it is a bad thing to do: you do not know if the pointer returned by GetDlgItem(...) is, or ever was, a pointer to an actual CEdit object.

   Second, try using PostMessage(...) to send yourself the EM_SETSEL message from inside the OnSetFocus handler.

   BTW: CWnd::OnSetFocus(...) is a standard function.  What is OnSetfocusEDITap1 supposed to be?  You may be handling the WM_SETFOCUS message incorrectly.

   Peace!

-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
(Try Check Favorites Sometime!)
GeneralRe: a question of edit control Pin
ilavl31-May-02 17:10
ilavl31-May-02 17:10 
Questioncallback or thread? Pin
bryce31-May-02 0:00
bryce31-May-02 0:00 
AnswerRe: callback or thread? Pin
Tomasz Sowinski31-May-02 0:10
Tomasz Sowinski31-May-02 0:10 
AnswerRe: callback or thread? Pin
James R. Twine31-May-02 10:31
James R. Twine31-May-02 10:31 
AnswerRe: callback or thread? Pin
Ed Gadziemski31-May-02 11:44
professionalEd Gadziemski31-May-02 11:44 
QuestionIs there an include required for threads? Pin
Nnamdi Onyeyiri30-May-02 23:11
Nnamdi Onyeyiri30-May-02 23:11 
AnswerRe: Is there an include required for threads? Pin
Michael P Butler30-May-02 23:43
Michael P Butler30-May-02 23:43 
GeneralRe: Is there an include required for threads? Pin
Nnamdi Onyeyiri30-May-02 23:45
Nnamdi Onyeyiri30-May-02 23:45 
GeneralRe: Is there an include required for threads? Pin
Michael P Butler30-May-02 23:53
Michael P Butler30-May-02 23:53 
GeneralRe: Is there an include required for threads? Pin
Nnamdi Onyeyiri31-May-02 0:02
Nnamdi Onyeyiri31-May-02 0:02 
GeneralRe: Is there an include required for threads? Pin
Nish Nishant31-May-02 0:10
sitebuilderNish Nishant31-May-02 0:10 
GeneralRe: Is there an include required for threads? Pin
markkuk31-May-02 2:06
markkuk31-May-02 2:06 
GeneralRe: Is there an include required for threads? Pin
Tomasz Sowinski30-May-02 23:50
Tomasz Sowinski30-May-02 23:50 
QuestionHow to change input of edit of another program in my own problem? Pin
mzt30-May-02 22:58
mzt30-May-02 22:58 
AnswerRe: How to change input of edit of another program in my own problem? Pin
Mike Nordell1-Jun-02 0:27
Mike Nordell1-Jun-02 0:27 
GeneralNetwork Application Winsock (Modem) Pin
Sameer Maggon30-May-02 21:26
Sameer Maggon30-May-02 21:26 
GeneralRe: Network Application Winsock (Modem) Pin
lucy31-May-02 4:57
lucy31-May-02 4:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.