Hey, I'm working on a Spanish program and I want to make it so that if somebody wants to type in an a with an accent all they have to do is press the pushbutton. I realize how to create the pushbutton but I don't know how to just insert the character into an edit box at the end of whatever they were typing. How could I go about doing this? Code examples would be much appreciated.

Recommended Answers

All 7 Replies

Append text to an edit control.

CEdit edit;
LPCTSTR pszText;
.....
.....

int nLength = edit.GetWindowTextLength();
// put the selection at the end of text
edit.SetSel(nLength, nLength);
// replace the selection
edit.ReplaceSel(pszText);
....

Well, I create the edit box in my resource file and it's identifier is something like IDC_IDENTIFIER. So how would I go about doing it that way?

Are you using MFC or win32 api functions? When you created the edit box you got a HANDLE to the object. See this article

win32 api functions

win32 api functions

See link in my previous post

Yea I was actually looking at that just before you told me that but is there some kind of message for inserting the text?

nevermind I figured it out, thanks for all the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.