How to handle multiple windows in the main event loop?

Online Status

I have a pMainWindowObject with some Gadgets and an event loop that looks like this:

while (!end)
{
  receivedSig = Wait(pApp->SigMask);
  while ((result = DoMethod(pMainWindowObject, WM_HANDLEINPUT, &code)))
  {
    switch (result & WMHI_CLASSMASK)
    {
      case WMHI_CLOSEWINDOW:
        end = TRUE;
        break;
      case WMHI_GADGETUP:
        handleGadgets(pApp, result);
        break;
    }
  }
}

And if one certain Button in the main window is pressed, another Window, pSubWindowObject, is created and opened somewhere inside handleGadgets(). Now I want also to receive the events for the pSubWindowObject in the event loop above. So, after the subwindow is created and opened successfully , the pApp->SigMask is already updated:

ULONG sigmask;
...

GetAttr(WINDOW_SigMask, pSubWindowObject, &sigmask);
pApp->SigMask |= sigmask;

But when I press a Button in the sub window, no WHMI_GADGETUP is received in the event loop above.

Is there something I missed to set up to receive these events?

Online Status

Just updating the sigmask isn't enough

You have to call the WM_HANDLEINPUT method for each window and process the messages for each window

Online Status

This works. Thank you very much!