davelane
asked on
Making a visible form modal
Here is the scenario,
I have an application that has 2 main forms DATA and MAP. Both forms will always be open and visible. OK, in DATA when you click a button to input a new entity a modal form DATACHILD appears to facilitates input. An option is to select an element from MAP: I want to then use the MAP form that is already visible (because of MAP loading time I cannot fire it up anew every time). How do I get the MAP form to now act as a modal form for the DATACHILD form. Is this possible?
I have an application that has 2 main forms DATA and MAP. Both forms will always be open and visible. OK, in DATA when you click a button to input a new entity a modal form DATACHILD appears to facilitates input. An option is to select an element from MAP: I want to then use the MAP form that is already visible (because of MAP loading time I cannot fire it up anew every time). How do I get the MAP form to now act as a modal form for the DATACHILD form. Is this possible?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Things like timer events will still occur in either form.
ASKER
Yeah? But is that not also the case with ModalForms in general? If not then what have I done in the function above to cause this (presuming it is a bad thing).
Nope - Modal forms in general. Was just reminding you :-)
ASKER
function MAP.SelectFromMap: TModalResult;
var
PrevActiveWindow: HWnd;
begin
try
Self.ButtonOK.Visible := true;
Self.ButtonCancel.Visible := true;
Self.Return := mrNone;
// Enable myself and disable the form that called me
PrevActiveWindow := GetActiveWindow;
EnableWindow(Self.Handle, true);
EnableWindow(PrevActiveWin
SendMessage(Self.Handle, CM_ACTIVATE, 0, 0);
SetActiveWindow(Self.Handl
repeat
Application.HandleMessage;
until Self.Return <> mrNone;
Result := Self.Return;
// Disable myself and reenable that called me
SendMessage(Self.Handle, CM_DEACTIVATE, 0, 0);
EnableWindow(Self.Handle, false);
EnableWindow(PrevActiveWin
SetActiveWindow(PrevActive
finally
Self.OK.Visible := false;
Self.Cancel.Visible := false;
end;
end;