Lazarus

Programming => Widgetset => Cocoa => Topic started by: apeoperaio on November 20, 2020, 09:12:41 am

Title: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: apeoperaio on November 20, 2020, 09:12:41 am
I have an issue with TOpenDialog when I set the Filter property.

If I set the filter option with my own filters every time I open the dialog it gets bigger and bigger, with no chance to resize it.

You can check it directly with Lazarus, just Click on 'File' --> 'Open' menu several times. The opendialog is getting bigger and bigger.

You can test also the attached project. (one button and one opendialog).

How can I fix it? There is a workaround? There is a file including the opendialog information that I can edit to restore original size?

I am using macOS Big Sur.

Thank you.


Lazarus 2.0.11 r64142M FPC 3.2.0 x86_64-darwin-cocoa
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: skalogryz on November 21, 2020, 07:32:19 pm
please create a bug report (https://wiki.freepascal.org/How_do_I_create_a_bug_report)
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: apeoperaio on November 23, 2020, 11:57:10 am
Submitted as: id= 0038121

https://bugs.freepascal.org/view.php?id=38121
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: Hansaplast on December 04, 2020, 02:08:21 pm

+1


Running Lazarus 2.1.0 r64169 FPC 3.3.1 x86_64-darwin-cocoa on Big Sur myself.
The file open dialog of the Lazarus IDE already expanded outside of the view of my ultrawide monitor.
Resizing can only be done vertically, not horizontally.
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: ChrisR on December 04, 2020, 05:52:42 pm
In the comments, David Gray provided a lead. Running this command from the terminal resolved my problem (at least temporarily):
defaults delete lazarus.freepascal.ide NSNavPanelExpandedSizeForOpenMode


It works for other applications as well. You just need to know their CFBundleIdentifier which you can find in the application Info.plist, e.g.
  defaults delete www.mricro.com.surfice NSNavPanelExpandedSizeForOpenMode

Maybe Dmitry can provide insight regarding whether this is specific to Lazarus or an Apple Big Sur bug....
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: ChrisR on December 04, 2020, 06:00:57 pm
Running this from the command line:
  defaults read lazarus.freepascal.ide
Reports:

{
    NSNavLastRootDirectory = "~/src/lazarus/components/printers/cocoa";
    NSNavLastUserSetHideExtensionButtonState = 1;
    NSNavPanelExpandedSizeForOpenMode = "{944, 448}";
    NSNavPanelExpandedSizeForSaveMode = "{929, 448}";
    NSNavPanelExpandedStateForSaveMode = 1;
    "NSWindow Frame NSNavPanelAutosaveName" = "488 472 944 418 0 0 1920 1055 ";
}


And running
  defaults write lazarus.freepascal.ide NSNavPanelExpandedStateForSaveMode -bool false
switches off the save mode. This still does not explain why these panels grow, but maybe it has something to do with how Lazarus handles scaling on retina displays. Is there some way we could have Lazarus applications set the save mode to false by default?
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: trev on December 04, 2020, 10:48:04 pm
This still does not explain why these panels grow, but maybe it has something to do with how Lazarus handles scaling on retina displays.

I don't have a Retina resolution monitor and it happens to me on Big Sur (on my M1 Mac mini), but not on Mojave (on an Intel Mac mini) on the same monitor.
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: Hansaplast on December 05, 2020, 02:44:36 pm
I don't have a Retina resolution monitor and it happens to me on Big Sur


Same here with a Mac Pro. Probably Big Sur related?
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: trev on December 05, 2020, 10:01:25 pm
Same here with a Mac Pro. Probably Big Sur related?

Curiously Apple's applications do not suffer from it and neither does Firefox nor WiFi Explorer (the only two non-Apple applications I have installed), so it may be a subtle Apple API change in Big Sur.
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: Hansaplast on December 06, 2020, 01:12:28 pm
Curiously Apple's applications do not suffer from it


Good observation ... Maybe Dmitry has an idea why this happens?


On that note, and probably a macOS limitation, I've never been very happy with the file dialogs.
Especially when it comes to filtering certain file types and how certain files and directories are ghosted and others are not.
When looking at BBEdit though, I wonder how flexible these file dialogs are. Try clicking "Options" in a BBEdit filedialog, or even Microsoft Word.
Title: Re: Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: apeoperaio on December 07, 2020, 10:10:52 am
Fixed in trunk, thank you @skalogryyz
Title: Re: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: Hansaplast on December 07, 2020, 11:54:31 am
Thanks @skalogryzz for putting the time and effort in this. 😊


However, I just updated to Lazarus 2.1.0 r64176 FPC 3.3.1 x86_64-darwin-cocoa, and started Lazarus after deleting all the defaults, and the problem seems to be still there. Just do a few times "File" - "Open" - "Cancel". 😞


I deleted the preferences with the following statement in Terminal.
Did I not do this the right way?


Code: [Select]
defaults delete lazarus.freepascal.ide

Note; just updated again to Lazarus 2.1.0 r64178 FPC 3.3.1 x86_64-darwin-cocoa - problem remains.


Is there a particular reason why a file dialog can only resize bigger and not smaller?
Title: Re: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: Hansaplast on December 07, 2020, 03:59:02 pm
Never mind ...


I'm using FPCUpDeluxe to work with trunk and for some odd reasons it did not update


Code: Pascal  [Select][+][-]
  1. /lcl/interfaces/cocoa/cocoawsdialogs.pas
Title: Re: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: Clover on December 08, 2020, 11:03:02 pm
Many thanks for the fix Dmitry.

Ironically, after I updated to Big Sur 11.1 beta, I think Apple must have fixed this issue anyhow, as I can no longer get it to go wrong in my older app built with Lazarus 2.0.10 running on 11.1

Can anyone else confirm that?
Title: Re: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: Hansaplast on December 09, 2020, 12:33:07 pm
Ironically, after I updated to Big Sur 11.1 beta, I think Apple must have fixed this issue anyhow, as I can no longer get it to go wrong in my older app built with Lazarus 2.0.10 running on 11.1


I do not think this was a Big Sur beta related bug. I never installed the Big Sur beta and I did encounter the same issue in the release version of Big Sur (11.0.1).
Dmitry's fix is excellent though, since it now also allows me to resize file dialogs 😊
Title: Re: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
Post by: Clover on December 09, 2020, 05:32:49 pm
@Hansaplast It is indeed a Big Sur related bug, dmitry's fix has a test so that it only applies to the public released Big Sur 11.0 or higher.

The bug was in all the 11.0 betas that I tried, and the first 11.0 public release. But, it doesn't appear to happen in the current 11.1 beta as far as I can tell.

I believe the 11.1 public release will be on Dec 14, so we can either release a fix now, or just tell our users to update to 11.1 in a week's time.
TinyPortal © 2005-2018