views:

221

answers:

2

I created two application MainApps and SubApps, the SubApps has a modal type dialogbox such as login/logout form etc. and its working fine.

After I attach it to the MainApps, the Modal Dialog box shows like normal box form. It behaves like "DIALOG.SHOW" instead of "DIALOG.SHOWMODAL";

I am using delphi compiler

SubApps buttonclick;

  begin
    with TfrmDialog.Create(Self, dtLogout) do
    try
      iMsgResult := ShowModal;
    finally
      Free;
    end;
    if iMsgResult = mrOk then
    begin
      dmVoca.FHomeworkXMLDoc.Active := False;
      //Disabled Double Login
      dmVoca.tmrDoubleLogin.Enabled := False;
      ................
    end;  
  end;

MainApps ButtonClick

begin
setparent(findwindow(nil,'SubApps'),TabSheet1.Handle);
.........
end;
+4  A: 
Sertac Akyuz
there is no problem if i can click buttons on the MainApps. the SubApps form should be disbled if it popups a modal dialog that belong to subapps itself. it totaly ignor all modals from the subApps. is there a way to turn it back?
XBasic3000
As you can see in forms.pas, `DisableTaskWindows` uses `EnumThreadWindows` to enumerate all top level windows that belong to the current thread. After being parented, your form is no longer a *top level* window, hence it doesn't get enumerated and disabled . Impose your logic around 'ShowModal', like; `EnableWindow(Handle, False)`, `try`, `with TfrmDialog.Create(Self, dtLogout) do`, `try` etc..
Sertac Akyuz
@Sertac Akyuz how to make the DialogBox from the SubApps to stay on top of the MainApps? cause if i click the MainApps DialogBox(SubApps) will be send at the back.
XBasic3000
@XBasic3000 - I've updated the answer.
Sertac Akyuz
+2  A: 

Try making your windows "system modal" instead of "application modal". Actually, I have no idea if you can even do that. It might be impossible, or a bad idea. In fact, the whole question gives me the "bad idea" smell.

Warren P