Edit controls not sending messages to parent window

This is a discussion on Edit controls not sending messages to parent window within the Windows Programming forums, part of the Platform Specific Boards category; I'm having a real bummer here on Windows CE. I am developing a file editing utility for CE, and basically ...

  1. #1
    EMiller
    Guest

    Edit controls not sending messages to parent window

    I'm having a real bummer here on Windows CE. I am developing a file editing utility for CE, and basically it's a dialog window with lots of edit controls. I create the main window like this

    hwndApp = CreateWindowEx(WS_EX_CLIENTEDGE,
    TEXT("RAS Profile Editor"),
    TEXT("RAS Profile Editor"),
    WS_VISIBLE | WS_CAPTION | WS_SYSMENU,
    0, 0, 410, 220,
    NULL,
    NULL,
    ghInstance,
    0);

    where RAS Profile Editor is the registered class name. I then
    create the child edit windows, one of which looks like this:

    hCountryCode = CreateWindowEx(0,
    TEXT( "EDIT" ),
    szCountryCode.c_str(),
    WS_CHILD | WS_VISIBLE | WS_BORDER |
    ES_AUTOHSCROLL,
    7, 25, 20, 30,
    hwndApp,
    (HMENU)IDC_COUNTRYCODE,
    ghInstance,
    NULL);

    Note the parent window handle is the window created above.

    Now, this all works and draws and looks great, BUT, I cannot get any char messages from the edit box! No keyboard messages come back to the parent proc as WM_COMMAND's. It DOES go into the parent's window proc when I set focus or click on the edit control using the mouse, but no keyboard commands.

    How do I get these messages handled??????

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    An edit control will handle all of it's own keyboard messages. However, you can send messages to edit controls to find out if the contents have been modified. Check MSDN for details of this aswell as other editbox messages. If you need more control than this then you'll have to use subclassing.
    zen

  3. #3
    EMiller
    Guest
    Thanks Zen--this would be ok except the editbox is dead--it
    displays the original text set by the createwindow, but doesn't
    accept new text. If this were the case, no problem, I'd be ready to go. But it looks like the edit control needs handling to even
    change the text in it.

    i would figure the default proc would do all that. I don't know why it ain't.

  4. #4
    EMiller
    Guest
    So nobody EVER has to go through THIS, here's the solution to this problem:

    Don't forget to check if a message is a DIALOG message
    before calling DispatchMessage in the message loop of the Winmain function:

    while ( GetMessage(&msg, NULL, 0, 0) == TRUE )
    {
    f (hwndApp && !IsDialogMessage( hwndApp,
    &msg ) )
    DispatchMessage(&msg);

    }

  5. #5
    EMiller
    Guest
    So nobody EVER has to go through THIS, here's the solution to this problem:

    Don't forget to check if a message is a DIALOG message
    before calling DispatchMessage in the message loop of the Winmain function:

    while ( GetMessage(&msg, NULL, 0, 0) == TRUE )
    {
    if (hwndApp && !IsDialogMessage( hwndApp,
    &msg ) )
    DispatchMessage(&msg);

    }

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Or just


    Code:
    	if (FALSE == IsDialogMessage(hDlg, &msg))
    	{
    		TranslateMessage(&msg) ;
    		DispatchMessage(&msg) ;
    	}
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parent not repainting Bitmp after child window closes
    By CodeX in forum Windows Programming
    Replies: 5
    Last Post: 10-05-2006, 12:03 AM
  2. Adding buttons, edit boxes, etc to the window
    By rainmanddw in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2006, 03:07 PM
  3. Sending windows messages
    By Ideswa in forum Windows Programming
    Replies: 2
    Last Post: 03-02-2006, 12:27 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Receiving messages from child of a child.
    By Sindol in forum Windows Programming
    Replies: 3
    Last Post: 01-26-2002, 06:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21