Recent

Author Topic: Form resize fails under Debian/Linux  (Read 7598 times)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 561
    • My "almost daily" development blog
Form resize fails under Debian/Linux
« on: February 12, 2015, 09:55:24 am »
I'm not sure if the question relates to GTK2 widgetset or the linux compilation itself (the code works perfectly for windows)
I have a problem with the following code:
Code: [Select]
form1.endFormUpdate;
{$IFDEF UNIX}form1.BorderStyle:=bsnone;{$ENDIF}
form1.width:=cellsize*maxx+2;
form1.height:=cellsize*maxy+button1.height+4+image1.height+3;
{$IFDEF UNIX}form1.BorderStyle:=bssingle;{$ENDIF}
As seen, I have to make borderstyle:=bsnone to resize the form. With bssingle (also default) it just remains the same size.
The more strange phenomenon is that this problem occured here the day before yesterday. Before it was resizing fine with bssingle before. Maybe the problem is in introduction of beginformupdate...endformupdate before this code?

The complete source may be found here: http://sourceforge.net/projects/metarsweeper/files/Source/MetarSweeper_source_150212-1.tar.gz/download It's a minesweeper game.

Lazarus V.1.2.4
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Form resize fails under Debian/Linux
« Reply #1 on: February 12, 2015, 12:54:08 pm »
bsSingle and bsDialog aren't resizable during runtime (they have fixed w/h). This is so at least with gtk2 and qt. I think it's delphi compatibile behaviour.

Eugene Loza

  • Hero Member
  • *****
  • Posts: 561
    • My "almost daily" development blog
Re: Form resize fails under Debian/Linux
« Reply #2 on: February 12, 2015, 01:19:39 pm »
The problem is ... they WERE resizable two days ago.  8)
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Form resize fails under Debian/Linux
« Reply #3 on: February 12, 2015, 03:58:17 pm »
The problem is ... they WERE resizable two days ago.  8)

Have you changed lazarus version in the meantime ? I don't know if it was implemented during 1.2.4, take a look at svn browser.

Eugene Loza

  • Hero Member
  • *****
  • Posts: 561
    • My "almost daily" development blog
Re: Form resize fails under Debian/Linux
« Reply #4 on: February 13, 2015, 07:25:38 am »
No, version didn't change. It was the same computer with the same lazarus version 1.2.4. The Debian was not updated during this period.
The changes were made in the program. Introduced beginformupdate/endformupdate (however, removing this back doesn't make the form resize normally), made dynamic form objects generation 'as needed', not 'onformcreate'. Hmmm... the project was updated and saved in lazarus 1.2.6 32bit/windows. Maybe here could be the cause...
I'm gonna try installing newer lazarus version at work today.
« Last Edit: February 13, 2015, 07:28:29 am by Eugene Loza »
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Eugene Loza

  • Hero Member
  • *****
  • Posts: 561
    • My "almost daily" development blog
Re: Form resize fails under Debian/Linux
« Reply #5 on: February 14, 2015, 09:49:31 am »
Nope... 1.2.6 didn't help...
neither putting a form1.Resize; or form1.autosize:=true;

Also tried to remove all anchors. The result is the same.
However, the objects on the form (anchored buttons, labels, images) behave like the form has been resized and move to their 'correct' anchor position for the specified form width/height, but quickly revert back if the form is moved.
(UPD) setting form.borderstyle=bssizeable; also works like bsnone. But I need non-resizable form.
« Last Edit: February 14, 2015, 09:59:43 am by Eugene Loza »
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Windsurfer

  • Sr. Member
  • ****
  • Posts: 362
    • Windsurfer
Re: Form resize fails under Debian/Linux
« Reply #6 on: February 14, 2015, 11:14:47 am »
I have a similar problem. A working piece of code suddenly stopped working in qt and GTK2, but still works in Windows. Perhaps the following will help.

I read in the wiki or forum:
1) using the form resize event does not always work as expected in non Windows widget sets;
2) to use Clientwidth and Clientheight to allow for theme borders;
3) to resize the Picture.Bitmap, rather than the original bitmap;

I started from the beginning with a piece of test code, which is attached. It works in all widget sets, and allows tests with three different resize events, but I am still looking for my problem, which appears to be caused by drawing to an area that is not in memory.

zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Form resize fails under Debian/Linux
« Reply #7 on: February 14, 2015, 10:28:10 pm »
I have a similar problem. A working piece of code suddenly stopped working in qt and GTK2, but still works in Windows. Perhaps the following will help.

 It could be a bug. Better create test project which used to work in the past and open an issue about it.

Eugene Loza

  • Hero Member
  • *****
  • Posts: 561
    • My "almost daily" development blog
Re: Form resize fails under Debian/Linux
« Reply #8 on: February 19, 2015, 11:13:25 am »
no... still no luck... tried many possible combinations, but it fails. I think I should just rewrite everything from a scratch (in a more optimal way) and see if the same problem persists...
Lazarus 1.9 + FPC 3.1.1 Debian Jessie 64 bit.

My Free and Open Source games in Lazarus/FreePascal/CastleGameEngine:
https://decoherence.itch.io/
(and some ancient games in Turbo Pascal too)
Sources are here: https://github.com/eugeneloza?tab=repositories

Windsurfer

  • Sr. Member
  • ****
  • Posts: 362
    • Windsurfer
Re: Form resize fails under Debian/Linux
« Reply #9 on: February 22, 2015, 11:12:47 am »
I have isolated the bug to  procedure that works when called the first time. It only fails when called from a resize event. The error is a SIGSEGV, which means a memory fault. It does not happen with Windows, only qt and GTK2. I have created a new test app but have not yet repeat the fault. I' will keep looking.

Windsurfer

  • Sr. Member
  • ****
  • Posts: 362
    • Windsurfer
Re: Form resize fails under Debian/Linux
« Reply #10 on: February 25, 2015, 10:45:38 pm »
I have installed Lazarus 1.4 RC, and the SIGSEGV on resize problem seems to be fixed.