Child window not getting input

I had created a main window and then a child window that has 2 text fields and 2 buttons. The problem is that I am not able to write anything in the text fields but able to press the buttons. I had not attached any action to the buttons in order to know if they are getting my input or not

The create function is:
1
2
3
this->hWnd = CreateWindowEx (0, this->wndClass.lpszClassName, 
wndTitle_p, WS_OVERLAPPEDWINDOW | WS_CHILD , x_p, y_p, width_p, hight_p, 
prntWnd_p->hWnd, NULL, this->hInst, NULL);


while the create function of the text fields is:
1
2
3
this->ebField = CreateWindowEx (WS_EX_CLIENTEDGE, TEXT("EDIT"), TEXT(""), 
WS_CHILD | WS_VISIBLE, x_v, y_v, width_v, hight_v, 
prntWnd_p->BsolGetWndHandle(), 0, prntWnd_p->BsolGetInstance(), 0);


Please note that BsolGetWndhandler() returns the handle of the parent and BsolGetInstance() returns the parents instance

Hope I'm clear enough
Regards,

Regards,
I don't do much GUI in C++, but I believe you cannot have a WS_OVERLAPPEDWINDOW that is also a WS_CHILD. Those are two styles that are incompatible with each other.
Thanks for your notation. It fixed the problem. But still I'm not able to use TAB in order to navigate through the text fields. Any ideas ?

Again, I'm no expert in the matter, but I think your message pump needs to process as a dialog using a special function. Let me see if I can find it.... found it! It is IsDialogMessage(). Read more @ http://msdn.microsoft.com/en-us/library/ms644995(VS.85).aspx#keyboard_iface#keyboard_iface .
The text fields should also be created with the WS_TABSTOP style attribute.
Hii guys..
None of those is working.. I tried the specified styles for the window but still not working. Furthermore, I tried the WS_TABSTOP in the edit box, button but also it didnt work. I tried the WS_GROUP but as well, it gave no result..

In the window, I specified WS_CHILD | WS_TABSTOP | WS_CAPTION
In the text fields, I specified: WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP
but none is giving results :@. I'm still not able to write anything in the text fields as if they are disabled.
The main window is the parent of text field and both have the same instance..

Please any ideas?
The main window is the parent of text field and both have the same instance..

Aren't you placing the text field in the child window, not the main window? You should pass in to CreateWindowEx (for the text field), the child window hWnd instead of prntWnd_p->BsolGetWndHandle().

Does calling GetLastError right after creating the text field give any hints?
prntWnd_p->BsolGetWndHandle() is the child window in which the text field must be placed. Furthermore, the main window and its child window are opening properly and in the child window I can see the text fields placed correctly but not able to access them


Did you try using the IsDialogMessage() function? In the WndProc for the main window, have a case for WM_KEYDOWN, and call IsDialogMessage(), passing in the handle of the child window. Hopefully that should help.
Don't use WS_CHILD or WS_GROUP to the text controls, leave default behavior for testing.
Maybe you created read-only edit controls, what returns GetWindowLongPtr() with GWLP_STYLE ? Is ES_READONLY enabled or not ? If it does, call SendMessage() with EM_SETREADONLY.
Topic archived. No new replies allowed.