Changeset 271


Ignore:
Timestamp:
Jun 30, 2020, 5:02:02 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Modal dialogs closure.
  • Fixed: DpiScreen.ActiveForm tracks history of previously active forms.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/DpiControls/UDpiControls.pas

    r270 r271  
    786786    // TScreen
    787787    FDpi: Integer;
    788     FActiveFormPrev: TDpiForm;
    789788    FActiveForm: TDpiForm;
    790789    FPrevActiveForms: TDpiForms;
     
    30013000begin
    30023001  FForms.Remove(AForm);
     3002  FPrevActiveForms.Remove(AForm);
    30033003  if AForm = FActiveForm then begin
    3004     FActiveFormPrev := FActiveForm;
    30053004    FActiveForm := nil;
    30063005  end;
     
    37383737procedure TDpiForm.ActivateHandler(Sender: TObject);
    37393738begin
    3740   DpiScreen.FActiveFormPrev := DpiScreen.FActiveForm;
     3739  if Assigned(DpiScreen.FActiveForm) then begin
     3740    if DpiScreen.FPrevActiveForms.IndexOf(DpiScreen.FActiveForm) <> - 1 then
     3741      DpiScreen.FPrevActiveForms.Remove(DpiScreen.FActiveForm);
     3742    DpiScreen.FPrevActiveForms.Add(DpiScreen.FActiveForm);
     3743  end;
    37413744  DpiScreen.FActiveForm := Self;
    37423745  if Assigned(FOnActivate) then FOnActivate(Sender);
     
    37453748procedure TDpiForm.DeactivateHandler(Sender: TObject);
    37463749begin
    3747   DpiScreen.FActiveForm := DpiScreen.FActiveFormPrev;
     3750  if DpiScreen.FPrevActiveForms.Count > 0 then begin
     3751    DpiScreen.FActiveForm := DpiScreen.FPrevActiveForms.Last;
     3752    DpiScreen.FPrevActiveForms.Delete(DpiScreen.FPrevActiveForms.Count - 1);
     3753  end else DpiScreen.FActiveForm := nil;
    37483754  //DpiScreen.UpdateActiveFormFromNativeScreen;
    37493755  if Assigned(FOnDeactivate) then FOnDeactivate(Sender);
     
    38273833  IsMainForm: Boolean;
    38283834begin
    3829   if fsModal in FormState then
     3835  if (fsModal in FormState) and (ModalResult = 0) then
    38303836    ModalResult := mrCancel
    38313837  else
Note: See TracChangeset for help on using the changeset viewer.