Recent

Author Topic: OpenDialog is too big and not resizable  (Read 720 times)

user5

  • Sr. Member
  • ****
  • Posts: 414
OpenDialog is too big and not resizable
« on: June 23, 2025, 10:36:57 am »
    I just started using Lazarus 4.0 32/64 to compile a program. I was surprised that the OpenDialog (and SaveDialog) windows
of the program fill the entire screen when they open and they are not resizable. OpenDialog1.width does not work, they have no
minimize click tabs and I cannot resize them by dragging their edges.
    I have researched this and I have found some references to this issue, including on this forum, but I'm still unsure about this.
    One reference I found reads: "Widgetset: The appearance and specific behavior of the dialogs can be influenced by the chosen
widgetset (e.g., Win32, GTK).".
    I did notice that in Project Options the widgetset can be changed.
    Is there some setting in Project Options that will fix this?

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: OpenDialog is too big and not resizable
« Reply #1 on: June 23, 2025, 10:44:06 am »
    I forgot to ask: Is there a Windows API that will do the job?

Thaddy

  • Hero Member
  • *****
  • Posts: 17451
  • Ceterum censeo Trumpum esse delendum (Tnx Charlie)
Re: OpenDialog is too big and not resizable
« Reply #2 on: June 23, 2025, 10:48:31 am »
Yes, some of the Laz dialogs are really too big even on full hd which is the most common screen size.
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: OpenDialog is too big and not resizable
« Reply #3 on: June 23, 2025, 11:07:58 am »
    I opened a Lazarus 4.0 new project and tested OpenDialog1 and it opened correctly, with resizable borders. This tells me that the behavior
of OpenDialog1 with the previously mentioned program is affected by something in the code, or perhaps because that program was originally
compiled on a much earlier Lazarus version.
    I am going to search for a Windows API that might help.

440bx

  • Hero Member
  • *****
  • Posts: 5593
Re: OpenDialog is too big and not resizable
« Reply #4 on: June 23, 2025, 11:09:35 am »
    I forgot to ask: Is there a Windows API that will do the job?
Yes, there are at least 2 functions that will resize the window to your liking, they are MoveWindow and SetWindowPos, both fully documented.  Use your favorite search engine to find MS' documentation for them.  Just FYI, for what you intend to use it, MoveWindow is probably a better choice because it is simpler.  That said, check out SetWindowPos anyway as it has a few capabilities you might find interesting.

HTH.


