Browse Source

show dropdown as modal on MacOS if parent is modal

Johann ELSASS 9 months ago
parent
commit
928918b001
1 changed files with 9 additions and 4 deletions
  1. 9 4
      bccombobox.pas

+ 9 - 4
bccombobox.pas

@@ -241,12 +241,17 @@ begin
       if FForm.Top + FForm.Height > Screen.WorkAreaTop + Screen.WorkAreaHeight then
         FForm.Top := FForm.Top - FForm.Height - Self.Height;
       if Assigned(FOnDropDown) then FOnDropDown(self);
-      FForm.Visible := True;
-      if FListBox.CanSetFocus then
-        FListBox.SetFocus;
       FQueryDropDownHide := false;
       FTimerCheckFormHide.Enabled:= true;
-      //FForm.ShowModal;
+      {$IFDEF DARWIN}
+      f := GetParentForm(self, False);
+      if fsModal in f.FormState then FForm.ShowModal else
+      {$ENDIF}
+      begin
+        FForm.Visible := True;
+        if FListBox.CanSetFocus then
+          FListBox.SetFocus;
+      end;
     end;
   end;
 end;