Recent

Author Topic: How to make form/window non-resizable  (Read 1123 times)

rnfpc

  • Jr. Member
  • **
  • Posts: 91
How to make form/window non-resizable
« on: June 29, 2019, 08:33:28 am »
I am using Lazarus to create a simple gui application with one form only. It has a single button, label and an edit field.

I see that I can adjust name, caption, default text etc. However, I want to make the window fixed in size and not be resizable. I want the resize button at top right also to be disabled. How can I do these adjustments?

howardpc

  • Hero Member
  • *****
  • Posts: 3579
Re: How to make form/window non-resizable
« Reply #1 on: June 29, 2019, 09:10:51 am »
At least two form properties are useful for you.
Setting BorderStyle to bsDialog will prevent users from altering the window dimensions.
The BorderIcons property controls which system icons are shown. However, its effects vary slightly across platforms, and also depend, IIRC, on whether the form is the project's main form, or a subsidiary form.

rnfpc

  • Jr. Member
  • **
  • Posts: 91
Re: How to make form/window non-resizable
« Reply #2 on: June 29, 2019, 10:03:44 am »
Yes, bsDialog worked very well. Thanks.

lucamar

  • Hero Member
  • *****
  • Posts: 3181
Re: How to make form/window non-resizable
« Reply #3 on: June 29, 2019, 02:38:45 pm »
Setting BorderStyle to bsSingle will do it too and leave you with a normal form, which bsDilaog may not do do.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.10/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

andyH

  • New Member
  • *
  • Posts: 35
Re: How to make form/window non-resizable
« Reply #4 on: September 24, 2020, 07:51:27 pm »
I can confirm bsDialog and bsSingle behave differently.

Home built ubuntu with openbox window mgr, pcmanfm as desktop mgr and lxpanel. With bsDialog when my application ran, the entry in the panel was not showing the correct icon, with bsSingle it behaved 'properly' and showed my application icon in the panel. Both froze the main window size, which was what I wanted.

Blaazen

  • Hero Member
  • *****
  • Posts: 2994
  • POKE 54296,15
    • Eye-Candy Controls
Re: How to make form/window non-resizable
« Reply #5 on: September 24, 2020, 08:06:42 pm »
You can also use property Form.Constraints (i.e. set MaxWidth=640 and MinWidth=640 etc.)
Lazarus 2.1.0 r64115 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

 

TinyPortal © 2005-2018