(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: OpenDialog is too big and not resizable
« Reply #5 on: June 23, 2025, 12:30:33 pm »
    The code below compiled but it had no effect. I need to change the size of an OpenDialog, not a form.
    I may need to choose a new widget set since the program being compiled on Lazarus 4.0 was previously compiled on an older
Lazarus version. I read that Lazarus 4.0 uses the Win32 widget set.
    The Additions and Overrides page lists a number of widget sets including Win32/Win64. On a test project, if I change the widget
set to Win34/Win64 then the Additions and Overrides page changes to show a new listing but I can't figure out how to return to
whatever the default was. Win32 widget set isn't listed.
    Thus, I think that a different widget set may help but I don't want to change it by pressing the OK button unless I can go back to
the default, if needed.
    I'm going to study this further but I could use some guidance. Thanks.

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: OpenDialog is too big and not resizable
« Reply #6 on: June 23, 2025, 12:32:34 pm »
    I forgot to include the code, which is shown below.

Code: Pascal  [Select][+][-]
  1. SetWindowPos(OpenDialog1.Handle, 0, 1, 1, 800, 600, SWP_DRAWFRAME);

wp

  • Hero Member
  • *****
  • Posts: 12913
Re: OpenDialog is too big and not resizable
« Reply #7 on: June 23, 2025, 12:48:29 pm »
Switching to a different widgetset is a drastic change. If you are on Windows you'll need to add dlls for that new widgetset, maybe they are not available at all for windows...

You should try to fix the original issue. A full-screen OpenDialog is not normal on windows, and there must be a reason for it. Explaining it by the a newer Laz/FPC version new is not convincing to me since all units will be recompiled anyway after the version change.

Open the lfm file of the form with that OpenDialog in an external editor, find the part which deals with the OpenDialog and paste it into the forum post so that we can see the properties used. Show us also any code which addresses the Opendialog.

Did you see the option ofEnableSizing of the opendialog? There is also the ofOldStyleDialog option which might have an effect. What happens when you change them?

440bx

  • Hero Member
  • *****
  • Posts: 5593
Re: OpenDialog is too big and not resizable
« Reply #8 on: June 23, 2025, 04:27:29 pm »
    I forgot to include the code, which is shown below.

Code: Pascal  [Select][+][-]
  1. SetWindowPos(OpenDialog1.Handle, 0, 1, 1, 800, 600, SWP_DRAWFRAME);
Sounds like the window is maximized.  In that case, it needs to be "normal" before it can be sized.

Try ShowWindow(OpenDialog1.Handle, SW_NORMAL);  after that, you may need SetWindowPos or MoveWindow.  I recommend you use MoveWindow in this case.

However, as @wp mentioned, the dialog should definitely not be maximized.  if it is, there must be some setting somewhere causing it to be maximized because it normally isn't.

HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

wp

  • Hero Member
  • *****
  • Posts: 12913
Re: OpenDialog is too big and not resizable
« Reply #9 on: June 23, 2025, 06:06:59 pm »
Found this one: https://www.youtube.com/watch?v=6Ge-vJqvC94. Maybe it's the same issue...

n7800

  • Sr. Member
  • ****
  • Posts: 400
Re: OpenDialog is too big and not resizable
« Reply #10 on: June 23, 2025, 06:21:23 pm »
    I just started using Lazarus 4.0 32/64 to compile a program. I was surprised that the OpenDialog (and SaveDialog) windows
of the program fill the entire screen when they open and they are not resizable. OpenDialog1.width does not work, they have no
minimize click tabs and I cannot resize them by dragging their edges.

Try double-clicking on the window title bar (the bar with the window name and close button). This toggles the window between normal and maximized.

It's weird that this window doesn't have those buttons (near the close button), but double-clicking still works.

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: OpenDialog is too big and not resizable
« Reply #11 on: June 24, 2025, 12:28:29 am »
    Yes, ofEnableSizing was in the Options box of the OpenDialog. The code you requested is shown below. I will not mess around with the widgetsets.
    You should know that the program was originally compiled with Lazarus 1.0.10.0
    This forum in a different thread helped me to get it to compile on Lazarus 4.0 and that in itself was a major feat.
    Other bizarre problems have been encountered when the program is run though up to now all have been fixable. For example, in some cases the mere presence of the line "Form5.FormStyle := fsNormal" would cause Form5 to erroneously reload itself as with a Form5.Show command, while in other cases that command statement would cause no problems.
           
    wp, I ran the YouTube video that you mentioned, did what it suggested and it fixed the problem! All the dialogs now work fine in the entire program. Weird.
    Thank you all.

Code: Pascal  [Select][+][-]
  1. object OpenDialog1: TOpenDialog
  2.     Left = 635
  3.     Top = 337
  4.   end
  5.   object Timer1: TTimer
  6.     Enabled = False

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: OpenDialog is too big and not resizable
« Reply #12 on: June 24, 2025, 12:54:27 am »
    A few more thoughts...
    I don't expect to encounter problems with the sub-programs that are launched by the main
program (Form5 and other major forms) because those were written with Lazarus 2.2.6.
    For reliability reasons it looks like I will have to eventually test most or all of the tools in the
program before I can trust it enough to upload it to its download site.
    Until the program is fully tested I will upload the original Lazarus version because it has shown
no such problems and as far as I know it runs fine on all Windows platforms.
    Thanks again.

 

TinyPortal © 2005-2018