Recent

Author Topic: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger  (Read 1898 times)

apeoperaio

  • Full Member
  • ***
  • Posts: 201
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
« Last Edit: December 07, 2020, 10:11:09 am by apeoperaio »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2547
    • havefunsoft.com
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #1 on: November 21, 2020, 07:32:19 pm »
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

apeoperaio

  • Full Member
  • ***
  • Posts: 201
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #2 on: November 23, 2020, 11:57:10 am »

Hansaplast

  • Hero Member
  • *****
  • Posts: 607
  • Tweaking4All.com
    • Tweaking4All
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #3 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.

ChrisR

  • Full Member
  • ***
  • Posts: 187
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #4 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....

ChrisR

  • Full Member
  • ***
  • Posts: 187
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #5 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?

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1211
  • Former Delphi 1-7, 10.2 User
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #6 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.
o Lazarus 2.1 r64368 FPC 3.3.1 r48100 macOS 10.14.6 Xcode 11.3.1
o Lazarus 2.1 r64392 3.3.1 Jan 13 21:24 macOS 11.1 aarch64 Xcode 12.3
o Lazarus 2.1 r61574 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
o Lazarus 2.1 r61574 3.0.4 Ubuntu 20.04 Parallels VM
o Lazarus 2.0.10 3.2.0 Win10 Parallels VM

Hansaplast

  • Hero Member
  • *****
  • Posts: 607
  • Tweaking4All.com
    • Tweaking4All
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #7 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?

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1211
  • Former Delphi 1-7, 10.2 User
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #8 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.
o Lazarus 2.1 r64368 FPC 3.3.1 r48100 macOS 10.14.6 Xcode 11.3.1
o Lazarus 2.1 r64392 3.3.1 Jan 13 21:24 macOS 11.1 aarch64 Xcode 12.3
o Lazarus 2.1 r61574 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
o Lazarus 2.1 r61574 3.0.4 Ubuntu 20.04 Parallels VM
o Lazarus 2.0.10 3.2.0 Win10 Parallels VM

Hansaplast

  • Hero Member
  • *****
  • Posts: 607
  • Tweaking4All.com
    • Tweaking4All
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #9 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.

apeoperaio

  • Full Member
  • ***
  • Posts: 201
Re: Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #10 on: December 07, 2020, 10:10:52 am »
Fixed in trunk, thank you @skalogryyz

Hansaplast

  • Hero Member
  • *****
  • Posts: 607
  • Tweaking4All.com
    • Tweaking4All
Re: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #11 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?
« Last Edit: December 07, 2020, 01:00:27 pm by Hansaplast »

Hansaplast

  • Hero Member
  • *****
  • Posts: 607
  • Tweaking4All.com
    • Tweaking4All
Re: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #12 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

Clover

  • New Member
  • *
  • Posts: 46
Re: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #13 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?

Hansaplast

  • Hero Member
  • *****
  • Posts: 607
  • Tweaking4All.com
    • Tweaking4All
Re: [SOLVED] Lazarus: OpenDialog with filters is getting bigger and bigger
« Reply #14 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 😊

 

TinyPortal © 2005-2018