mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 06:39:26 +02:00
MG: made ShowModal more dlephi compatible
git-svn-id: trunk@1643 -
This commit is contained in:
parent
486bb0667d
commit
be7e4beacc
@ -90,6 +90,7 @@ type
|
|||||||
FPosition : TPosition;
|
FPosition : TPosition;
|
||||||
FWindowState : TWindowState;
|
FWindowState : TWindowState;
|
||||||
Procedure ClientWndProc(var Message: TLMessage);
|
Procedure ClientWndProc(var Message: TLMessage);
|
||||||
|
procedure CloseModal;
|
||||||
procedure DoCreate;
|
procedure DoCreate;
|
||||||
procedure DoDestroy;
|
procedure DoDestroy;
|
||||||
Procedure SetActiveControl(Value : TWinControl);
|
Procedure SetActiveControl(Value : TWinControl);
|
||||||
|
@ -38,6 +38,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomForm.CloseModal;
|
||||||
|
var
|
||||||
|
CloseAction: TCloseAction;
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
CloseAction := caNone;
|
||||||
|
if CloseQuery then
|
||||||
|
begin
|
||||||
|
CloseAction := caHide;
|
||||||
|
DoClose(CloseAction);
|
||||||
|
end;
|
||||||
|
case CloseAction of
|
||||||
|
caNone: ModalResult := 0;
|
||||||
|
//caFree: Release;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
ModalResult := 0;
|
||||||
|
Application.HandleException(Self);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCustomForm.BeforeDestruction
|
Method: TCustomForm.BeforeDestruction
|
||||||
Params: None
|
Params: None
|
||||||
@ -949,24 +970,53 @@ begin
|
|||||||
ReleaseCapture;
|
ReleaseCapture;
|
||||||
|
|
||||||
Include(FFormState, fsModal);
|
Include(FFormState, fsModal);
|
||||||
|
{ActiveWindow := GetActiveWindow;
|
||||||
|
SaveFocusCount := FocusCount;
|
||||||
|
Screen.FSaveFocusedList.Insert(0, Screen.FFocusedForm);
|
||||||
|
Screen.FFocusedForm := Self;
|
||||||
|
SaveCursor := Screen.Cursor;
|
||||||
|
Screen.Cursor := crDefault;
|
||||||
|
SaveCount := Screen.FCursorCount;
|
||||||
|
WindowList := DisableTaskWindows(0);}
|
||||||
ModalResult := 0;
|
ModalResult := 0;
|
||||||
|
try
|
||||||
Show;
|
Show;
|
||||||
CNSendMessage(LM_ShowModal, Self, nil);
|
try
|
||||||
Repeat
|
CNSendMessage(LM_ShowModal, Self, nil);
|
||||||
Application.HandleMessage;
|
Repeat
|
||||||
If ModalResult <> 0 then Close;
|
Application.HandleMessage;
|
||||||
If Application.FTerminate then ModalResult := mrCancel;
|
{if ModalResult <> 0 then Close;
|
||||||
until ModalResult <> 0;
|
if Application.FTerminate then ModalResult := mrCancel;}
|
||||||
|
if Application.FTerminate then ModalResult := mrCancel else
|
||||||
Exclude(FFormState, fsModal);
|
if ModalResult <> 0 then CloseModal;
|
||||||
|
until ModalResult <> 0;
|
||||||
Result := ModalResult;
|
Result := ModalResult;
|
||||||
|
//if GetActiveWindow <> Handle then ActiveWindow := 0;
|
||||||
|
finally
|
||||||
|
Hide;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
{if Screen.FCursorCount = SaveCount then
|
||||||
|
Screen.Cursor := SaveCursor
|
||||||
|
else Screen.Cursor := crDefault;
|
||||||
|
EnableTaskWindows(WindowList);
|
||||||
|
if Screen.FSaveFocusedList.Count > 0 then
|
||||||
|
begin
|
||||||
|
Screen.FFocusedForm := Screen.FSaveFocusedList.First;
|
||||||
|
Screen.FSaveFocusedList.Remove(Screen.FFocusedForm);
|
||||||
|
end else Screen.FFocusedForm := nil;
|
||||||
|
if ActiveWindow <> 0 then SetActiveWindow(ActiveWindow);
|
||||||
|
FocusCount := SaveFocusCount;}
|
||||||
|
Exclude(FFormState, fsModal);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.40 2002/04/26 15:31:06 lazarus
|
||||||
|
MG: made ShowModal more dlephi compatible
|
||||||
|
|
||||||
Revision 1.39 2002/04/26 12:26:50 lazarus
|
Revision 1.39 2002/04/26 12:26:50 lazarus
|
||||||
MG: improved clean up
|
MG: improved clean up
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user