Re: Getting key input to edit/combo controls on custom dialog.
  Home FAQ Contact Sign in
comp.os.mswindows.programmer.win32 only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: Getting key input to edit/combo controls on custom dialog.         

Group: comp.os.mswindows.programmer.win32 · Group Profile
Author: k.bramhill
Date: May 16, 2008 07:13

Partly solved, the following bit works for an editable combo control
so I can now enter text to it:-
I found that by trapping the WM_LBUTTONDOWN to set the focus I could
then test not only the msg.hwnd to see if it was one of my controls
but, if that failed, test the result of ::GetParent(msg.hwnd) and if
that fails ::GetParent(::GetParent(msg.hwnd)) to look for a recognised
hwnd and then pass the recognised hwnd to IsDialogMessage() as normal.

The above solution does not work for the standard "edit" class of
control that I create with something like this:

m_hWnd = CreateWindow(
TEXT("edit"),
NULL,
WS_CHILD | WS_VISIBLE | WS_BORDER |
ES_AUTOHSCROLL | ES_LEFT | WS_TABSTOP,
m_sRect.left, m_sRect.top, m_sRect.right - m_sRect.left,
m_sRect.bottom - m_sRect.top,
hwnd, // Parent window - my custom dialog HWND
(HMENU)id, // Windows "ID" for this control
CGuiApplication::hInst,
NULL);

I could convert a combo control into an edit look-a-like by removing
CBS_DROPDOWN from the syle bits before I create it and then I have
something that works. But what if I have to use an ordinary edit
control, what should I do to make it work when added to my custom
dialog that is different to what you need for a combo edit control?

Thanks.
no comments
diggit! del.icio.us! reddit!