0
votes

I created an edit control using win32 api like this:

CreateWindow("edit", "", WS_CHILD | WS_VISIBLE, 0, m_position, CONTROLS_WIDTH, EDITBOX_HEIGHT, m_editorWindow, (HMENU)GetNextComponentID(), m_instance, NULL)

I can change the text from it using SetWindowText, but I can't select it or edit it's content - this is the purpose of an edit control, or not?:))

I read on MSDN http://msdn.microsoft.com/en-us/library/bb775458%28VS.85%29.aspx that I must use Edit_enable but I don't know where to find thin macro and I don't heave any idea how to enable editing. When I move the cursor over it the cursor changes to standard edit cursor.

Thank you for help!

3
It isn't obvious from your snippet nor is it typical behavior. Post a small repro project to a file sharing service or paste bin if you want somebody to debug it. - Hans Passant

3 Answers

1
votes

Or you could try:

HWND myWindow = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE, 0, m_position, CONTROLS_WIDTH, EDITBOX_HEIGHT, m_editorWindow, (HMENU)GetNextComponentID(), m_instance, NULL);

EnableWindow(myWindow, true);

1
votes

It works with SetFocus(hwnd) function.

-1
votes

Have you tried:

GetDlgItem(EditControlID)->EnableWindow(TRUE);

lol Oops.